]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/codeblock-tooltip.goml
Auto merge of #104431 - alistair23:alistair/rv64-profiler, r=Mark-Simulacrum
[rust.git] / src / test / rustdoc-gui / codeblock-tooltip.goml
1 // Checking the colors of the codeblocks tooltips.
2 goto: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
3 show-text: true
4
5 define-function: (
6     "check-colors",
7     (theme, background, color, border),
8     [
9         // Setting the theme.
10         ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}),
11         ("reload"),
12
13         // compile_fail block
14         ("assert-css", (
15             ".docblock .example-wrap.compile_fail .tooltip",
16             {"color": "rgba(255, 0, 0, 0.5)"},
17         )),
18         ("assert-css", (
19             ".docblock .example-wrap.compile_fail",
20             {"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
21         )),
22
23         ("move-cursor-to", ".docblock .example-wrap.compile_fail"),
24
25         ("assert-css", (
26             ".docblock .example-wrap.compile_fail .tooltip",
27             {"color": "rgb(255, 0, 0)"},
28         )),
29         ("assert-css", (
30             ".docblock .example-wrap.compile_fail",
31             {"border-left": "2px solid rgb(255, 0, 0)"},
32         )),
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         )),
52
53         // should_panic block
54         ("assert-css", (
55             ".docblock .example-wrap.should_panic .tooltip",
56             {"color": "rgba(255, 0, 0, 0.5)"},
57         )),
58         ("assert-css", (
59             ".docblock .example-wrap.should_panic",
60             {"border-left": "2px solid rgba(255, 0, 0, 0.5)"},
61         )),
62
63         ("move-cursor-to", ".docblock .example-wrap.should_panic"),
64
65         ("assert-css", (
66             ".docblock .example-wrap.should_panic .tooltip",
67             {"color": "rgb(255, 0, 0)"},
68         )),
69         ("assert-css", (
70             ".docblock .example-wrap.should_panic",
71             {"border-left": "2px solid rgb(255, 0, 0)"},
72         )),
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         )),
92
93         // ignore block
94         ("assert-css", (
95             ".docblock .example-wrap.ignore .tooltip",
96             {"color": "rgba(255, 142, 0, 0.6)"},
97         )),
98         ("assert-css", (
99             ".docblock .example-wrap.ignore",
100             {"border-left": "2px solid rgba(255, 142, 0, 0.6)"},
101         )),
102
103         ("move-cursor-to", ".docblock .example-wrap.ignore"),
104
105         ("assert-css", (
106             ".docblock .example-wrap.ignore .tooltip",
107             {"color": "rgb(255, 142, 0)"},
108         )),
109         ("assert-css", (
110             ".docblock .example-wrap.ignore",
111             {"border-left": "2px solid rgb(255, 142, 0)"},
112         )),
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         )),
132     ],
133 )
134
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(0, 0, 0)",
150     "color": "rgb(255, 255, 255)",
151     "border": "rgb(224, 224, 224)",
152 })