about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-10-23 08:14:33 +0200
committerGitHub <noreply@github.com>2022-10-23 08:14:33 +0200
commit441b950bac194aa67aef6f39fbdc787bdc663aa7 (patch)
treee3f48dac425d00dec5932c3222840ed3c603311d
parent6be917a748a507cbbdf156a16ba410b332f0180c (diff)
parent94a9ee3692d43627aecc2b0889134d4b71e46257 (diff)
downloadrust-441b950bac194aa67aef6f39fbdc787bdc663aa7.tar.gz
rust-441b950bac194aa67aef6f39fbdc787bdc663aa7.zip
Rollup merge of #103401 - GuillaumeGomez:gui-test-headings-cleanup, r=notriddle
Use functions for headings rustdoc GUI test

r? ````@notriddle````
-rw-r--r--src/test/rustdoc-gui/headings.goml176
1 files changed, 76 insertions, 100 deletions
diff --git a/src/test/rustdoc-gui/headings.goml b/src/test/rustdoc-gui/headings.goml
index 9a77d8bbd15..85e17ca9551 100644
--- a/src/test/rustdoc-gui/headings.goml
+++ b/src/test/rustdoc-gui/headings.goml
@@ -150,109 +150,85 @@ assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
 assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
 assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
 
-// Checking colors now.
+// Needed to check colors
 show-text: true
-local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
 goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
-assert-css: (
-    ".top-doc .docblock h2",
-    {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
-)
-assert-css: (
-    ".top-doc .docblock h3",
-    {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
-)
-assert-css: (
-    ".top-doc .docblock h4",
-    {"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
-)
-assert-css: (
-    ".top-doc .docblock h5",
-    {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h4",
-    {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h5",
-    {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h6",
-    {"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
-)
 
-local-storage: {"rustdoc-theme": "dark"}
-reload:
-assert-css: (
-    ".top-doc .docblock h2",
-    {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
-)
-assert-css: (
-    ".top-doc .docblock h3",
-    {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
-)
-assert-css: (
-    ".top-doc .docblock h4",
-    {"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
-)
-assert-css: (
-    ".top-doc .docblock h5",
-    {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h4",
-    {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h5",
-    {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h6",
-    {"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
+define-function: (
+    "check-colors",
+    (theme, heading_color, small_heading_color, heading_border_color),
+    [
+        ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
+        ("reload"),
+        ("assert-css", (
+            ".top-doc .docblock h2",
+            {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
+        )),
+        ("assert-css", (
+            ".top-doc .docblock h3",
+            {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
+        )),
+        ("assert-css", (
+            ".top-doc .docblock h4",
+            {"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
+        )),
+        ("assert-css", (
+            ".top-doc .docblock h5",
+            {"color": |small_heading_color|, "border-bottom-width": "0px"},
+        )),
+        ("assert-css", (
+            "#implementations-list .docblock h4",
+            {"color": |heading_color|, "border-bottom-width": "0px"},
+        )),
+        ("assert-css", (
+            "#implementations-list .docblock h5",
+            {"color": |small_heading_color|, "border-bottom-width": "0px"},
+        )),
+        ("assert-css", (
+            "#implementations-list .docblock h6",
+            {"color": |small_heading_color|, "border-bottom-width": "0px"},
+        )),
+    ],
+)
+call-function: (
+    "check-colors",
+    {
+        "theme": "ayu",
+        "heading_color": "rgb(255, 255, 255)",
+        "small_heading_color": "rgb(197, 197, 197)",
+        "heading_border_color": "rgb(92, 103, 115)",
+    },
+)
+call-function: (
+    "check-colors",
+    {
+        "theme": "dark",
+        "heading_color": "rgb(221, 221, 221)",
+        "small_heading_color": "rgb(221, 221, 221)",
+        "heading_border_color": "rgb(210, 210, 210)",
+    },
+)
+call-function: (
+    "check-colors",
+    {
+        "theme": "light",
+        "heading_color": "rgb(0, 0, 0)",
+        "small_heading_color": "rgb(0, 0, 0)",
+        "heading_border_color": "rgb(221, 221, 221)",
+    },
+)
+
+define-function: (
+    "check-since-color",
+    (theme),
+    [
+        ("local-storage", {"rustdoc-theme": |theme|}),
+        ("reload"),
+        ("assert-css", (".since", {"color": "rgb(128, 128, 128)"}, ALL)),
+    ],
 )
 
-local-storage: {"rustdoc-theme": "ayu"}
-reload:
-assert-css: (
-    ".top-doc .docblock h2",
-    {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
-)
-assert-css: (
-    ".top-doc .docblock h2",
-    {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
-)
-assert-css: (
-    ".top-doc .docblock h4",
-    {"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
-)
-assert-css: (
-    ".top-doc .docblock h5",
-    {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h4",
-    {"color": "rgb(255, 255, 255)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h5",
-    {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
-)
-assert-css: (
-    "#implementations-list .docblock h6",
-    {"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
-)
-
-local-storage: {"rustdoc-theme": "light"}
 goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
-assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
-
-local-storage: {"rustdoc-theme": "dark"}
-reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
-
-local-storage: {"rustdoc-theme": "ayu"}
-reload:
-assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
+call-function: ("check-since-color", ("ayu"))
+call-function: ("check-since-color", ("dark"))
+call-function: ("check-since-color", ("light"))