]> git.lizzy.rs Git - rust.git/commitdiff
Add test to ensure font-weight is applied correctly
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 13 Jun 2021 19:50:11 +0000 (21:50 +0200)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 13 Jun 2021 19:50:11 +0000 (21:50 +0200)
src/test/rustdoc-gui/font-weight.goml [new file with mode: 0644]
src/test/rustdoc-gui/sidebar.goml
src/test/rustdoc-gui/src/lib2.rs

diff --git a/src/test/rustdoc-gui/font-weight.goml b/src/test/rustdoc-gui/font-weight.goml
new file mode 100644 (file)
index 0000000..d8ad6c2
--- /dev/null
@@ -0,0 +1,7 @@
+goto: file://|DOC_PATH|/lib2/struct.Foo.html
+// This test checks that the font weight is correctly applied.
+assert: ("//*[@class='docblock type-decl']//a[text()='Alias']", {"font-weight": "400"})
+assert: ("//*[@class='structfield small-section-header']//a[text()='Alias']", {"font-weight": "400"})
+assert: ("#method\.a_method > code", {"font-weight": "600"})
+assert: ("#associatedtype\.X > code", {"font-weight": "600"})
+assert: ("#associatedconstant\.Y > code", {"font-weight": "600"})
index 7703677154ef9c6b7d5ab92b64d04cdd41c76aaa..e0e6d19cace36608c0100298ae5c2a98986bfca7 100644 (file)
@@ -31,7 +31,10 @@ assert: (".sidebar > .location", "Crate lib2")
 assert: (".sidebar-elems > .crate > ul > li > a.current", "lib2")
 // We now go to the "foobar" function page.
 assert: (".sidebar-elems > .items > ul > li:nth-child(1)", "Modules")
-assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Functions")
+assert: (".sidebar-elems > .items > ul > li:nth-child(2)", "Structs")
+assert: (".sidebar-elems > .items > ul > li:nth-child(3)", "Traits")
+assert: (".sidebar-elems > .items > ul > li:nth-child(4)", "Functions")
+assert: (".sidebar-elems > .items > ul > li:nth-child(5)", "Type Definitions")
 assert:        ("#functions + table td > a", "foobar")
 click: "#functions + table td > a"
 
index 73384cbf90633b5ffce492ed9e7bd48c3340f9b3..6fa1b36b29bb949af799ae49913c9483f4833e9a 100644 (file)
@@ -9,3 +9,23 @@ pub fn whatever() {}
 }
 
 pub fn foobar() {}
+
+pub type Alias = u32;
+
+pub struct Foo {
+    pub x: Alias,
+}
+
+impl Foo {
+    pub fn a_method(&self) {}
+}
+
+pub trait Trait {
+    type X;
+    const Y: u32;
+}
+
+impl Trait for Foo {
+    type X = u32;
+    const Y: u32 = 0;
+}