Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 3baac2a

Browse files
Add GUI test to ensure that the width of the item-info does not overflow its parent
1 parent a404523 commit 3baac2a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// This test ensures that the "item-info" elements don't overflow.
2+
goto: file://|DOC_PATH|/lib2/struct.LongItemInfo.html
3+
// We set a fixed size so there is no chance of "random" resize.
4+
size: (1200, 870)
5+
// Logically, the "item-decl" and the "item-info" should have the same scroll width.
6+
compare-elements-property: (".docblock.item-decl", ".item-info", ["scrollWidth"])
7+
assert-property: (".item-info", {"scrollWidth": "890"})
8+
// Just to be sure we're comparing the correct "item-info":
9+
assert-text: (
10+
".item-info",
11+
"This is supported on Android or Linux or Emscripten or DragonFly BSD",
12+
STARTS_WITH,
13+
)
14+
15+
// Checking the "item-info" on an impl block as well:
16+
goto: file://|DOC_PATH|/lib2/struct.LongItemInfo2.html
17+
compare-elements-property: (
18+
"#impl-SimpleTrait .item-info",
19+
"#impl-SimpleTrait + .docblock",
20+
["scrollWidth"],
21+
)
22+
assert-property: ("#impl-SimpleTrait .item-info", {"scrollWidth": "866"})
23+
// Just to be sure we're comparing the correct "item-info":
24+
assert-text: (
25+
"#impl-SimpleTrait .item-info",
26+
"This is supported on Android or Linux or Emscripten or DragonFly BSD",
27+
STARTS_WITH,
28+
)

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,13 @@ pub struct HasALongTraitWithParams {}
120120
pub trait LongTraitWithParamsBananaBananaBanana<T> {}
121121

122122
impl LongTraitWithParamsBananaBananaBanana<usize> for HasALongTraitWithParams {}
123+
124+
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
125+
pub struct LongItemInfo;
126+
127+
pub trait SimpleTrait {}
128+
pub struct LongItemInfo2;
129+
130+
/// Some docs.
131+
#[doc(cfg(any(target_os = "android", target_os = "linux", target_os = "emscripten", target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd", target_os = "openbsd")))]
132+
impl SimpleTrait for LongItemInfo2 {}

0 commit comments

Comments
 (0)