Skip to content

Commit 441b950

Browse files
authored
Rollup merge of #103401 - GuillaumeGomez:gui-test-headings-cleanup, r=notriddle
Use functions for headings rustdoc GUI test r? ````@notriddle````
2 parents 6be917a + 94a9ee3 commit 441b950

File tree

1 file changed

+76
-100
lines changed

1 file changed

+76
-100
lines changed

src/test/rustdoc-gui/headings.goml

+76-100
Original file line numberDiff line numberDiff line change
@@ -150,109 +150,85 @@ assert-css: ("h2#top-doc-prose-title", {"border-bottom-width": "1px"})
150150
assert-css: ("h3#top-doc-prose-sub-heading", {"font-size": "20px"})
151151
assert-css: ("h3#top-doc-prose-sub-heading", {"border-bottom-width": "1px"})
152152

153-
// Checking colors now.
153+
// Needed to check colors
154154
show-text: true
155-
local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"}
156155
goto: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
157-
assert-css: (
158-
".top-doc .docblock h2",
159-
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
160-
)
161-
assert-css: (
162-
".top-doc .docblock h3",
163-
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
164-
)
165-
assert-css: (
166-
".top-doc .docblock h4",
167-
{"color": "rgb(0, 0, 0)", "border-bottom": "1px solid rgb(221, 221, 221)"},
168-
)
169-
assert-css: (
170-
".top-doc .docblock h5",
171-
{"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
172-
)
173-
assert-css: (
174-
"#implementations-list .docblock h4",
175-
{"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
176-
)
177-
assert-css: (
178-
"#implementations-list .docblock h5",
179-
{"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
180-
)
181-
assert-css: (
182-
"#implementations-list .docblock h6",
183-
{"color": "rgb(0, 0, 0)", "border-bottom-width": "0px"},
184-
)
185156

186-
local-storage: {"rustdoc-theme": "dark"}
187-
reload:
188-
assert-css: (
189-
".top-doc .docblock h2",
190-
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
191-
)
192-
assert-css: (
193-
".top-doc .docblock h3",
194-
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
195-
)
196-
assert-css: (
197-
".top-doc .docblock h4",
198-
{"color": "rgb(221, 221, 221)", "border-bottom": "1px solid rgb(210, 210, 210)"},
199-
)
200-
assert-css: (
201-
".top-doc .docblock h5",
202-
{"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
203-
)
204-
assert-css: (
205-
"#implementations-list .docblock h4",
206-
{"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
207-
)
208-
assert-css: (
209-
"#implementations-list .docblock h5",
210-
{"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
211-
)
212-
assert-css: (
213-
"#implementations-list .docblock h6",
214-
{"color": "rgb(221, 221, 221)", "border-bottom-width": "0px"},
157+
define-function: (
158+
"check-colors",
159+
(theme, heading_color, small_heading_color, heading_border_color),
160+
[
161+
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
162+
("reload"),
163+
("assert-css", (
164+
".top-doc .docblock h2",
165+
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
166+
)),
167+
("assert-css", (
168+
".top-doc .docblock h3",
169+
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
170+
)),
171+
("assert-css", (
172+
".top-doc .docblock h4",
173+
{"color": |heading_color|, "border-bottom": "1px solid " + |heading_border_color|},
174+
)),
175+
("assert-css", (
176+
".top-doc .docblock h5",
177+
{"color": |small_heading_color|, "border-bottom-width": "0px"},
178+
)),
179+
("assert-css", (
180+
"#implementations-list .docblock h4",
181+
{"color": |heading_color|, "border-bottom-width": "0px"},
182+
)),
183+
("assert-css", (
184+
"#implementations-list .docblock h5",
185+
{"color": |small_heading_color|, "border-bottom-width": "0px"},
186+
)),
187+
("assert-css", (
188+
"#implementations-list .docblock h6",
189+
{"color": |small_heading_color|, "border-bottom-width": "0px"},
190+
)),
191+
],
192+
)
193+
call-function: (
194+
"check-colors",
195+
{
196+
"theme": "ayu",
197+
"heading_color": "rgb(255, 255, 255)",
198+
"small_heading_color": "rgb(197, 197, 197)",
199+
"heading_border_color": "rgb(92, 103, 115)",
200+
},
201+
)
202+
call-function: (
203+
"check-colors",
204+
{
205+
"theme": "dark",
206+
"heading_color": "rgb(221, 221, 221)",
207+
"small_heading_color": "rgb(221, 221, 221)",
208+
"heading_border_color": "rgb(210, 210, 210)",
209+
},
210+
)
211+
call-function: (
212+
"check-colors",
213+
{
214+
"theme": "light",
215+
"heading_color": "rgb(0, 0, 0)",
216+
"small_heading_color": "rgb(0, 0, 0)",
217+
"heading_border_color": "rgb(221, 221, 221)",
218+
},
219+
)
220+
221+
define-function: (
222+
"check-since-color",
223+
(theme),
224+
[
225+
("local-storage", {"rustdoc-theme": |theme|}),
226+
("reload"),
227+
("assert-css", (".since", {"color": "rgb(128, 128, 128)"}, ALL)),
228+
],
215229
)
216230

217-
local-storage: {"rustdoc-theme": "ayu"}
218-
reload:
219-
assert-css: (
220-
".top-doc .docblock h2",
221-
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
222-
)
223-
assert-css: (
224-
".top-doc .docblock h2",
225-
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
226-
)
227-
assert-css: (
228-
".top-doc .docblock h4",
229-
{"color": "rgb(255, 255, 255)", "border-bottom": "1px solid rgb(92, 103, 115)"},
230-
)
231-
assert-css: (
232-
".top-doc .docblock h5",
233-
{"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
234-
)
235-
assert-css: (
236-
"#implementations-list .docblock h4",
237-
{"color": "rgb(255, 255, 255)", "border-bottom-width": "0px"},
238-
)
239-
assert-css: (
240-
"#implementations-list .docblock h5",
241-
{"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
242-
)
243-
assert-css: (
244-
"#implementations-list .docblock h6",
245-
{"color": "rgb(197, 197, 197)", "border-bottom-width": "0px"},
246-
)
247-
248-
local-storage: {"rustdoc-theme": "light"}
249231
goto: "file://" + |DOC_PATH| + "/staged_api/struct.Foo.html"
250-
assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
251-
252-
local-storage: {"rustdoc-theme": "dark"}
253-
reload:
254-
assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
255-
256-
local-storage: {"rustdoc-theme": "ayu"}
257-
reload:
258-
assert-css: (".since", {"color": "rgb(128, 128, 128)"}, ALL)
232+
call-function: ("check-since-color", ("ayu"))
233+
call-function: ("check-since-color", ("dark"))
234+
call-function: ("check-since-color", ("light"))

0 commit comments

Comments
 (0)