Skip to content

Commit 9903f41

Browse files
Add GUI test for item info position
1 parent 51e658f commit 9903f41

File tree

3 files changed

+35
-8
lines changed

3 files changed

+35
-8
lines changed

src/test/rustdoc-gui/item-info-width.goml

-8
This file was deleted.

src/test/rustdoc-gui/item-info.goml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// This test ensures a few things for item info elements.
2+
goto: file://|DOC_PATH|/lib2/struct.Foo.html
3+
// Ensuring that the item information don't take 100% of the width if unnecessary.
4+
// We set a fixed size so there is no chance of "random" resize.
5+
size: (1100, 800)
6+
// We check that ".item-info" is bigger than its content.
7+
assert-css: (".item-info", {"width": "790px"})
8+
assert-css: (".item-info .stab", {"width": "289px"})
9+
assert-position: (".item-info .stab", {"x": 295})
10+
11+
// Now we ensure that they're not rendered on the same line.
12+
goto: file://|DOC_PATH|/lib2/trait.Trait.html
13+
// We first ensure that there are two item info on the trait.
14+
assert-count: ("#main-content > .item-info .stab", 2)
15+
// They should not have the same `y` position!
16+
compare-elements-position-false: (
17+
"#main-content > .item-info .stab:nth-of-type(1)",
18+
"#main-content > .item-info .stab:nth-of-type(2)",
19+
("y"),
20+
)
21+
// But they should have the same `x` position.
22+
compare-elements-position: (
23+
"#main-content > .item-info .stab:nth-of-type(1)",
24+
"#main-content > .item-info .stab:nth-of-type(2)",
25+
("x"),
26+
)
27+
// They are supposed to have the same height too.
28+
compare-elements-css: (
29+
"#main-content > .item-info .stab:nth-of-type(1)",
30+
"#main-content > .item-info .stab:nth-of-type(2)",
31+
["height"],
32+
)

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

+3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ impl Foo {
3030
pub fn a_method(&self) {}
3131
}
3232

33+
#[doc(cfg(feature = "foo-method"))]
34+
#[deprecated = "Whatever [`Foo::a_method`](#method.a_method)"]
3335
pub trait Trait {
3436
type X;
3537
const Y: u32;
3638

39+
#[deprecated = "Whatever [`Foo`](#tadam)"]
3740
fn foo() {}
3841
}
3942

0 commit comments

Comments
 (0)