]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc-gui/notable-trait.goml
rustdoc: fix GUI tests to deal with slightly changed width
[rust.git] / src / test / rustdoc-gui / notable-trait.goml
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": 677},
22 )
23 assert-position: (
24     "//*[@id='method.create_an_iterator_from_read']//*[@class='notable-traits']",
25     {"x": 951},
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: (365, 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 )