Skip to content

Commit

Permalink
Add GUI overflow tests for constant and typedef
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Oct 18, 2021
1 parent 809330b commit 20c286e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/test/rustdoc-gui/src/lib2/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,20 @@ pub mod summary_table {
/// | content | content |
pub struct Foo;
}

pub mod too_long {
pub type ReallyLongTypeNameLongLongLong = Option<unsafe extern "C" fn(a: *const u8, b: *const u8) -> *const u8>;

pub const ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong: u32 = 0;

pub struct SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
pub a: u32,
}

impl SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName {
/// ```
/// let x = SuperIncrediblyLongLongLongLongLongLongLongGigaGigaGigaMegaLongLongLongStructName { a: 0 };
/// ```
pub fn foo(&self) {}
}
}
19 changes: 18 additions & 1 deletion src/test/rustdoc-gui/type-declation-overflow.goml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
// This test ensures that the items declaration content overflow is handled inside the <pre> directly.
goto: file://|DOC_PATH|/lib2/long_trait/trait.ALongNameBecauseItHelpsTestingTheCurrentProblem.html
// We set a fixed size so there is no chance of "random" resize.
size: (1100, 800)
// Logically, the <body> scroll width should be the width of the window.
assert-property: ("body", {"scrollWidth": "1100"})
// However, since there is overflow in the type declaration, its scroll width is bigger.
assert-property: (".item-decl pre", {"scrollWidth": "1324"})

// We now make the same check on type declaration...
goto: file://|DOC_PATH|/lib2/too_long/type.ReallyLongTypeNameLongLongLong.html
assert-property: ("body", {"scrollWidth": "1100"})
// We now check that the section width hasn't grown because of it.
assert-property: ("#main", {"scrollWidth": "840"})
// And now checking that it has scrollable content.
assert-property: (".item-decl pre", {"scrollWidth": "1103"})

// ... and constant.
// On a sidenote, it also checks that the (very) long title isn't changing the docblock width.
goto: file://|DOC_PATH|/lib2/too_long/constant.ReallyLongTypeNameLongLongLongConstBecauseWhyNotAConstRightGigaGigaSupraLong.html
assert-property: ("body", {"scrollWidth": "1100"})
// We now check that the section width hasn't grown because of it.
assert-property: ("#main", {"scrollWidth": "840"})
// And now checking that it has scrollable content.
assert-property: (".item-decl pre", {"scrollWidth": "950"})

0 comments on commit 20c286e

Please sign in to comment.