about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2022-10-08 09:36:37 -0700
committerMichael Howell <michael@notriddle.com>2022-10-08 10:50:44 -0700
commitbf510b4deddf99d9321d86754c18d2a143233b11 (patch)
treefa21a02d9ff767e9c22fcffbd361008fc7778ccc
parent569384b99a1127e57c7c52c4ee7c5cdb2d5e8b8c (diff)
downloadrust-bf510b4deddf99d9321d86754c18d2a143233b11.tar.gz
rust-bf510b4deddf99d9321d86754c18d2a143233b11.zip
rustdoc: add test case for dimensions and color of unsafe `<sup>`
-rw-r--r--src/test/rustdoc-gui/src/test_docs/lib.rs4
-rw-r--r--src/test/rustdoc-gui/unsafe-fn.goml37
2 files changed, 41 insertions, 0 deletions
diff --git a/src/test/rustdoc-gui/src/test_docs/lib.rs b/src/test/rustdoc-gui/src/test_docs/lib.rs
index 0281973c1ba..33c74e3a331 100644
--- a/src/test/rustdoc-gui/src/test_docs/lib.rs
+++ b/src/test/rustdoc-gui/src/test_docs/lib.rs
@@ -367,3 +367,7 @@ impl TypeWithNoDocblocks {
     pub fn first_fn(&self) {}
     pub fn second_fn(&self) {}
 }
+
+pub unsafe fn unsafe_fn() {}
+
+pub fn safe_fn() {}
diff --git a/src/test/rustdoc-gui/unsafe-fn.goml b/src/test/rustdoc-gui/unsafe-fn.goml
new file mode 100644
index 00000000000..94f128db72e
--- /dev/null
+++ b/src/test/rustdoc-gui/unsafe-fn.goml
@@ -0,0 +1,37 @@
+goto: "file://" + |DOC_PATH| + "/test_docs/index.html"
+
+compare-elements-property: (
+	"//a[@title='test_docs::safe_fn fn']/..",
+	"//a[@title='test_docs::unsafe_fn fn']/..",
+	["clientHeight"]
+)
+
+// If the text isn't displayed, the browser doesn't compute color style correctly...
+show-text: true
+
+// Set the theme to dark.
+local-storage: {"rustdoc-theme": "dark", "rustdoc-preferred-dark-theme": "dark", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".item-left sup", {
+	"color": "rgb(221, 221, 221)"
+})
+
+// Set the theme to ayu.
+local-storage: {"rustdoc-theme": "ayu", "rustdoc-preferred-dark-theme": "ayu", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".item-left sup", {
+	"color": "rgb(197, 197, 197)"
+})
+
+// Set the theme to light.
+local-storage: {"rustdoc-theme": "light", "rustdoc-preferred-dark-theme": "light", "rustdoc-use-system-theme": "false"}
+// We reload the page so the local storage settings are being used.
+reload:
+
+assert-css: (".item-left sup", {
+	"color": "rgb(0, 0, 0)"
+})