Skip to content

Commit 0922172

Browse files
authored
Rollup merge of #102008 - GuillaumeGomez:notable-trait-gui-test, r=notriddle
Add GUI test for notable traits element position Fixes #101891. r? ````@notriddle````
2 parents 2c57a5b + db2d5df commit 0922172

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
// This test checks the position of the `i` for the notable traits.
2+
goto: file://|DOC_PATH|/test_docs/struct.NotableStructWithLongName.html
3+
show-text: true
4+
// We start with a wide screen.
5+
size: (1100, 600)
6+
// Checking they have the same y position.
7+
compare-elements-position: (
8+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
9+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
10+
("y"),
11+
)
12+
// Checking they don't have the same x position.
13+
compare-elements-position-false: (
14+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
15+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
16+
("x"),
17+
)
18+
// The `i` should be *after* the type.
19+
assert-position: (
20+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
21+
{"x": 692},
22+
)
23+
assert-position: (
24+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
25+
{"x": 966},
26+
)
27+
28+
29+
// Now only the `i` should be on the next line.
30+
size: (1055, 600)
31+
compare-elements-position-false: (
32+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
33+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
34+
("y", "x"),
35+
)
36+
37+
// Now both the `i` and the struct name should be on the next line.
38+
size: (980, 600)
39+
// Checking they have the same y position.
40+
compare-elements-position: (
41+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
42+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
43+
("y"),
44+
)
45+
// Checking they don't have the same x position.
46+
compare-elements-position-false: (
47+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
48+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
49+
("x"),
50+
)
51+
// The `i` should be *after* the type.
52+
assert-position: (
53+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
54+
{"x": 245},
55+
)
56+
assert-position: (
57+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
58+
{"x": 519},
59+
)
60+
61+
// Checking on mobile now.
62+
size: (650, 600)
63+
// Checking they have the same y position.
64+
compare-elements-position: (
65+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
66+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
67+
("y"),
68+
)
69+
// Checking they don't have the same x position.
70+
compare-elements-position-false: (
71+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
72+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
73+
("x"),
74+
)
75+
// The `i` should be *after* the type.
76+
assert-position: (
77+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
78+
{"x": 15},
79+
)
80+
assert-position: (
81+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
82+
{"x": 289},
83+
)
84+
85+
// Checking on very small mobile. The `i` should be on its own line.
86+
size: (410, 600)
87+
compare-elements-position-false: (
88+
"//*[@id='method.create_an_iterator_from_read']//a[text()='NotableStructWithLongName']",
89+
"//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
90+
("y", "x"),
91+
)

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,15 @@ pub mod doc_block_table {
325325
}
326326

327327
}
328+
329+
pub struct NotableStructWithLongName<R>(R);
330+
331+
impl<R: std::io::Read> NotableStructWithLongName<R> {
332+
pub fn create_an_iterator_from_read(r: R) -> NotableStructWithLongName<R> { Self(r) }
333+
}
334+
335+
impl<R: std::io::Read> std::iter::Iterator for NotableStructWithLongName<R> {
336+
type Item = ();
337+
338+
fn next(&mut self) -> Option<Self::Item> { () }
339+
}

0 commit comments

Comments
 (0)