diff --git a/src/test/rustdoc-gui/rust-logo.goml b/src/test/rustdoc-gui/rust-logo.goml index 80abdc50c14..6c8dc859419 100644 --- a/src/test/rustdoc-gui/rust-logo.goml +++ b/src/test/rustdoc-gui/rust-logo.goml @@ -1,78 +1,34 @@ // This test ensures that the correct style is applied to the rust logo in the sidebar. goto: "file://" + |DOC_PATH| + "/test_docs/index.html" -// First we start with the dark theme. -local-storage: { - "rustdoc-theme": "dark", - "rustdoc-preferred-dark-theme": "dark", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +define-function: ( + "check-logo", + (theme, filter), + [ + // Going to the doc page. + ("goto", "file://" + |DOC_PATH| + "/test_docs/index.html"), + // Changing theme. + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("assert-css", (".rust-logo", {"filter": |filter|})), + // Going to the source code page. + ("goto", "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html"), + // Changing theme (since it's local files, the local storage works by folder). + ("local-storage", {"rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false"}), + ("reload"), + ("assert-css", (".rust-logo", {"filter": |filter|})), + ], ) -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: { - "rustdoc-theme": "dark", - "rustdoc-preferred-dark-theme": "dark", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +call-function: ( + "check-logo", + ("ayu", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), ) - -// Then with the ayu theme. -local-storage: { - "rustdoc-theme": "ayu", - "rustdoc-preferred-dark-theme": "ayu", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, +call-function: ( + "check-logo", + ("dark", "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"), ) - -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: { - "rustdoc-theme": "ayu", - "rustdoc-preferred-dark-theme": "ayu", - "rustdoc-use-system-theme": "false", -} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "drop-shadow(rgb(255, 255, 255) 1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px 1px 0px) drop-shadow(rgb(255, 255, 255) -1px 0px 0px) drop-shadow(rgb(255, 255, 255) 0px -1px 0px)"}, -) - -// And finally with the light theme. -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "none"}, -) - -// In the source view page now. -goto: "file://" + |DOC_PATH| + "/src/test_docs/lib.rs.html" - -local-storage: {"rustdoc-theme": "light", "rustdoc-use-system-theme": "false"} -reload: - -assert-css: ( - ".rust-logo", - {"filter": "none"}, +call-function: ( + "check-logo", + ("light", "none"), )