Skip to content

Commit 617f246

Browse files
authored
Rollup merge of #103837 - GuillaumeGomez:migrate-sidebar-links-color-gui-test, r=notriddle
Migrate sidebar-links-color GUI test to functions r? `@notriddle`
2 parents e2a6d28 + a1dfefa commit 617f246

File tree

2 files changed

+162
-225
lines changed

2 files changed

+162
-225
lines changed

src/test/rustdoc-gui/sidebar-links-color.goml

+162-224
Original file line numberDiff line numberDiff line change
@@ -4,230 +4,168 @@ goto: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
44
// This is needed so that the text color is computed.
55
show-text: true
66

7-
// Ayu theme
8-
local-storage: {
9-
"rustdoc-theme": "ayu",
10-
"rustdoc-use-system-theme": "false",
11-
}
12-
reload:
13-
14-
// Struct
15-
assert-css: (
16-
".sidebar .block.struct a:not(.current)",
17-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
18-
)
19-
move-cursor-to: ".sidebar .block.struct a:not(.current)"
20-
assert-css: (
21-
".sidebar .block.struct a:hover",
22-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
23-
)
24-
// Enum
25-
assert-css: (
26-
".sidebar .block.enum a",
27-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
28-
)
29-
move-cursor-to: ".sidebar .block.enum a"
30-
assert-css: (
31-
".sidebar .block.enum a:hover",
32-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
33-
)
34-
// Union
35-
assert-css: (
36-
".sidebar .block.union a",
37-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
38-
)
39-
move-cursor-to: ".sidebar .block.union a"
40-
assert-css: (
41-
".sidebar .block.union a:hover",
42-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
43-
)
44-
// Trait
45-
assert-css: (
46-
".sidebar .block.trait a",
47-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
48-
)
49-
move-cursor-to: ".sidebar .block.trait a"
50-
assert-css: (
51-
".sidebar .block.trait a:hover",
52-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
53-
)
54-
// Function
55-
assert-css: (
56-
".sidebar .block.fn a",
57-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
58-
)
59-
move-cursor-to: ".sidebar .block.fn a"
60-
assert-css: (
61-
".sidebar .block.fn a:hover",
62-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
63-
)
64-
// Type definition
65-
assert-css: (
66-
".sidebar .block.type a",
67-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
68-
)
69-
move-cursor-to: ".sidebar .block.type a"
70-
assert-css: (
71-
".sidebar .block.type a:hover",
72-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
73-
)
74-
// Keyword
75-
assert-css: (
76-
".sidebar .block.keyword a",
77-
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"},
78-
)
79-
move-cursor-to: ".sidebar .block.keyword a"
80-
assert-css: (
81-
".sidebar .block.keyword a:hover",
82-
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"},
83-
)
84-
85-
// Dark theme
86-
local-storage: {"rustdoc-theme": "dark"}
87-
reload:
88-
89-
// Struct
90-
assert-css: (
91-
".sidebar .block.struct a:not(.current)",
92-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
93-
)
94-
move-cursor-to: ".sidebar .block.struct a:not(.current)"
95-
assert-css: (
96-
".sidebar .block.struct a:hover",
97-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
98-
)
99-
// Enum
100-
assert-css: (
101-
".sidebar .block.enum a",
102-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
103-
)
104-
move-cursor-to: ".sidebar .block.enum a"
105-
assert-css: (
106-
".sidebar .block.enum a:hover",
107-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
108-
)
109-
// Union
110-
assert-css: (
111-
".sidebar .block.union a",
112-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
113-
)
114-
move-cursor-to: ".sidebar .block.union a"
115-
assert-css: (
116-
".sidebar .block.union a:hover",
117-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
7+
define-function: (
8+
"check-colors",
9+
(
10+
theme, struct, struct_hover, struct_hover_background, enum, enum_hover,
11+
enum_hover_background, union, union_hover, union_hover_background, trait, trait_hover,
12+
trait_hover_background, fn, fn_hover, fn_hover_background, type, type_hover,
13+
type_hover_background, keyword, keyword_hover, keyword_hover_background,
14+
),
15+
[
16+
("local-storage", { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false" }),
17+
("reload"),
18+
// Struct
19+
("assert-css", (
20+
".sidebar .block.struct a:not(.current)",
21+
{"color": |struct|, "background-color": "rgba(0, 0, 0, 0)"},
22+
)),
23+
("move-cursor-to", ".sidebar .block.struct a:not(.current)"),
24+
("assert-css", (
25+
".sidebar .block.struct a:hover",
26+
{"color": |struct_hover|, "background-color": |struct_hover_background|},
27+
)),
28+
// Enum
29+
("assert-css", (
30+
".sidebar .block.enum a",
31+
{"color": |enum|, "background-color": "rgba(0, 0, 0, 0)"},
32+
)),
33+
("move-cursor-to", ".sidebar .block.enum a"),
34+
("assert-css", (
35+
".sidebar .block.enum a:hover",
36+
{"color": |enum_hover|, "background-color": |enum_hover_background|},
37+
)),
38+
// Union
39+
("assert-css", (
40+
".sidebar .block.union a",
41+
{"color": |union|, "background-color": "rgba(0, 0, 0, 0)"},
42+
)),
43+
("move-cursor-to", ".sidebar .block.union a"),
44+
("assert-css", (
45+
".sidebar .block.union a:hover",
46+
{"color": |union_hover|, "background-color": |union_hover_background|},
47+
)),
48+
// Trait
49+
("assert-css", (
50+
".sidebar .block.trait a",
51+
{"color": |trait|, "background-color": "rgba(0, 0, 0, 0)"},
52+
)),
53+
("move-cursor-to", ".sidebar .block.trait a"),
54+
("assert-css", (
55+
".sidebar .block.trait a:hover",
56+
{"color": |trait_hover|, "background-color": |trait_hover_background|},
57+
)),
58+
// Function
59+
("assert-css", (
60+
".sidebar .block.fn a",
61+
{"color": |fn|, "background-color": "rgba(0, 0, 0, 0)"},
62+
)),
63+
("move-cursor-to", ".sidebar .block.fn a"),
64+
("assert-css", (
65+
".sidebar .block.fn a:hover",
66+
{"color": |fn_hover|, "background-color": |fn_hover_background|},
67+
)),
68+
// Type definition
69+
("assert-css", (
70+
".sidebar .block.type a",
71+
{"color": |type|, "background-color": "rgba(0, 0, 0, 0)"},
72+
)),
73+
("move-cursor-to", ".sidebar .block.type a"),
74+
("assert-css", (
75+
".sidebar .block.type a:hover",
76+
{"color": |type_hover|, "background-color": |type_hover_background|},
77+
)),
78+
// Keyword
79+
("assert-css", (
80+
".sidebar .block.keyword a",
81+
{"color": |keyword|, "background-color": "rgba(0, 0, 0, 0)"},
82+
)),
83+
("move-cursor-to", ".sidebar .block.keyword a"),
84+
("assert-css", (
85+
".sidebar .block.keyword a:hover",
86+
{"color": |keyword_hover|, "background-color": |keyword_hover_background|},
87+
)),
88+
]
11889
)
119-
// Trait
120-
assert-css: (
121-
".sidebar .block.trait a",
122-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
123-
)
124-
move-cursor-to: ".sidebar .block.trait a"
125-
assert-css: (
126-
".sidebar .block.trait a:hover",
127-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
128-
)
129-
// Function
130-
assert-css: (
131-
".sidebar .block.fn a",
132-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
133-
)
134-
move-cursor-to: ".sidebar .block.fn a"
135-
assert-css: (
136-
".sidebar .block.fn a:hover",
137-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
138-
)
139-
// Type definition
140-
assert-css: (
141-
".sidebar .block.type a",
142-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
143-
)
144-
move-cursor-to: ".sidebar .block.type a"
145-
assert-css: (
146-
".sidebar .block.type a:hover",
147-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
148-
)
149-
// Keyword
150-
assert-css: (
151-
".sidebar .block.keyword a",
152-
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"},
153-
)
154-
move-cursor-to: ".sidebar .block.keyword a"
155-
assert-css: (
156-
".sidebar .block.keyword a:hover",
157-
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"},
158-
)
159-
160-
// Light theme
161-
local-storage: {"rustdoc-theme": "light"}
162-
reload:
16390

164-
// Struct
165-
assert-css: (
166-
".sidebar .block.struct a:not(.current)",
167-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
168-
)
169-
move-cursor-to: ".sidebar .block.struct a:not(.current)"
170-
assert-css: (
171-
".sidebar .block.struct a:hover",
172-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
173-
)
174-
// Enum
175-
assert-css: (
176-
".sidebar .block.enum a",
177-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
178-
)
179-
move-cursor-to: ".sidebar .block.enum a"
180-
assert-css: (
181-
".sidebar .block.enum a:hover",
182-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
183-
)
184-
// Union
185-
assert-css: (
186-
".sidebar .block.union a",
187-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
188-
)
189-
move-cursor-to: ".sidebar .block.union a"
190-
assert-css: (
191-
".sidebar .block.union a:hover",
192-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
193-
)
194-
// Trait
195-
assert-css: (
196-
".sidebar .block.trait a",
197-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
198-
)
199-
move-cursor-to: ".sidebar .block.trait a"
200-
assert-css: (
201-
".sidebar .block.trait a:hover",
202-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
203-
)
204-
// Function
205-
assert-css: (
206-
".sidebar .block.fn a",
207-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
208-
)
209-
move-cursor-to: ".sidebar .block.fn a"
210-
assert-css: (
211-
".sidebar .block.fn a:hover",
212-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
213-
)
214-
// Type definition
215-
assert-css: (
216-
".sidebar .block.type a",
217-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
218-
)
219-
move-cursor-to: ".sidebar .block.type a"
220-
assert-css: (
221-
".sidebar .block.type a:hover",
222-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
223-
)
224-
// Keyword
225-
assert-css: (
226-
".sidebar .block.keyword a",
227-
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"},
228-
)
229-
move-cursor-to: ".sidebar .block.keyword a"
230-
assert-css: (
231-
".sidebar .block.keyword a:hover",
232-
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"},
91+
call-function: (
92+
"check-colors",
93+
{
94+
"theme": "ayu",
95+
"struct": "rgb(83, 177, 219)",
96+
"struct_hover": "rgb(255, 180, 76)",
97+
"struct_hover_background": "rgba(0, 0, 0, 0)",
98+
"enum": "rgb(83, 177, 219)",
99+
"enum_hover": "rgb(255, 180, 76)",
100+
"enum_hover_background": "rgba(0, 0, 0, 0)",
101+
"union": "rgb(83, 177, 219)",
102+
"union_hover": "rgb(255, 180, 76)",
103+
"union_hover_background": "rgba(0, 0, 0, 0)",
104+
"trait": "rgb(83, 177, 219)",
105+
"trait_hover": "rgb(255, 180, 76)",
106+
"trait_hover_background": "rgba(0, 0, 0, 0)",
107+
"fn": "rgb(83, 177, 219)",
108+
"fn_hover": "rgb(255, 180, 76)",
109+
"fn_hover_background": "rgba(0, 0, 0, 0)",
110+
"type": "rgb(83, 177, 219)",
111+
"type_hover": "rgb(255, 180, 76)",
112+
"type_hover_background": "rgba(0, 0, 0, 0)",
113+
"keyword": "rgb(83, 177, 219)",
114+
"keyword_hover": "rgb(255, 180, 76)",
115+
"keyword_hover_background": "rgba(0, 0, 0, 0)",
116+
}
117+
)
118+
call-function: (
119+
"check-colors",
120+
{
121+
"theme": "dark",
122+
"struct": "rgb(253, 191, 53)",
123+
"struct_hover": "rgb(253, 191, 53)",
124+
"struct_hover_background": "rgb(68, 68, 68)",
125+
"enum": "rgb(253, 191, 53)",
126+
"enum_hover": "rgb(253, 191, 53)",
127+
"enum_hover_background": "rgb(68, 68, 68)",
128+
"union": "rgb(253, 191, 53)",
129+
"union_hover": "rgb(253, 191, 53)",
130+
"union_hover_background": "rgb(68, 68, 68)",
131+
"trait": "rgb(253, 191, 53)",
132+
"trait_hover": "rgb(253, 191, 53)",
133+
"trait_hover_background": "rgb(68, 68, 68)",
134+
"fn": "rgb(253, 191, 53)",
135+
"fn_hover": "rgb(253, 191, 53)",
136+
"fn_hover_background": "rgb(68, 68, 68)",
137+
"type": "rgb(253, 191, 53)",
138+
"type_hover": "rgb(253, 191, 53)",
139+
"type_hover_background": "rgb(68, 68, 68)",
140+
"keyword": "rgb(253, 191, 53)",
141+
"keyword_hover": "rgb(253, 191, 53)",
142+
"keyword_hover_background": "rgb(68, 68, 68)",
143+
}
144+
)
145+
call-function: (
146+
"check-colors",
147+
{
148+
"theme": "light",
149+
"struct": "rgb(53, 109, 164)",
150+
"struct_hover": "rgb(53, 109, 164)",
151+
"struct_hover_background": "rgb(255, 255, 255)",
152+
"enum": "rgb(53, 109, 164)",
153+
"enum_hover": "rgb(53, 109, 164)",
154+
"enum_hover_background": "rgb(255, 255, 255)",
155+
"union": "rgb(53, 109, 164)",
156+
"union_hover": "rgb(53, 109, 164)",
157+
"union_hover_background": "rgb(255, 255, 255)",
158+
"trait": "rgb(53, 109, 164)",
159+
"trait_hover": "rgb(53, 109, 164)",
160+
"trait_hover_background": "rgb(255, 255, 255)",
161+
"fn": "rgb(53, 109, 164)",
162+
"fn_hover": "rgb(53, 109, 164)",
163+
"fn_hover_background": "rgb(255, 255, 255)",
164+
"type": "rgb(53, 109, 164)",
165+
"type_hover": "rgb(53, 109, 164)",
166+
"type_hover_background": "rgb(255, 255, 255)",
167+
"keyword": "rgb(53, 109, 164)",
168+
"keyword_hover": "rgb(53, 109, 164)",
169+
"keyword_hover_background": "rgb(255, 255, 255)",
170+
}
233171
)

0 commit comments

Comments
 (0)