about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2021-08-13 15:29:12 +0200
committerGitHub <noreply@github.com>2021-08-13 15:29:12 +0200
commitf382d23f7a69ff053729c4bfba2bafe9d87b981b (patch)
treea38cce269c1a399919dee91f1b5b90ce51955af6
parent96c9dabd1792e45ea426e5459bc56bdcf4bc526e (diff)
parenta3d3df4ba674aab0fd71744e6d0bdccc0c4c8ae4 (diff)
downloadrust-f382d23f7a69ff053729c4bfba2bafe9d87b981b.tar.gz
rust-f382d23f7a69ff053729c4bfba2bafe9d87b981b.zip
Rollup merge of #88005 - GuillaumeGomez:headers-gui-tests, r=notriddle
Add rustdoc GUI test for headers

Add test for #87861.

r? ``@notriddle``
-rw-r--r--src/test/rustdoc-gui/headers-color.goml46
-rw-r--r--src/test/rustdoc-gui/search-result-colors.goml2
2 files changed, 47 insertions, 1 deletions
diff --git a/src/test/rustdoc-gui/headers-color.goml b/src/test/rustdoc-gui/headers-color.goml
new file mode 100644
index 00000000000..b5be31bd2cc
--- /dev/null
+++ b/src/test/rustdoc-gui/headers-color.goml
@@ -0,0 +1,46 @@
+// 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.
+show-text: true
+
+// Ayu theme
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
+reload:
+
+assert-css: (".impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ALL)
+assert-css: (".impl .code-header", {"color": "rgb(230, 225, 207)", "background-color": "rgb(15, 20, 25)"}, ALL)
+
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
+assert-css: ("#impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"})
+
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
+assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL)
+
+// 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": "rgb(53, 53, 53)"}, ALL)
+
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
+assert-css: ("#impl", {"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)
+
+// 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": "rgb(255, 255, 255)"}, ALL)
+
+goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
+assert-css: ("#impl", {"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)
diff --git a/src/test/rustdoc-gui/search-result-colors.goml b/src/test/rustdoc-gui/search-result-colors.goml
index 6ed62006151..daf8bc9dea3 100644
--- a/src/test/rustdoc-gui/search-result-colors.goml
+++ b/src/test/rustdoc-gui/search-result-colors.goml
@@ -1,5 +1,5 @@
 goto: file://|DOC_PATH|/test_docs/index.html
-// We set the theme so we're sure that the corect values will be used, whatever the computer
+// We set the theme so we're sure that the correct values will be used, whatever the computer
 // this test is running on.
 local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
 // If the text isn't displayed, the browser doesn't compute color style correctly...