Skip to content

Commit 11d0c97

Browse files
Extend codeblock GUI test to include tooltips
1 parent 16b5590 commit 11d0c97

File tree

1 file changed

+76
-4
lines changed

1 file changed

+76
-4
lines changed

src/test/rustdoc-gui/codeblock-tooltip.goml

+76-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ show-text: true
44

55
define-function: (
66
"check-colors",
7-
(theme),
7+
(theme, background, color, border),
88
[
99
// Setting the theme.
1010
("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
@@ -30,6 +30,25 @@ define-function: (
3030
".docblock .example-wrap.compile_fail",
3131
{"border-left": "2px solid rgb(255, 0, 0)"},
3232
)),
33+
("assert-css", (
34+
".docblock .example-wrap.compile_fail .tooltip::after",
35+
{
36+
"content": '"This example deliberately fails to compile"',
37+
"text-align": "center",
38+
"padding": "5px 3px 3px",
39+
"background-color": |background|,
40+
"color": |color|,
41+
"border": "1px solid " + |border|,
42+
},
43+
)),
44+
("assert-css", (
45+
".docblock .example-wrap.compile_fail .tooltip::before",
46+
{
47+
"border-width": "5px",
48+
"border-style": "solid",
49+
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
50+
},
51+
)),
3352

3453
// should_panic block
3554
("assert-css", (
@@ -51,6 +70,25 @@ define-function: (
5170
".docblock .example-wrap.should_panic",
5271
{"border-left": "2px solid rgb(255, 0, 0)"},
5372
)),
73+
("assert-css", (
74+
".docblock .example-wrap.should_panic .tooltip::after",
75+
{
76+
"content": '"This example panics"',
77+
"text-align": "center",
78+
"padding": "5px 3px 3px",
79+
"background-color": |background|,
80+
"color": |color|,
81+
"border": "1px solid " + |border|,
82+
},
83+
)),
84+
("assert-css", (
85+
".docblock .example-wrap.should_panic .tooltip::before",
86+
{
87+
"border-width": "5px",
88+
"border-style": "solid",
89+
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
90+
},
91+
)),
5492

5593
// ignore block
5694
("assert-css", (
@@ -72,9 +110,43 @@ define-function: (
72110
".docblock .example-wrap.ignore",
73111
{"border-left": "2px solid rgb(255, 142, 0)"},
74112
)),
113+
("assert-css", (
114+
".docblock .example-wrap.ignore .tooltip::after",
115+
{
116+
"content": '"This example is not tested"',
117+
"text-align": "center",
118+
"padding": "5px 3px 3px",
119+
"background-color": |background|,
120+
"color": |color|,
121+
"border": "1px solid " + |border|,
122+
},
123+
)),
124+
("assert-css", (
125+
".docblock .example-wrap.ignore .tooltip::before",
126+
{
127+
"border-width": "5px",
128+
"border-style": "solid",
129+
"border-color": "rgba(0, 0, 0, 0) " + |background| + " rgba(0, 0, 0, 0) rgba(0, 0, 0, 0)",
130+
},
131+
)),
75132
],
76133
)
77134

78-
call-function: ("check-colors", ("ayu"))
79-
call-function: ("check-colors", ("dark"))
80-
call-function: ("check-colors", ("light"))
135+
call-function: ("check-colors", {
136+
"theme": "ayu",
137+
"background": "rgb(49, 69, 89)",
138+
"color": "rgb(197, 197, 197)",
139+
"border": "rgb(92, 103, 115)",
140+
})
141+
call-function: ("check-colors", {
142+
"theme": "dark",
143+
"background": "rgb(0, 0, 0)",
144+
"color": "rgb(255, 255, 255)",
145+
"border": "rgb(224, 224, 224)",
146+
})
147+
call-function: ("check-colors", {
148+
"theme": "light",
149+
"background": "rgb(253, 255, 211)",
150+
"color": "rgb(255, 255, 255)",
151+
"border": "rgb(224, 224, 224)",
152+
})

0 commit comments

Comments
 (0)