summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/rustdoc-gui
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/font-weight.goml2
-rw-r--r--tests/rustdoc-gui/globals.goml24
-rw-r--r--tests/rustdoc-gui/headers-color.goml2
-rw-r--r--tests/rustdoc-gui/hide-mobile-topbar.goml20
-rw-r--r--tests/rustdoc-gui/item-decl-comment-highlighting.goml73
-rw-r--r--tests/rustdoc-gui/item-info.goml15
-rw-r--r--tests/rustdoc-gui/links-color.goml4
-rw-r--r--tests/rustdoc-gui/search-tab.goml2
-rw-r--r--tests/rustdoc-gui/sidebar-links-color.goml4
-rw-r--r--tests/rustdoc-gui/sidebar-resize-setting.goml23
-rw-r--r--tests/rustdoc-gui/sidebar-resize-window.goml37
-rw-r--r--tests/rustdoc-gui/sidebar-resize.goml28
-rw-r--r--tests/rustdoc-gui/sidebar-source-code.goml5
-rw-r--r--tests/rustdoc-gui/sidebar.goml4
-rw-r--r--tests/rustdoc-gui/src/lib2/Cargo.toml7
-rw-r--r--tests/rustdoc-gui/src/lib2/lib.rs9
-rw-r--r--tests/rustdoc-gui/src/proc_macro_test/Cargo.lock7
-rw-r--r--tests/rustdoc-gui/src/proc_macro_test/Cargo.toml8
-rw-r--r--tests/rustdoc-gui/src/proc_macro_test/lib.rs11
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs18
-rw-r--r--tests/rustdoc-gui/src/theme_css/custom-theme.css2
-rw-r--r--tests/rustdoc-gui/tooltip-over-sidebar.goml12
-rw-r--r--tests/rustdoc-gui/where-whitespace.goml8
23 files changed, 310 insertions, 15 deletions
diff --git a/tests/rustdoc-gui/font-weight.goml b/tests/rustdoc-gui/font-weight.goml
index 6fad128da..602b8d6f5 100644
--- a/tests/rustdoc-gui/font-weight.goml
+++ b/tests/rustdoc-gui/font-weight.goml
@@ -2,7 +2,7 @@
go-to: "file://" + |DOC_PATH| + "/lib2/struct.Foo.html"
assert-css: ("//*[@class='rust item-decl']//a[text()='Alias']", {"font-weight": "400"})
assert-css: (
- "//*[@class='structfield small-section-header']//a[text()='Alias']",
+ "//*[@class='structfield section-header']//a[text()='Alias']",
{"font-weight": "400"},
)
assert-css: ("#method\.a_method > .code-header", {"font-weight": "600"})
diff --git a/tests/rustdoc-gui/globals.goml b/tests/rustdoc-gui/globals.goml
new file mode 100644
index 000000000..53f96ff08
--- /dev/null
+++ b/tests/rustdoc-gui/globals.goml
@@ -0,0 +1,24 @@
+// Make sure search stores its data in `window`
+// It needs to use a global to avoid racing on search-index.js and search.js
+// https://github.com/rust-lang/rust/pull/118961
+
+// URL query
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html?search=sa'%3Bda'%3Bds"
+wait-for: "#search-tabs"
+assert-window-property-false: {"searchIndex": null}
+assert-window-property: {"srcIndex": null}
+
+// Form input
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+write: (".search-input", "Foo")
+press-key: 'Enter'
+wait-for: "#search-tabs"
+assert-window-property-false: {"searchIndex": null}
+assert-window-property: {"srcIndex": null}
+
+// source sidebar
+go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
+click: "#src-sidebar-toggle"
+wait-for: "#src-sidebar details"
+assert-window-property-false: {"srcIndex": null}
+assert-window-property: {"searchIndex": null}
diff --git a/tests/rustdoc-gui/headers-color.goml b/tests/rustdoc-gui/headers-color.goml
index a7ac94c49..19185818f 100644
--- a/tests/rustdoc-gui/headers-color.goml
+++ b/tests/rustdoc-gui/headers-color.goml
@@ -31,7 +31,7 @@ define-function: (
ALL,
)
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
- assert-css: (".small-section-header a", {"color": |color|}, ALL)
+ assert-css: (".section-header a", {"color": |color|}, ALL)
go-to: "file://" + |DOC_PATH| + "/test_docs/struct.HeavilyDocumentedStruct.html"
// We select headings (h2, h3, h...).
assert-css: (".docblock > :not(p) > a", {"color": |headings_color|}, ALL)
diff --git a/tests/rustdoc-gui/hide-mobile-topbar.goml b/tests/rustdoc-gui/hide-mobile-topbar.goml
new file mode 100644
index 000000000..46eb8acfe
--- /dev/null
+++ b/tests/rustdoc-gui/hide-mobile-topbar.goml
@@ -0,0 +1,20 @@
+// Checks sidebar resizing stays synced with the setting
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+set-window-size: (400, 600)
+
+// Verify that the "hide" option is unchecked
+click: "#settings-menu"
+wait-for: "#settings"
+assert-css: ("#settings", {"display": "block"})
+assert-property: ("#hide-sidebar", {"checked": "false"})
+assert-css: (".mobile-topbar", {"display": "flex"})
+
+// Toggle it
+click: "#hide-sidebar"
+assert-property: ("#hide-sidebar", {"checked": "true"})
+assert-css: (".mobile-topbar", {"display": "none"})
+
+// Toggle it again
+click: "#hide-sidebar"
+assert-property: ("#hide-sidebar", {"checked": "false"})
+assert-css: (".mobile-topbar", {"display": "flex"})
diff --git a/tests/rustdoc-gui/item-decl-comment-highlighting.goml b/tests/rustdoc-gui/item-decl-comment-highlighting.goml
new file mode 100644
index 000000000..60772693d
--- /dev/null
+++ b/tests/rustdoc-gui/item-decl-comment-highlighting.goml
@@ -0,0 +1,73 @@
+// This test checks that comments in item declarations are highlighted.
+go-to: "file://" + |DOC_PATH| + "/test_docs/private/enum.Enum.html"
+show-text: true
+
+define-function: (
+ "check-item-decl-comment",
+ (theme, url, comment_color),
+ block {
+ go-to: |url|
+ set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+ reload:
+ assert-css: (".item-decl .comment", {"color": |comment_color|}, ALL)
+ }
+)
+
+define-function: (
+ "check-items-for-theme",
+ (theme, comment_color),
+ block {
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/test_docs/private/enum.Enum.html",
+ "comment_color": |comment_color|,
+ })
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/test_docs/private/struct.Struct.html",
+ "comment_color": |comment_color|,
+ })
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/test_docs/private/struct.Tuple.html",
+ "comment_color": |comment_color|,
+ })
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/test_docs/private/union.Union.html",
+ "comment_color": |comment_color|,
+ })
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/proc_macro_test/macro.make_answer.html",
+ "comment_color": |comment_color|,
+ })
+ call-function: ("check-item-decl-comment", {
+ "theme": |theme|,
+ "url": "file://" + |DOC_PATH| + "/proc_macro_test/derive.HelperAttr.html",
+ "comment_color": |comment_color|,
+ })
+ }
+)
+
+call-function: (
+ "check-items-for-theme",
+ {
+ "theme": "ayu",
+ "comment_color": "#788797",
+ }
+)
+call-function: (
+ "check-items-for-theme",
+ {
+ "theme": "dark",
+ "comment_color": "#8d8d8b",
+ }
+)
+call-function: (
+ "check-items-for-theme",
+ {
+ "theme": "light",
+ "comment_color": "#8e908c",
+ }
+)
diff --git a/tests/rustdoc-gui/item-info.goml b/tests/rustdoc-gui/item-info.goml
index 030ff8f8a..b46d4255e 100644
--- a/tests/rustdoc-gui/item-info.goml
+++ b/tests/rustdoc-gui/item-info.goml
@@ -8,7 +8,22 @@ assert-size: (".item-info", {"width": 840})
assert-size: (".item-info .stab", {"width": 289})
assert-position: (".item-info .stab", {"x": 245})
+// We check that the display of the feature elements is not broken. It serves as regression
+// test for <https://github.com/rust-lang/rust/issues/118615>.
+set-window-size: (850, 800)
+store-position: (
+ "//*[@class='stab portability']//code[text()='Win32_System']",
+ {"x": first_line_x, "y": first_line_y},
+)
+store-position: (
+ "//*[@class='stab portability']//code[text()='Win32_System_Diagnostics']",
+ {"x": second_line_x, "y": second_line_y},
+)
+assert: |first_line_x| != |second_line_x| && |first_line_x| == 516 && |second_line_x| == 272
+assert: |first_line_y| != |second_line_y| && |first_line_y| == 688 && |second_line_y| == 711
+
// Now we ensure that they're not rendered on the same line.
+set-window-size: (1100, 800)
go-to: "file://" + |DOC_PATH| + "/lib2/trait.Trait.html"
// We first ensure that there are two item info on the trait.
assert-count: ("#main-content > .item-info .stab", 2)
diff --git a/tests/rustdoc-gui/links-color.goml b/tests/rustdoc-gui/links-color.goml
index 0789d785f..d88ebfb40 100644
--- a/tests/rustdoc-gui/links-color.goml
+++ b/tests/rustdoc-gui/links-color.goml
@@ -26,12 +26,12 @@ define-function: (
assert-css: (".item-table .keyword", {"color": |keyword|}, ALL)
// Checking sidebar elements.
assert-css: (
- ".sidebar-elems a:not(.current)",
+ ".sidebar-elems li:not(.current) a",
{"color": |sidebar|, "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"},
ALL,
)
assert-css: (
- ".sidebar-elems a.current",
+ ".sidebar-elems li.current a",
{
"color": |sidebar_current|,
"background-color": |sidebar_current_background|,
diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml
index db1605ff2..b52bb0688 100644
--- a/tests/rustdoc-gui/search-tab.goml
+++ b/tests/rustdoc-gui/search-tab.goml
@@ -80,7 +80,7 @@ set-window-size: (851, 600)
// Check the size and count in tabs
assert-text: ("#search-tabs > button:nth-child(1) > .count", " (25) ")
-assert-text: ("#search-tabs > button:nth-child(2) > .count", " (5)  ")
+assert-text: ("#search-tabs > button:nth-child(2) > .count", " (6)  ")
assert-text: ("#search-tabs > button:nth-child(3) > .count", " (0)  ")
store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
diff --git a/tests/rustdoc-gui/sidebar-links-color.goml b/tests/rustdoc-gui/sidebar-links-color.goml
index 079d582a5..774fbcac1 100644
--- a/tests/rustdoc-gui/sidebar-links-color.goml
+++ b/tests/rustdoc-gui/sidebar-links-color.goml
@@ -17,10 +17,10 @@ define-function: (
reload:
// Struct
assert-css: (
- ".sidebar .block.struct a:not(.current)",
+ ".sidebar .block.struct li:not(.current) a",
{"color": |struct|, "background-color": "rgba(0, 0, 0, 0)"},
)
- move-cursor-to: ".sidebar .block.struct a:not(.current)"
+ move-cursor-to: ".sidebar .block.struct li:not(.current) a"
assert-css: (
".sidebar .block.struct a:hover",
{"color": |struct_hover|, "background-color": |struct_hover_background|},
diff --git a/tests/rustdoc-gui/sidebar-resize-setting.goml b/tests/rustdoc-gui/sidebar-resize-setting.goml
new file mode 100644
index 000000000..2fdb2faa8
--- /dev/null
+++ b/tests/rustdoc-gui/sidebar-resize-setting.goml
@@ -0,0 +1,23 @@
+// Checks sidebar resizing stays synced with the setting
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+assert-property: (".sidebar", {"clientWidth": "200"})
+show-text: true
+
+// Verify that the "hide" option is unchecked
+click: "#settings-menu"
+wait-for: "#settings"
+assert-css: ("#settings", {"display": "block"})
+assert-property: ("#hide-sidebar", {"checked": "false"})
+press-key: "Escape"
+wait-for-css: ("#settings", {"display": "none"})
+
+drag-and-drop: ((205, 100), (5, 100))
+assert-css: (".sidebar", {"display": "none"})
+
+// Verify that the "hide" option is checked
+focus: "#settings-menu a"
+press-key: "Enter"
+wait-for-css: ("#settings", {"display": "block"})
+assert-property: ("#hide-sidebar", {"checked": "true"})
+click: "#hide-sidebar"
+wait-for-css: (".sidebar", {"display": "block"})
diff --git a/tests/rustdoc-gui/sidebar-resize-window.goml b/tests/rustdoc-gui/sidebar-resize-window.goml
new file mode 100644
index 000000000..fb6baafda
--- /dev/null
+++ b/tests/rustdoc-gui/sidebar-resize-window.goml
@@ -0,0 +1,37 @@
+// Checks sidebar resizing
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+set-window-size: (1280, 600)
+wait-for-property: (".sidebar", {"clientWidth": 200}, [NEAR])
+
+// resize past maximum (don't grow past 500)
+drag-and-drop: ((205, 100), (600, 100))
+wait-for-property: (".sidebar", {"clientWidth": 500}, [NEAR])
+
+// make the window small enough that the sidebar has to shrink
+set-window-size: (750, 600)
+wait-for-property: (".sidebar", {"clientWidth": 350}, [NEAR])
+
+// grow the window again to make the sidebar bigger
+set-window-size: (1280, 600)
+wait-for-property: (".sidebar", {"clientWidth": 500}, [NEAR])
+
+// make the window small enough that the sidebar has to shrink
+set-window-size: (750, 600)
+wait-for-property: (".sidebar", {"clientWidth": 350}, [NEAR])
+assert-local-storage: {"rustdoc-desktop-sidebar-width": "350"}
+set-window-size: (400, 600)
+wait-for-css: (".sidebar", {"display": "block", "left": "-1000px"})
+assert-local-storage: {"rustdoc-desktop-sidebar-width": "350"}
+
+// grow the window again to make the sidebar bigger
+set-window-size: (1280, 600)
+wait-for-property: (".sidebar", {"clientWidth": 500}, [NEAR])
+
+// shrink back down again, then reload the page
+// the "desired size" is a bit of remembered implicit state,
+// and rustdoc tries to minimize things like this
+set-window-size: (800, 600)
+wait-for-property: (".sidebar", {"clientWidth": 400}, [NEAR])
+reload:
+set-window-size: (1280, 600)
+wait-for-property: (".sidebar", {"clientWidth": 400}, [NEAR])
diff --git a/tests/rustdoc-gui/sidebar-resize.goml b/tests/rustdoc-gui/sidebar-resize.goml
new file mode 100644
index 000000000..543d5d390
--- /dev/null
+++ b/tests/rustdoc-gui/sidebar-resize.goml
@@ -0,0 +1,28 @@
+// Checks sidebar resizing
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+assert-property: (".sidebar", {"clientWidth": "200"})
+show-text: true
+// normal resizing
+drag-and-drop: ((205, 100), (185, 100))
+assert-property: (".sidebar", {"clientWidth": "182"})
+// resize past maximum (don't grow past 500)
+drag-and-drop: ((185, 100), (600, 100))
+assert-property: (".sidebar", {"clientWidth": "500"})
+// resize past minimum (hide sidebar)
+drag-and-drop: ((501, 100), (5, 100))
+assert-property: (".sidebar", {"clientWidth": "0"})
+assert-css: (".sidebar", {"display": "none"})
+assert-local-storage: {"rustdoc-hide-sidebar": "true"}
+set-local-storage: {"rustdoc-hide-sidebar": "false"}
+
+// Now same thing, but for source code
+go-to: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"
+assert-property: (".sidebar", {"clientWidth": "49"})
+drag-and-drop: ((52, 100), (185, 100))
+assert-property: (".sidebar", {"clientWidth": "181"})
+drag-and-drop: ((185, 100), (600, 100))
+assert-property: (".sidebar", {"clientWidth": "499"})
+drag-and-drop: ((500, 100), (5, 100))
+// instead of hiding the sidebar entirely, this
+// will switch to the toggle mode
+assert-property: (".sidebar", {"clientWidth": "49"})
diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml
index 92b9045b7..9fc1409e8 100644
--- a/tests/rustdoc-gui/sidebar-source-code.goml
+++ b/tests/rustdoc-gui/sidebar-source-code.goml
@@ -48,6 +48,7 @@ call-function: (
// Next, desktop mode layout.
set-window-size: (1100, 800)
+wait-for: "#src-sidebar-toggle"
// We check that the sidebar isn't expanded and has the expected width.
assert-css: ("nav.sidebar", {"width": "50px"})
// We now click on the button to expand the sidebar.
@@ -58,7 +59,7 @@ assert-css: (".src-sidebar-expanded nav.sidebar a", {"font-size": "14px"})
// We collapse the sidebar.
click: (10, 10)
// We ensure that the class has been removed.
-wait-for: "html:not(.expanded)"
+wait-for: "html:not(.src-sidebar-expanded)"
assert: "nav.sidebar"
// Checking that only the path to the current file is "open".
@@ -73,7 +74,7 @@ assert: "//*[@class='dir-entry' and @open]/*[text()='sub_mod']"
// Only "another_folder" should be "open" in "lib2".
assert: "//*[@class='dir-entry' and not(@open)]/*[text()='another_mod']"
// All other trees should be collapsed.
-assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 10)
+assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 11)
// We now switch to mobile mode.
set-window-size: (600, 600)
diff --git a/tests/rustdoc-gui/sidebar.goml b/tests/rustdoc-gui/sidebar.goml
index eff66d803..82b4f2e94 100644
--- a/tests/rustdoc-gui/sidebar.goml
+++ b/tests/rustdoc-gui/sidebar.goml
@@ -57,7 +57,7 @@ assert-count: (".sidebar h2", 1)
assert-text: ("#all-types", "All Items")
assert-css: ("#all-types", {"color": "#356da4"})
// We check that we have the crates list and that the "current" on is "test_docs".
-assert-text: (".sidebar-elems ul.crate > li > a.current", "test_docs")
+assert-text: (".sidebar-elems ul.crate > li.current > a", "test_docs")
// And we're also supposed to have the list of items in the current module.
assert-text: (".sidebar-elems section ul > li:nth-child(1)", "Re-exports")
assert-text: (".sidebar-elems section ul > li:nth-child(2)", "Modules")
@@ -98,7 +98,7 @@ assert-property: (".sidebar", {"clientWidth": "200"})
assert-text: (".sidebar > .sidebar-crate > h2 > a", "lib2")
assert-count: (".sidebar .location", 0)
// We check that we have the crates list and that the "current" on is now "lib2".
-assert-text: (".sidebar-elems ul.crate > li > a.current", "lib2")
+assert-text: (".sidebar-elems ul.crate > li.current > a", "lib2")
// We now go to the "foobar" function page.
assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
diff --git a/tests/rustdoc-gui/src/lib2/Cargo.toml b/tests/rustdoc-gui/src/lib2/Cargo.toml
index 8bca77ff8..6c4ca27d5 100644
--- a/tests/rustdoc-gui/src/lib2/Cargo.toml
+++ b/tests/rustdoc-gui/src/lib2/Cargo.toml
@@ -6,6 +6,13 @@ edition = "2018"
[lib]
path = "lib.rs"
+[features]
+Win32 = ["Win32_System"]
+Win32_System = ["Win32_System_Diagnostics"]
+Win32_System_Diagnostics = ["Win32_System_Diagnostics_Debug"]
+Win32_System_Diagnostics_Debug = []
+default = ["Win32"]
+
[dependencies]
implementors = { path = "./implementors" }
http = { path = "./http" }
diff --git a/tests/rustdoc-gui/src/lib2/lib.rs b/tests/rustdoc-gui/src/lib2/lib.rs
index a2a3c3187..b467b0440 100644
--- a/tests/rustdoc-gui/src/lib2/lib.rs
+++ b/tests/rustdoc-gui/src/lib2/lib.rs
@@ -1,6 +1,7 @@
// ignore-tidy-linelength
#![feature(doc_cfg)]
+#![feature(doc_auto_cfg)]
pub mod another_folder;
pub mod another_mod;
@@ -28,6 +29,14 @@ impl Foo {
/// Some documentation
/// # A Heading
pub fn a_method(&self) {}
+
+ #[cfg(all(
+ feature = "Win32",
+ feature = "Win32_System",
+ feature = "Win32_System_Diagnostics",
+ feature = "Win32_System_Diagnostics_Debug"
+ ))]
+ pub fn lot_of_features() {}
}
#[doc(cfg(feature = "foo-method"))]
diff --git a/tests/rustdoc-gui/src/proc_macro_test/Cargo.lock b/tests/rustdoc-gui/src/proc_macro_test/Cargo.lock
new file mode 100644
index 000000000..eae9d7536
--- /dev/null
+++ b/tests/rustdoc-gui/src/proc_macro_test/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "proc_macro_test"
+version = "0.1.0"
diff --git a/tests/rustdoc-gui/src/proc_macro_test/Cargo.toml b/tests/rustdoc-gui/src/proc_macro_test/Cargo.toml
new file mode 100644
index 000000000..768ced651
--- /dev/null
+++ b/tests/rustdoc-gui/src/proc_macro_test/Cargo.toml
@@ -0,0 +1,8 @@
+[package]
+name = "proc_macro_test"
+version = "0.1.0"
+edition = "2021"
+
+[lib]
+path = "lib.rs"
+proc-macro = true
diff --git a/tests/rustdoc-gui/src/proc_macro_test/lib.rs b/tests/rustdoc-gui/src/proc_macro_test/lib.rs
new file mode 100644
index 000000000..8a6c62df8
--- /dev/null
+++ b/tests/rustdoc-gui/src/proc_macro_test/lib.rs
@@ -0,0 +1,11 @@
+use proc_macro::TokenStream;
+
+#[proc_macro]
+pub fn make_answer(_item: TokenStream) -> TokenStream {
+ "fn answer() -> u32 { 42 }".parse().unwrap()
+}
+
+#[proc_macro_derive(HelperAttr, attributes(helper))]
+pub fn derive_helper_attr(_item: TokenStream) -> TokenStream {
+ TokenStream::new()
+}
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index c7d115bdb..0bc777230 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -593,3 +593,21 @@ pub mod foreign_impl_order {
fn f(&mut self, fg: [u8; 3]) {}
}
}
+
+pub mod private {
+ pub struct Tuple(u32, u8);
+ pub struct Struct {
+ a: u8,
+ }
+
+ pub union Union {
+ a: u8,
+ b: u16,
+ }
+
+ pub enum Enum {
+ A,
+ #[doc(hidden)]
+ B,
+ }
+}
diff --git a/tests/rustdoc-gui/src/theme_css/custom-theme.css b/tests/rustdoc-gui/src/theme_css/custom-theme.css
index 260ef87f6..49227d9ea 100644
--- a/tests/rustdoc-gui/src/theme_css/custom-theme.css
+++ b/tests/rustdoc-gui/src/theme_css/custom-theme.css
@@ -96,4 +96,6 @@
--scrape-example-help-hover-color: #000;
--scrape-example-code-wrapper-background-start: rgba(255, 255, 255, 1);
--scrape-example-code-wrapper-background-end: rgba(255, 255, 255, 0);
+ --sidebar-resizer-hover: hsl(207, 90%, 66%);
+ --sidebar-resizer-active: hsl(207, 90%, 54%);
}
diff --git a/tests/rustdoc-gui/tooltip-over-sidebar.goml b/tests/rustdoc-gui/tooltip-over-sidebar.goml
new file mode 100644
index 000000000..71bf69787
--- /dev/null
+++ b/tests/rustdoc-gui/tooltip-over-sidebar.goml
@@ -0,0 +1,12 @@
+// Check that the doctest info tooltips are above the sidebar.
+go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html"
+move-cursor-to: ".example-wrap.ignore .tooltip"
+wait-for: ".tooltip.popover"
+
+// Move cursor to top left corner of the tooltip and check that it doesn't fade.
+move-cursor-to: ".tooltip.popover"
+wait-for: 100
+assert: ".tooltip.popover:not(.fade-out)"
+
+move-cursor-to: (0, 0)
+wait-for: ".tooltip.popover.fade-out"
diff --git a/tests/rustdoc-gui/where-whitespace.goml b/tests/rustdoc-gui/where-whitespace.goml
index 69e6c3356..da104fa40 100644
--- a/tests/rustdoc-gui/where-whitespace.goml
+++ b/tests/rustdoc-gui/where-whitespace.goml
@@ -3,15 +3,15 @@ go-to: "file://" + |DOC_PATH| + "/lib2/trait.Whitespace.html"
show-text: true
// First, we check in the trait definition if the where clause is "on its own" (not on the same
// line than "pub trait Whitespace<Idx>").
-compare-elements-position-false: (".item-decl code", ".where.fmt-newline", ("y"))
+compare-elements-position-false: (".item-decl code", "div.where", ("y"))
// And that the code following it isn't on the same line either.
-compare-elements-position-false: (".item-decl .fn", ".where.fmt-newline", ("y"))
+compare-elements-position-false: (".item-decl .fn", "div.where", ("y"))
go-to: "file://" + |DOC_PATH| + "/lib2/struct.WhereWhitespace.html"
// We make the screen a bit wider to ensure that the trait impl is on one line.
set-window-size: (915, 915)
-compare-elements-position-false: ("#method\.new .fn", "#method\.new .where.fmt-newline", ("y"))
+compare-elements-position-false: ("#method\.new .fn", "#method\.new div.where", ("y"))
// We ensure that both the trait name and the struct name are on the same line in
// "impl<K, T> Whitespace<&K> for WhereWhitespace<T>".
compare-elements-position: (
@@ -22,6 +22,6 @@ compare-elements-position: (
// And we now check that the where condition isn't on the same line.
compare-elements-position-false: (
"#trait-implementations-list .impl h3 .trait",
- "#trait-implementations-list .impl h3 .where.fmt-newline",
+ "#trait-implementations-list .impl h3 div.where",
("y"),
)