about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2024-05-05 19:28:31 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2024-05-05 20:07:12 +0200
commite460901b13302da6b50d97b0f340b116059517ba (patch)
tree158dcbea8724d74d36f4dfc27ea0d392389ae5c7
parent0cbebd07ee23cacccf0fa5522d658a3ebfc4c19f (diff)
downloadrust-e460901b13302da6b50d97b0f340b116059517ba.tar.gz
rust-e460901b13302da6b50d97b0f340b116059517ba.zip
Add GUI regression test for setting's cog color
-rw-r--r--tests/rustdoc-gui/settings-button.goml31
-rw-r--r--tests/rustdoc-gui/settings.goml1
2 files changed, 31 insertions, 1 deletions
diff --git a/tests/rustdoc-gui/settings-button.goml b/tests/rustdoc-gui/settings-button.goml
new file mode 100644
index 00000000000..c38a537e047
--- /dev/null
+++ b/tests/rustdoc-gui/settings-button.goml
@@ -0,0 +1,31 @@
+// This test ensures that the icon of the settings button looks as expected on
+// all themes.
+include: "utils.goml"
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+show-text: true
+
+define-function: (
+    "check-image",
+    [theme, filter],
+    block {
+        call-function: ("switch-theme", {"theme": |theme|})
+        assert-css: ("#settings-menu > a::before", {
+            "filter": |filter|,
+            "width": "22px",
+            "height": "22px",
+        })
+    }
+)
+
+call-function: ("check-image", {
+    "theme": "ayu",
+    "filter": "invert(1)",
+})
+call-function: ("check-image", {
+    "theme": "dark",
+    "filter": "none",
+})
+call-function: ("check-image", {
+    "theme": "light",
+    "filter": "none",
+})
diff --git a/tests/rustdoc-gui/settings.goml b/tests/rustdoc-gui/settings.goml
index 0011e44ca59..3f4f2946bf5 100644
--- a/tests/rustdoc-gui/settings.goml
+++ b/tests/rustdoc-gui/settings.goml
@@ -1,6 +1,5 @@
 // This test ensures that the settings menu display is working as expected and that
 // the settings page is also rendered as expected.
-include: "utils.goml"
 go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
 show-text: true // needed when we check for colors below.
 // First, we check that the settings page doesn't exist.