Rollup merge of #103189 - GuillaumeGomez:clean-up-gui-tests, r=notriddle

Clean up code-color and headers-color rustdoc GUI tests

r? ``@notriddle``
This commit is contained in:
Matthias Krüger 2022-10-18 21:18:47 +02:00 committed by GitHub
commit aaee737650
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 78 additions and 131 deletions

View File

@ -5,26 +5,20 @@
goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html" goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
// If the text isn't displayed, the browser doesn't compute color style correctly... // If the text isn't displayed, the browser doesn't compute color style correctly...
show-text: true show-text: true
// Set the theme to dark.
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:
assert-css: (".docblock pre > code", {"color": "rgb(221, 221, 221)"}, ALL) define-function: (
assert-css: (".docblock > p > code", {"color": "rgb(221, 221, 221)"}, ALL) "check-colors",
(theme, doc_code_color, doc_inline_code_color),
[
// Set the theme.
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
// We reload the page so the local storage settings are being used.
("reload"),
("assert-css", (".docblock pre > code", {"color": |doc_code_color|}, ALL)),
("assert-css", (".docblock > p > code", {"color": |doc_inline_code_color|}, ALL)),
],
)
// Set the theme to ayu. call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"} call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)"))
// We reload the page so the local storage settings are being used. call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)"))
reload:
assert-css: (".docblock pre > code", {"color": "rgb(230, 225, 207)"}, ALL)
assert-css: (".docblock > p > code", {"color": "rgb(255, 180, 84)"}, ALL)
// Set the theme to light.
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
// We reload the page so the local storage settings are being used.
reload:
assert-css: (".docblock pre > code", {"color": "rgb(0, 0, 0)"}, ALL)
assert-css: (".docblock > p > code", {"color": "rgb(0, 0, 0)"}, ALL)

View File

@ -1,117 +1,70 @@
// This test check for headers text and background colors for the different themes. // This test check for headers text and background colors for the different themes.
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
// This is needed so that the text color is computed. define-function: (
show-text: true "check-colors",
(theme, color, code_header_color, focus_background_color, headings_color),
// Ayu theme [
local-storage: { ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"),
"rustdoc-theme": "ayu", // This is needed so that the text color is computed.
"rustdoc-preferred-dark-theme": "ayu", ("show-text", true),
"rustdoc-use-system-theme": "false", ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
} ("reload"),
reload: ("assert-css", (
".impl",
assert-css: ( {"color": |color|, "background-color": "rgba(0, 0, 0, 0)"},
".impl", ALL,
{"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, )),
ALL, ("assert-css", (
) ".impl .code-header",
assert-css: ( {"color": |code_header_color|, "background-color": "rgba(0, 0, 0, 0)"},
".impl .code-header", ALL,
{"color": "rgb(230, 225, 207)", "background-color": "rgba(0, 0, 0, 0)"}, )),
ALL, ("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"),
("assert-css", (
"#impl-Foo",
{"color": |color|, "background-color": |focus_background_color|},
)),
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"),
("assert-css", (
"#method\.must_use",
{"color": |color|, "background-color": |focus_background_color|},
ALL,
)),
("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"),
("assert-css", (".small-section-header a", {"color": |color|}, ALL)),
("goto", "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"),
// We select headings (h2, h3, h...).
("assert-css", (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)),
],
) )
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo" call-function: (
assert-css: ( "check-colors",
"#impl-Foo", {
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, "theme": "ayu",
"color": "rgb(197, 197, 197)",
"code_header_color": "rgb(230, 225, 207)",
"focus_background_color": "rgba(255, 236, 164, 0.06)",
"headings_color": "rgb(57, 175, 215)",
},
) )
call-function: (
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use" "check-colors",
assert-css: ( {
"#method\.must_use", "theme": "dark",
{"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, "color": "rgb(221, 221, 221)",
ALL, "code_header_color": "rgb(221, 221, 221)",
"focus_background_color": "rgb(73, 74, 61)",
"headings_color": "rgb(210, 153, 29)",
},
) )
call-function: (
goto: "file://" + |DOC_PATH| + "/test_docs/index.html" "check-colors",
assert-css: (".small-section-header a", {"color": "rgb(197, 197, 197)"}, ALL) {
"theme": "light",
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html" "color": "rgb(0, 0, 0)",
// We select headings (h2, h3, h...). "code_header_color": "rgb(0, 0, 0)",
assert-css: (".docblock > :not(p) > a", {"color": "rgb(57, 175, 215)"}, ALL) "focus_background_color": "rgb(253, 255, 211)",
"headings_color": "rgb(56, 115, 173)",
// Dark theme },
local-storage: {
"rustdoc-theme": "dark",
"rustdoc-preferred-dark-theme": "dark",
"rustdoc-use-system-theme": "false",
}
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (
".impl",
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
ALL,
) )
assert-css: (
".impl .code-header",
{"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"},
ALL,
)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: (
"#impl-Foo",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"},
ALL,
)
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": "rgb(221, 221, 221)"}, ALL)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(210, 153, 29)"}, ALL)
// Light theme
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
reload:
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-css: (
".impl",
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
ALL,
)
assert-css: (
".impl .code-header",
{"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"},
ALL,
)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#impl-Foo"
assert-css: ("#impl-Foo", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html#method.must_use"
assert-css: (
"#method\.must_use",
{"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"},
ALL,
)
goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-css: (".small-section-header a", {"color": "rgb(0, 0, 0)"}, ALL)
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": "rgb(56, 115, 173)"}, ALL)