Skip to content

Commit 20c286e

Browse files
Add GUI overflow tests for constant and typedef
1 parent 809330b commit 20c286e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

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

+17
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,20 @@ pub mod summary_table {
8484
/// | content | content |
8585
pub struct Foo;
8686
}
87+
88+
pub mod too_long {
89+
pub type ReallyLongTypeNameLongLongLong = Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>;
90+
91+
pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0;
92+
93+
pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
94+
pub a: u32,
95+
}
96+
97+
impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
98+
/// ```
99+
/// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 };
100+
/// ```
101+
pub fn foo(&self) {}
102+
}
103+
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
1+
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
22
goto: file://|DOC_PATH|/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html
33
// We set a fixed size so there is no chance of "random" resize.
44
size: (1100, 800)
55
// Logically, the <body> scroll width should be the width of the window.
66
assert-property: ("body", {"scrollWidth": "1100"})
77
// However, since there is overflow in the type declaration, its scroll width is bigger.
88
assert-property: (".item-decl pre", {"scrollWidth": "1324"})
9+
10+
// We now make the same check on type declaration...
11+
goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html
12+
assert-property: ("body", {"scrollWidth": "1100"})
13+
// We now check that the section width hasn't grown because of it.
14+
assert-property: ("#main", {"scrollWidth": "840"})
15+
// And now checking that it has scrollable content.
16+
assert-property: (".item-decl pre", {"scrollWidth": "1103"})
17+
18+
// ... and constant.
19+
// On a sidenote, it also checks that the (very) long title isn't changing the docblock width.
20+
goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html
21+
assert-property: ("body", {"scrollWidth": "1100"})
22+
// We now check that the section width hasn't grown because of it.
23+
assert-property: ("#main", {"scrollWidth": "840"})
24+
// And now checking that it has scrollable content.
25+
assert-property: (".item-decl pre", {"scrollWidth": "950"})

0 commit comments

Comments
 (0)