Skip to content

Commit a925e20

Browse files
Add GUI regression test for search results colors
1 parent ef410f1 commit a925e20

File tree

2 files changed

+152
-4
lines changed

2 files changed

+152
-4
lines changed

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

+149-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ show-text: true
77
// Ayu theme
88
local-storage: {
99
"rustdoc-theme": "ayu",
10-
"rustdoc-preferred-dark-theme": "ayu",
1110
"rustdoc-use-system-theme": "false",
1211
}
1312
reload:
@@ -23,16 +22,66 @@ assert-css: (
2322
{"color": "rgb(0, 150, 207)"},
2423
)
2524

26-
// Checking the color for "keyword".
25+
// Checking the color of "keyword" text.
2726
assert-css: (
2827
"//*[@class='result-name']//*[text()='(keyword)']",
2928
{"color": "rgb(120, 135, 151)"},
3029
)
3130

31+
// Checking the color of "keyword".
32+
assert-css: (
33+
".result-name .keyword",
34+
{"color": "rgb(57, 175, 215)"},
35+
ALL,
36+
)
37+
// Check the color of "struct".
38+
assert-css: (
39+
".result-name .struct",
40+
{"color": "rgb(255, 160, 165)"},
41+
ALL,
42+
)
43+
// Check the color of "associated type".
44+
assert-css: (
45+
".result-name .associatedtype",
46+
{"color": "rgb(57, 175, 215)"},
47+
ALL,
48+
)
49+
// Check the color of "type method".
50+
assert-css: (
51+
".result-name .tymethod",
52+
{"color": "rgb(253, 214, 135)"},
53+
ALL,
54+
)
55+
// Check the color of "method".
56+
assert-css: (
57+
".result-name .method",
58+
{"color": "rgb(253, 214, 135)"},
59+
ALL,
60+
)
61+
// Check the color of "struct field".
62+
assert-css: (
63+
".result-name .structfield",
64+
{"color": "rgb(0, 150, 207)"},
65+
ALL,
66+
)
67+
// Check the color of "macro".
68+
assert-css: (
69+
".result-name .macro",
70+
{"color": "rgb(163, 122, 204)"},
71+
ALL,
72+
)
73+
// Check the color of "fn".
74+
assert-css: (
75+
".result-name .fn",
76+
{"color": "rgb(253, 214, 135)"},
77+
ALL,
78+
)
79+
3280
// Checking the `<a>` container.
3381
assert-css: (
3482
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
3583
{"color": "rgb(0, 150, 207)", "background-color": "rgba(0, 0, 0, 0)"},
84+
ALL,
3685
)
3786

3887
// Checking color and background on hover.
@@ -49,7 +98,6 @@ assert-css: (
4998
// Dark theme
5099
local-storage: {
51100
"rustdoc-theme": "dark",
52-
"rustdoc-preferred-dark-theme": "dark",
53101
"rustdoc-use-system-theme": "false",
54102
}
55103
reload:
@@ -71,6 +119,55 @@ assert-css: (
71119
{"color": "rgb(221, 221, 221)"},
72120
)
73121

122+
// Checking the color of "keyword".
123+
assert-css: (
124+
".result-name .keyword",
125+
{"color": "rgb(210, 153, 29)"},
126+
ALL,
127+
)
128+
// Check the color of "struct".
129+
assert-css: (
130+
".result-name .struct",
131+
{"color": "rgb(45, 191, 184)"},
132+
ALL,
133+
)
134+
// Check the color of "associated type".
135+
assert-css: (
136+
".result-name .associatedtype",
137+
{"color": "rgb(210, 153, 29)"},
138+
ALL,
139+
)
140+
// Check the color of "type method".
141+
assert-css: (
142+
".result-name .tymethod",
143+
{"color": "rgb(43, 171, 99)"},
144+
ALL,
145+
)
146+
// Check the color of "method".
147+
assert-css: (
148+
".result-name .method",
149+
{"color": "rgb(43, 171, 99)"},
150+
ALL,
151+
)
152+
// Check the color of "struct field".
153+
assert-css: (
154+
".result-name .structfield",
155+
{"color": "rgb(221, 221, 221)"},
156+
ALL,
157+
)
158+
// Check the color of "macro".
159+
assert-css: (
160+
".result-name .macro",
161+
{"color": "rgb(9, 189, 0)"},
162+
ALL,
163+
)
164+
// Check the color of "fn".
165+
assert-css: (
166+
".result-name .fn",
167+
{"color": "rgb(43, 171, 99)"},
168+
ALL,
169+
)
170+
74171
// Checking the `<a>` container.
75172
assert-css: (
76173
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
@@ -109,6 +206,55 @@ assert-css: (
109206
{"color": "rgb(0, 0, 0)"},
110207
)
111208

209+
// Checking the color of "keyword".
210+
assert-css: (
211+
".result-name .keyword",
212+
{"color": "rgb(56, 115, 173)"},
213+
ALL,
214+
)
215+
// Check the color of "struct".
216+
assert-css: (
217+
".result-name .struct",
218+
{"color": "rgb(173, 55, 138)"},
219+
ALL,
220+
)
221+
// Check the color of "associated type".
222+
assert-css: (
223+
".result-name .associatedtype",
224+
{"color": "rgb(56, 115, 173)"},
225+
ALL,
226+
)
227+
// Check the color of "type method".
228+
assert-css: (
229+
".result-name .tymethod",
230+
{"color": "rgb(173, 124, 55)"},
231+
ALL,
232+
)
233+
// Check the color of "method".
234+
assert-css: (
235+
".result-name .method",
236+
{"color": "rgb(173, 124, 55)"},
237+
ALL,
238+
)
239+
// Check the color of "struct field".
240+
assert-css: (
241+
".result-name .structfield",
242+
{"color": "rgb(0, 0, 0)"},
243+
ALL,
244+
)
245+
// Check the color of "macro".
246+
assert-css: (
247+
".result-name .macro",
248+
{"color": "rgb(6, 128, 0)"},
249+
ALL,
250+
)
251+
// Check the color of "fn".
252+
assert-css: (
253+
".result-name .fn",
254+
{"color": "rgb(173, 124, 55)"},
255+
ALL,
256+
)
257+
112258
// Checking the `<a>` container.
113259
assert-css: (
114260
"//*[@class='result-name']/*[text()='test_docs::']/ancestor::a",
@@ -132,7 +278,6 @@ goto: file://|DOC_PATH|/test_docs/index.html
132278
// this test is running on.
133279
local-storage: {
134280
"rustdoc-theme": "dark",
135-
"rustdoc-preferred-dark-theme": "dark",
136281
"rustdoc-use-system-theme": "false",
137282
}
138283
// If the text isn't displayed, the browser doesn't compute color style correctly...

src/test/rustdoc-gui/src/lib2/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@ pub trait Trait {
3838

3939
#[deprecated = "Whatever [`Foo`](#tadam)"]
4040
fn foo() {}
41+
fn fooo();
4142
}
4243

4344
impl Trait for Foo {
4445
type X = u32;
4546
const Y: u32 = 0;
47+
48+
fn fooo() {}
4649
}
4750

4851
impl implementors::Whatever for Foo {

0 commit comments

Comments
 (0)