Skip to content

Commit a901e01

Browse files
Rollup merge of #88005 - GuillaumeGomez:headers-gui-tests, r=notriddle
Add rustdoc GUI test for headers Add test for #87861. r? `@notriddle`
2 parents 12fbf25 + a3d3df4 commit a901e01

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// This test check for headers text and background colors for the different themes.
2+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
3+
4+
// This is needed so that the text color is computed.
5+
show-text: true
6+
7+
// Ayu theme
8+
local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
9+
reload:
10+
11+
assert-css: (".impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(0, 0, 0, 0)"}, ALL)
12+
assert-css: (".impl .code-header", {"color": "rgb(230, 225, 207)", "background-color": "rgb(15, 20, 25)"}, ALL)
13+
14+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
15+
assert-css: ("#impl", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"})
16+
17+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
18+
assert-css: ("#method\.must_use", {"color": "rgb(197, 197, 197)", "background-color": "rgba(255, 236, 164, 0.06)"}, ALL)
19+
20+
// Dark theme
21+
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
22+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
23+
24+
assert-css: (".impl", {"color": "rgb(221, 221, 221)", "background-color": "rgba(0, 0, 0, 0)"}, ALL)
25+
assert-css: (".impl .code-header", {"color": "rgb(221, 221, 221)", "background-color": "rgb(53, 53, 53)"}, ALL)
26+
27+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
28+
assert-css: ("#impl", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"})
29+
30+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
31+
assert-css: ("#method\.must_use", {"color": "rgb(221, 221, 221)", "background-color": "rgb(73, 74, 61)"}, ALL)
32+
33+
// Light theme
34+
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
35+
reload:
36+
37+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html
38+
39+
assert-css: (".impl", {"color": "rgb(0, 0, 0)", "background-color": "rgba(0, 0, 0, 0)"}, ALL)
40+
assert-css: (".impl .code-header", {"color": "rgb(0, 0, 0)", "background-color": "rgb(255, 255, 255)"}, ALL)
41+
42+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#impl
43+
assert-css: ("#impl", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"})
44+
45+
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.must_use
46+
assert-css: ("#method\.must_use", {"color": "rgb(0, 0, 0)", "background-color": "rgb(253, 255, 211)"}, ALL)

src/test/rustdoc-gui/search-result-colors.goml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
goto: file://|DOC_PATH|/test_docs/index.html
2-
// We set the theme so we're sure that the corect values will be used, whatever the computer
2+
// We set the theme so we're sure that the correct values will be used, whatever the computer
33
// this test is running on.
44
local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
55
// If the text isn't displayed, the browser doesn't compute color style correctly...

0 commit comments

Comments
 (0)