summaryrefslogtreecommitdiffstats
path: root/tests/rustdoc-gui
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 18:31:44 +0000
commitc23a457e72abe608715ac76f076f47dc42af07a5 (patch)
tree2772049aaf84b5c9d0ed12ec8d86812f7a7904b6 /tests/rustdoc-gui
parentReleasing progress-linux version 1.73.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-c23a457e72abe608715ac76f076f47dc42af07a5.tar.xz
rustc-c23a457e72abe608715ac76f076f47dc42af07a5.zip
Merging upstream version 1.74.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/rustdoc-gui')
-rw-r--r--tests/rustdoc-gui/code-color.goml18
-rw-r--r--tests/rustdoc-gui/default-settings.goml2
-rw-r--r--tests/rustdoc-gui/docblock-table.goml16
-rw-r--r--tests/rustdoc-gui/help-page.goml18
-rw-r--r--tests/rustdoc-gui/search-corrections.goml50
-rw-r--r--tests/rustdoc-gui/search-no-result.goml12
-rw-r--r--tests/rustdoc-gui/search-result-color.goml2
-rw-r--r--tests/rustdoc-gui/search-tab.goml86
-rw-r--r--tests/rustdoc-gui/sidebar-source-code.goml2
-rw-r--r--tests/rustdoc-gui/sidebar.goml22
-rw-r--r--tests/rustdoc-gui/src/test_docs/lib.rs12
-rw-r--r--tests/rustdoc-gui/src/theme_css/Cargo.lock7
-rw-r--r--tests/rustdoc-gui/src/theme_css/Cargo.toml7
-rw-r--r--tests/rustdoc-gui/src/theme_css/custom-theme.css99
-rw-r--r--tests/rustdoc-gui/src/theme_css/lib.rs2
-rw-r--r--tests/rustdoc-gui/theme-change.goml33
-rw-r--r--tests/rustdoc-gui/warning-block.goml42
17 files changed, 389 insertions, 41 deletions
diff --git a/tests/rustdoc-gui/code-color.goml b/tests/rustdoc-gui/code-color.goml
index 833fa05db..92bdfb25b 100644
--- a/tests/rustdoc-gui/code-color.goml
+++ b/tests/rustdoc-gui/code-color.goml
@@ -19,6 +19,18 @@ define-function: (
},
)
-call-function: ("check-colors", ("ayu", "rgb(230, 225, 207)", "rgb(255, 180, 84)"))
-call-function: ("check-colors", ("dark", "rgb(221, 221, 221)", "rgb(221, 221, 221)"))
-call-function: ("check-colors", ("light", "rgb(0, 0, 0)", "rgb(0, 0, 0)"))
+call-function: ("check-colors", {
+ "theme": "ayu",
+ "doc_code_color": "#e6e1cf",
+ "doc_inline_code_color": "#ffb454",
+})
+call-function: ("check-colors", {
+ "theme": "dark",
+ "doc_code_color": "#ddd",
+ "doc_inline_code_color": "#ddd",
+})
+call-function: ("check-colors", {
+ "theme": "light",
+ "doc_code_color": "black",
+ "doc_inline_code_color": "black",
+})
diff --git a/tests/rustdoc-gui/default-settings.goml b/tests/rustdoc-gui/default-settings.goml
index 3466f3693..ff4abb65c 100644
--- a/tests/rustdoc-gui/default-settings.goml
+++ b/tests/rustdoc-gui/default-settings.goml
@@ -5,4 +5,4 @@
go-to: "file://" + |DOC_PATH| + "/settings/index.html"
// Wait a bit to be sure the default theme is applied.
// If the theme isn't applied, the command will time out.
-wait-for-css: ("body", {"background-color": "rgb(15, 20, 25)"})
+wait-for-css: ("body", {"background-color": "#0f1419"})
diff --git a/tests/rustdoc-gui/docblock-table.goml b/tests/rustdoc-gui/docblock-table.goml
index 011451ef4..678b302f2 100644
--- a/tests/rustdoc-gui/docblock-table.goml
+++ b/tests/rustdoc-gui/docblock-table.goml
@@ -36,17 +36,17 @@ define-function: (
)
call-function: ("check-colors", {
- "theme": "dark",
- "border_color": "rgb(224, 224, 224)",
- "zebra_stripe_color": "rgb(42, 42, 42)",
+ "theme": "ayu",
+ "border_color": "#5c6773",
+ "zebra_stripe_color": "#191f26",
})
call-function: ("check-colors", {
- "theme": "ayu",
- "border_color": "rgb(92, 103, 115)",
- "zebra_stripe_color": "rgb(25, 31, 38)",
+ "theme": "dark",
+ "border_color": "#e0e0e0",
+ "zebra_stripe_color": "#2a2a2a",
})
call-function: ("check-colors", {
"theme": "light",
- "border_color": "rgb(224, 224, 224)",
- "zebra_stripe_color": "rgb(245, 245, 245)",
+ "border_color": "#e0e0e0",
+ "zebra_stripe_color": "#f5f5f5",
})
diff --git a/tests/rustdoc-gui/help-page.goml b/tests/rustdoc-gui/help-page.goml
index 6e880302f..84c203555 100644
--- a/tests/rustdoc-gui/help-page.goml
+++ b/tests/rustdoc-gui/help-page.goml
@@ -33,21 +33,21 @@ define-function: (
call-function: ("check-colors", {
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background": "rgb(49, 69, 89)",
- "box_shadow": "rgb(92, 103, 115)",
+ "color": "#c5c5c5",
+ "background": "#314559",
+ "box_shadow": "#5c6773",
})
call-function: ("check-colors", {
"theme": "dark",
- "color": "rgb(0, 0, 0)",
- "background": "rgb(250, 251, 252)",
- "box_shadow": "rgb(198, 203, 209)",
+ "color": "#000",
+ "background": "#fafbfc",
+ "box_shadow": "#c6cbd1",
})
call-function: ("check-colors", {
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background": "rgb(250, 251, 252)",
- "box_shadow": "rgb(198, 203, 209)",
+ "color": "#000",
+ "background": "#fafbfc",
+ "box_shadow": "#c6cbd1",
})
// This test ensures that opening the help popover without switching pages works.
diff --git a/tests/rustdoc-gui/search-corrections.goml b/tests/rustdoc-gui/search-corrections.goml
index 5d1b83b35..aeb3c9b31 100644
--- a/tests/rustdoc-gui/search-corrections.goml
+++ b/tests/rustdoc-gui/search-corrections.goml
@@ -54,3 +54,53 @@ assert-text: (
".search-corrections",
"Type \"notablestructwithlongnamr\" not found. Showing results for closest type name \"notablestructwithlongname\" instead."
)
+
+// Now, generic correction
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "NotableStructWithLongNamr, NotableStructWithLongNamr")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
+)
+
+// Now, generic correction plus error
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "Foo<NotableStructWithLongNamr>,y")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".search-corrections", {
+ "display": "block"
+})
+assert-text: (
+ ".search-corrections",
+ "Type \"notablestructwithlongnamr\" not found and used as generic parameter. Consider searching for \"notablestructwithlongname\" instead."
+)
+
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// Intentionally wrong spelling of "NotableStructWithLongName"
+write: (".search-input", "generic:NotableStructWithLongNamr<x>,y")
+// To be SURE that the search will be run.
+press-key: 'Enter'
+// Waiting for the search results to appear...
+wait-for: "#search-tabs"
+
+assert-css: (".error", {
+ "display": "block"
+})
+assert-text: (
+ ".error",
+ "Query parser error: \"Generic type parameter notablestructwithlongnamr does not accept generic parameters\"."
+)
diff --git a/tests/rustdoc-gui/search-no-result.goml b/tests/rustdoc-gui/search-no-result.goml
index 46d1856b4..e7c647912 100644
--- a/tests/rustdoc-gui/search-no-result.goml
+++ b/tests/rustdoc-gui/search-no-result.goml
@@ -21,16 +21,16 @@ define-function: (
call-function: ("check-no-result", {
"theme": "ayu",
- "link": "rgb(57, 175, 215)",
- "link_hover": "rgb(57, 175, 215)",
+ "link": "#39afd7",
+ "link_hover": "#39afd7",
})
call-function: ("check-no-result", {
"theme": "dark",
- "link": "rgb(210, 153, 29)",
- "link_hover": "rgb(210, 153, 29)",
+ "link": "#d2991d",
+ "link_hover": "#d2991d",
})
call-function: ("check-no-result", {
"theme": "light",
- "link": "rgb(56, 115, 173)",
- "link_hover": "rgb(56, 115, 173)",
+ "link": "#3873ad",
+ "link_hover": "#3873ad",
})
diff --git a/tests/rustdoc-gui/search-result-color.goml b/tests/rustdoc-gui/search-result-color.goml
index f9f81c5ba..44677dfbf 100644
--- a/tests/rustdoc-gui/search-result-color.goml
+++ b/tests/rustdoc-gui/search-result-color.goml
@@ -151,7 +151,7 @@ assert-css: (
)
assert-css: (
"//*[@class='result-name']//*[text()='test_docs::']/ancestor::a",
- {"color": "#fff", "background-color": "rgb(60, 60, 60)"},
+ {"color": "#fff", "background-color": "#3c3c3c"},
)
// Dark theme
diff --git a/tests/rustdoc-gui/search-tab.goml b/tests/rustdoc-gui/search-tab.goml
index 7bbde3ec2..427201e1b 100644
--- a/tests/rustdoc-gui/search-tab.goml
+++ b/tests/rustdoc-gui/search-tab.goml
@@ -1,5 +1,5 @@
// Checking the colors of the search tab headers.
-go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=something"
+go-to: "file://" + |DOC_PATH| + "/test_docs/fn.foo.html?search=foo"
show-text: true
define-function: (
@@ -74,3 +74,87 @@ call-function: ("check-colors", {
"border_top_selected": "2px solid #0089ff",
"border_top_hover": "2px solid #0089ff",
})
+
+// set size wide enough that the text is in a single row
+set-window-size: (851, 600)
+
+// Check the size and count in tabs
+assert-text: ("#search-tabs > button:nth-child(1) > .count", " (23) ")
+assert-text: ("#search-tabs > button:nth-child(2) > .count", " (4)  ")
+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|})
+assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
+store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
+assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
+assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
+
+// Check that counts are in a row with each other
+compare-elements-position: (
+ "#search-tabs > button:nth-child(1) > .count",
+ "#search-tabs > button:nth-child(2) > .count",
+ ("y")
+)
+compare-elements-position: (
+ "#search-tabs > button:nth-child(2) > .count",
+ "#search-tabs > button:nth-child(3) > .count",
+ ("y")
+)
+// Check that counts are beside the titles and haven't wrapped
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(1)",
+ "#search-tabs > button:nth-child(1) > .count",
+ {"y": 8}
+)
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+compare-elements-position-near: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+
+// Set size narrow enough that they wrap.
+// When I tested it, it wrapped at 811px, but I added some fudge factor to ensure it
+// doesn't prematurely wrap with slightly different font kerning or whatever, with a
+// @media query
+set-window-size: (850, 600)
+
+// all counts and buttons still have same size
+store-property: ("#search-tabs > button:nth-child(1)", {"offsetWidth": buttonWidth})
+assert-property: ("#search-tabs > button:nth-child(2)", {"offsetWidth": |buttonWidth|})
+assert-property: ("#search-tabs > button:nth-child(3)", {"offsetWidth": |buttonWidth|})
+store-property: ("#search-tabs > button:nth-child(1) > .count", {"offsetWidth": countWidth})
+assert-property: ("#search-tabs > button:nth-child(2) > .count", {"offsetWidth": |countWidth|})
+assert-property: ("#search-tabs > button:nth-child(3) > .count", {"offsetWidth": |countWidth|})
+
+// Check that counts are still in a row with each other
+compare-elements-position: (
+ "#search-tabs > button:nth-child(1) > .count",
+ "#search-tabs > button:nth-child(2) > .count",
+ ("y")
+)
+compare-elements-position: (
+ "#search-tabs > button:nth-child(2) > .count",
+ "#search-tabs > button:nth-child(3) > .count",
+ ("y")
+)
+// Check that counts are NOT beside the titles; now they have wrapped
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(1)",
+ "#search-tabs > button:nth-child(1) > .count",
+ {"y": 8}
+)
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
+compare-elements-position-near-false: (
+ "#search-tabs > button:nth-child(2)",
+ "#search-tabs > button:nth-child(2) > .count",
+ {"y": 8}
+)
diff --git a/tests/rustdoc-gui/sidebar-source-code.goml b/tests/rustdoc-gui/sidebar-source-code.goml
index 69c589741..92b9045b7 100644
--- a/tests/rustdoc-gui/sidebar-source-code.goml
+++ b/tests/rustdoc-gui/sidebar-source-code.goml
@@ -73,7 +73,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)]", 9)
+assert-count: ("//*[@id='src-sidebar']/details[not(text()='lib2') and not(@open)]", 10)
// 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 574cc629a..520481d3b 100644
--- a/tests/rustdoc-gui/sidebar.goml
+++ b/tests/rustdoc-gui/sidebar.goml
@@ -25,24 +25,24 @@ call-function: (
"check-colors",
{
"theme": "ayu",
- "color": "rgb(197, 197, 197)",
- "background_color": "rgb(20, 25, 31)",
+ "color": "#c5c5c5",
+ "background_color": "#14191f",
}
)
call-function: (
"check-colors",
{
"theme": "dark",
- "color": "rgb(221, 221, 221)",
- "background_color": "rgb(80, 80, 80)",
+ "color": "#ddd",
+ "background_color": "#505050",
}
)
call-function: (
"check-colors",
{
"theme": "light",
- "color": "rgb(0, 0, 0)",
- "background_color": "rgb(245, 245, 245)",
+ "color": "black",
+ "background_color": "#f5f5f5",
}
)
@@ -55,7 +55,7 @@ assert-text: (".sidebar > .location", "Crate test_docs")
assert-count: (".sidebar .location", 1)
assert-count: (".sidebar h2", 1)
assert-text: ("#all-types", "All Items")
-assert-css: ("#all-types", {"color": "rgb(53, 109, 164)"})
+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")
// And we're also supposed to have the list of items in the current module.
@@ -67,7 +67,7 @@ assert-text: (".sidebar-elems section ul > li:nth-child(5)", "Enums")
assert-text: (".sidebar-elems section ul > li:nth-child(6)", "Constants")
assert-text: (".sidebar-elems section ul > li:nth-child(7)", "Traits")
assert-text: (".sidebar-elems section ul > li:nth-child(8)", "Functions")
-assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Definitions")
+assert-text: (".sidebar-elems section ul > li:nth-child(9)", "Type Aliases")
assert-text: (".sidebar-elems section ul > li:nth-child(10)", "Unions")
assert-text: (".sidebar-elems section ul > li:nth-child(11)", "Keywords")
assert-text: ("#structs + .item-table .item-name > a", "Foo")
@@ -88,7 +88,7 @@ assert-property: ("html", {"scrollTop": "0"})
// We now go back to the crate page to click on the "lib2" crate link.
go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
assert-property: (".sidebar", {"clientWidth": "200"})
-assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "rgb(53, 109, 164)"})
+assert-css: (".sidebar-elems ul.crate > li:first-child > a", {"color": "#356da4"})
click: ".sidebar-elems ul.crate > li:first-child > a"
// PAGE: lib2/index.html
@@ -102,7 +102,7 @@ assert-text: (".sidebar-elems > section ul.block > li:nth-child(1)", "Modules")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(2)", "Structs")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(3)", "Traits")
assert-text: (".sidebar-elems > section ul.block > li:nth-child(4)", "Functions")
-assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Definitions")
+assert-text: (".sidebar-elems > section ul.block > li:nth-child(5)", "Type Aliases")
assert-text: ("#functions + .item-table .item-name > a", "foobar")
click: "#functions + .item-table .item-name > a"
@@ -140,7 +140,7 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
assert-property: (".sidebar", {"clientWidth": "200"})
click: "//ul[@class='block mod']/preceding-sibling::h3/a"
// PAGE: index.html
-assert-css: ("#modules", {"background-color": "rgb(253, 255, 211)"})
+assert-css: ("#modules", {"background-color": "#fdffd3"})
// Finally, assert that the `[+]/[−]` toggle doesn't affect sidebar width.
click: "#toggle-all-docs"
diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 49484ee08..38180aef7 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -65,6 +65,18 @@ impl Foo {
pub fn must_use(&self) -> bool {
true
}
+
+ /// hello
+ ///
+ /// <div id="doc-warning-1" class="warning">this is a warning</div>
+ ///
+ /// done
+ pub fn warning1() {}
+
+ /// Checking there is no bottom margin if "warning" is the last element.
+ ///
+ /// <div id="doc-warning-2" class="warning">this is a warning</div>
+ pub fn warning2() {}
}
impl AsRef<str> for Foo {
diff --git a/tests/rustdoc-gui/src/theme_css/Cargo.lock b/tests/rustdoc-gui/src/theme_css/Cargo.lock
new file mode 100644
index 000000000..7ad6737a4
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/Cargo.lock
@@ -0,0 +1,7 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+version = 3
+
+[[package]]
+name = "theme_css"
+version = "0.1.0"
diff --git a/tests/rustdoc-gui/src/theme_css/Cargo.toml b/tests/rustdoc-gui/src/theme_css/Cargo.toml
new file mode 100644
index 000000000..798e64f93
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/Cargo.toml
@@ -0,0 +1,7 @@
+[package]
+name = "theme_css"
+version = "0.1.0"
+edition = "2018"
+
+[lib]
+path = "lib.rs"
diff --git a/tests/rustdoc-gui/src/theme_css/custom-theme.css b/tests/rustdoc-gui/src/theme_css/custom-theme.css
new file mode 100644
index 000000000..260ef87f6
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/custom-theme.css
@@ -0,0 +1,99 @@
+:root {
+ --main-background-color: red;
+ --main-color: black;
+ --settings-input-color: #2196f3;
+ --settings-input-border-color: #717171;
+ --settings-button-color: #000;
+ --settings-button-border-focus: #717171;
+ --sidebar-background-color: #f5f5f5;
+ --sidebar-background-color-hover: #e0e0e0;
+ --code-block-background-color: #f5f5f5;
+ --scrollbar-track-background-color: #dcdcdc;
+ --scrollbar-thumb-background-color: rgba(36, 37, 39, 0.6);
+ --scrollbar-color: rgba(36, 37, 39, 0.6) #d9d9d9;
+ --headings-border-bottom-color: #ddd;
+ --border-color: #e0e0e0;
+ --button-background-color: #fff;
+ --right-side-color: grey;
+ --code-attribute-color: #999;
+ --toggles-color: #999;
+ --toggle-filter: none;
+ --search-input-focused-border-color: #66afe9;
+ --copy-path-button-color: #999;
+ --copy-path-img-filter: invert(50%);
+ --copy-path-img-hover-filter: invert(35%);
+ --codeblock-error-hover-color: rgb(255, 0, 0);
+ --codeblock-error-color: rgba(255, 0, 0, .5);
+ --codeblock-ignore-hover-color: rgb(255, 142, 0);
+ --codeblock-ignore-color: rgba(255, 142, 0, .6);
+ --warning-border-color: #ff8e00;
+ --type-link-color: #ad378a;
+ --trait-link-color: #6e4fc9;
+ --assoc-item-link-color: #3873ad;
+ --function-link-color: #ad7c37;
+ --macro-link-color: #068000;
+ --keyword-link-color: #3873ad;
+ --mod-link-color: #3873ad;
+ --link-color: #3873ad;
+ --sidebar-link-color: #356da4;
+ --sidebar-current-link-background-color: #fff;
+ --search-result-link-focus-background-color: #ccc;
+ --search-result-border-color: #aaa3;
+ --search-color: #000;
+ --search-error-code-background-color: #d0cccc;
+ --search-results-alias-color: #000;
+ --search-results-grey-color: #999;
+ --search-tab-title-count-color: #888;
+ --search-tab-button-not-selected-border-top-color: #e6e6e6;
+ --search-tab-button-not-selected-background: #e6e6e6;
+ --search-tab-button-selected-border-top-color: #0089ff;
+ --search-tab-button-selected-background: #fff;
+ --stab-background-color: #fff5d6;
+ --stab-code-color: #000;
+ --code-highlight-kw-color: #8959a8;
+ --code-highlight-kw-2-color: #4271ae;
+ --code-highlight-lifetime-color: #b76514;
+ --code-highlight-prelude-color: #4271ae;
+ --code-highlight-prelude-val-color: #c82829;
+ --code-highlight-number-color: #718c00;
+ --code-highlight-string-color: #718c00;
+ --code-highlight-literal-color: #c82829;
+ --code-highlight-attribute-color: #c82829;
+ --code-highlight-self-color: #c82829;
+ --code-highlight-macro-color: #3e999f;
+ --code-highlight-question-mark-color: #ff9011;
+ --code-highlight-comment-color: #8e908c;
+ --code-highlight-doc-comment-color: #4d4d4c;
+ --src-line-numbers-span-color: #c67e2d;
+ --src-line-number-highlighted-background-color: #fdffd3;
+ --test-arrow-color: #f5f5f5;
+ --test-arrow-background-color: rgba(78, 139, 202, 0.2);
+ --test-arrow-hover-color: #f5f5f5;
+ --test-arrow-hover-background-color: rgb(78, 139, 202);
+ --target-background-color: #fdffd3;
+ --target-border-color: #ad7c37;
+ --kbd-color: #000;
+ --kbd-background: #fafbfc;
+ --kbd-box-shadow-color: #c6cbd1;
+ --rust-logo-filter: initial;
+ /* match border-color; uses https://codepen.io/sosuke/pen/Pjoqqp */
+ --crate-search-div-filter: invert(100%) sepia(0%) saturate(4223%) hue-rotate(289deg)
+ brightness(114%) contrast(76%);
+ --crate-search-div-hover-filter: invert(44%) sepia(18%) saturate(23%) hue-rotate(317deg)
+ brightness(96%) contrast(93%);
+ --crate-search-hover-border: #717171;
+ --src-sidebar-background-selected: #fff;
+ --src-sidebar-background-hover: #e0e0e0;
+ --table-alt-row-background-color: #f5f5f5;
+ --codeblock-link-background: #eee;
+ --scrape-example-toggle-line-background: #ccc;
+ --scrape-example-toggle-line-hover-background: #999;
+ --scrape-example-code-line-highlight: #fcffd6;
+ --scrape-example-code-line-highlight-focus: #f6fdb0;
+ --scrape-example-help-border-color: #555;
+ --scrape-example-help-color: #333;
+ --scrape-example-help-hover-border-color: #000;
+ --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);
+}
diff --git a/tests/rustdoc-gui/src/theme_css/lib.rs b/tests/rustdoc-gui/src/theme_css/lib.rs
new file mode 100644
index 000000000..e9f3265fa
--- /dev/null
+++ b/tests/rustdoc-gui/src/theme_css/lib.rs
@@ -0,0 +1,2 @@
+// compile-flags: --theme custom-theme.css
+//! <div class="custom-text">custom text</div>
diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml
index e4b031b73..fdaf9d628 100644
--- a/tests/rustdoc-gui/theme-change.goml
+++ b/tests/rustdoc-gui/theme-change.goml
@@ -65,3 +65,36 @@ assert-local-storage: { "rustdoc-theme": "light" }
reload:
wait-for: "#settings"
assert: "#preferred-light-theme.setting-line.hidden"
+
+// Ensures that the custom theme feature is working as expected.
+go-to: "file://" + |DOC_PATH| + "/theme_css/index.html"
+set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
+reload:
+
+store-value: (background_light, "white")
+store-value: (background_dark, "#353535")
+store-value: (background_ayu, "#0f1419")
+store-value: (background_custom_theme, "red")
+
+click: "#settings-menu"
+wait-for: "#theme-ayu"
+click: "#theme-ayu"
+// should be the ayu theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_ayu| })
+assert-local-storage: { "rustdoc-theme": "ayu" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-light"
+// should be the light theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_light| })
+assert-local-storage: { "rustdoc-theme": "light" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-dark"
+// Should be the dark theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_dark| })
+assert-local-storage: { "rustdoc-theme": "dark" }
+assert-text: (".custom-text", "custom text")
+click: "#theme-custom-theme"
+// Should be the custom theme so let's check the color.
+wait-for-css: ("body", { "background-color": |background_custom_theme| })
+assert-local-storage: { "rustdoc-theme": "custom-theme" }
+assert-text: (".custom-text", "custom text")
diff --git a/tests/rustdoc-gui/warning-block.goml b/tests/rustdoc-gui/warning-block.goml
new file mode 100644
index 000000000..8832b65c4
--- /dev/null
+++ b/tests/rustdoc-gui/warning-block.goml
@@ -0,0 +1,42 @@
+// Test to check that the "warning blocks" are displayed as expected.
+go-to: "file://" + |DOC_PATH| + "/test_docs/struct.Foo.html"
+show-text: true
+
+define-function: (
+ "check-warning",
+ (theme, color, border_color),
+ block {
+ set-local-storage: {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}
+ reload:
+
+ // The IDs are added directly into the DOM to make writing this test easier.
+ assert-css: ("#doc-warning-1", {
+ "margin-bottom": "12px",
+ "color": |color|,
+ "border-left": "2px solid " + |border_color|,
+ "background-color": "transparent",
+ })
+ assert-css: ("#doc-warning-2", {
+ "margin-bottom": "0px",
+ "color": |color|,
+ "border-left": "2px solid " + |border_color|,
+ "background-color": "transparent",
+ })
+ },
+)
+
+call-function: ("check-warning", {
+ "theme": "ayu",
+ "color": "#c5c5c5",
+ "border_color": "#ff8e00",
+})
+call-function: ("check-warning", {
+ "theme": "dark",
+ "color": "#ddd",
+ "border_color": "#ff8e00",
+})
+call-function: ("check-warning", {
+ "theme": "light",
+ "color": "black",
+ "border_color": "#ff8e00",
+})