about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-18 00:03:08 +0200
committerGuillaume Gomez <guillaume.gomez@huawei.com>2021-07-18 00:03:30 +0200
commit3f1a120ba9c5077029ffb2d39d654dd3732314a7 (patch)
tree6a17a0b7e24584d268db3402196a34da14140f6f
parentb0f8776d11b746ab7dd7098fb225eff34a992d87 (diff)
downloadrust-3f1a120ba9c5077029ffb2d39d654dd3732314a7.tar.gz
rust-3f1a120ba9c5077029ffb2d39d654dd3732314a7.zip
Add GUI test for <table> overflow
-rw-r--r--src/test/rustdoc-gui/docblock-table-overflow.goml9
-rw-r--r--src/test/rustdoc-gui/src/lib2/lib.rs9
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/docblock-table-overflow.goml b/src/test/rustdoc-gui/docblock-table-overflow.goml
new file mode 100644
index 00000000000..9ab7cd0fa07
--- /dev/null
+++ b/src/test/rustdoc-gui/docblock-table-overflow.goml
@@ -0,0 +1,9 @@
+// This test ensures that the type declaration content overflow is handled inside the <pre> directly.
+goto: file://|DOC_PATH|/lib2/long_table/struct.Foo.html
+// We set a fixed size so there is no chance of "random" resize.
+size: (1100, 800)
+// Logically, the ".docblock" and the "<p>" should have the same scroll width.
+compare-elements-property: (".top-doc .docblock", ".top-doc .docblock > p", ["scrollWidth"])
+assert-property: (".top-doc .docblock", {"scrollWidth": "816"})
+// However, since there is overflow in the <table>, its scroll width is bigger.
+assert-property: (".top-doc .docblock table", {"scrollWidth": "1573"})
diff --git a/src/test/rustdoc-gui/src/lib2/lib.rs b/src/test/rustdoc-gui/src/lib2/lib.rs
index 0466909479b..f724a64e307 100644
--- a/src/test/rustdoc-gui/src/lib2/lib.rs
+++ b/src/test/rustdoc-gui/src/lib2/lib.rs
@@ -54,3 +54,12 @@ pub mod long_trait {
     pub trait ALongNameBecauseItHelpsTestingTheCurrentProblem: DerefMut<Target = u32>
         + From<u128> + Send + Sync + AsRef<str> + 'static {}
 }
+
+pub mod long_table {
+    /// | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two | This::is::a::kinda::very::long::header::number::one | This::is::a::kinda::very::long::header::number::two |
+    /// | ----------- | ----------- | ----------- | ----------- |
+    /// | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two | This::is::a::kinda::long::content::number::one | This::is::a::kinda::very::long::content::number::two |
+    ///
+    /// I wanna sqdkfnqds f dsqf qds f dsqf dsq f dsq f qds f qds f qds f dsqq f dsf sqdf dsq fds f dsq f dq f ds fq sd fqds f dsq f sqd fsq df sd fdsqfqsd fdsq f dsq f dsqfd s dfq
+    pub struct Foo;
+}