Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

test: move the macOS fullscreen source test out of window.rs

Tw935690af5b1ff0
diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs
index ff687996..d2929cf2 100644
--- a/src-tauri/src/app/window.rs
+++ b/src-tauri/src/app/window.rs
@@ -350,28 +350,6 @@ mod popup_tests {
assert!(GLOBAL_API_NAME.contains("window.__TAURI__ = window.__PAKE_NATIVE__"));
}
- #[test]
- fn macos_keeps_webkits_own_fullscreen_instead_of_the_polyfill() {
- // Under the polyfill YouTube's button made the window full screen and
- // left the video a small box. The script must read the engine's answer
- // and leave before it marks itself installed or replaces anything.
- let script = include_str!("../inject/fullscreen.js").replace("\r\n", "\n");
- let asks = script
- .find("function engineHasFullscreen() {")
- .expect("the script asks the engine first");
- let mac_only = script[asks..]
- .find("if (!/^Mac/.test(navigator.platform || \"\")) return false;")
- .expect("only a Mac's engine is trusted with it");
- let leaves = script
- .find("if (engineHasFullscreen()) return;")
- .expect("the polyfill stays out where the engine has fullscreen");
- let installs = script
- .find("window.__PAKE_FULLSCREEN_POLYFILL__ = true;")
- .expect("the polyfill marks itself installed");
- assert!(mac_only < 200);
- assert!(asks < leaves && leaves < installs);
- }
-
#[test]
fn a_popup_web_view_is_built_blank_so_the_engine_loads_its_address_once() {
let google = Url::parse("https://accounts.google.com/gsi/select?client_id=1").unwrap();
diff --git a/src-tauri/src/util.rs b/src-tauri/src/util.rs
index 8c361653..52a81220 100644
--- a/src-tauri/src/util.rs
+++ b/src-tauri/src/util.rs
@@ -1051,4 +1051,28 @@ mod tests {
assert!(!is_valid_identifier(id), "{id}");
}
}
+
+ #[test]
+ fn macos_keeps_webkits_own_fullscreen_instead_of_the_polyfill() {
+ // Under the polyfill YouTube's button made the window full screen and
+ // left the video a small box. The script must read the engine's answer
+ // and leave before it marks itself installed or replaces anything. It
+ // is read here, not in window.rs, which a source test holds to naming
+ // the script once, where it is injected.
+ let script = include_str!("inject/fullscreen.js").replace("\r\n", "\n");
+ let asks = script
+ .find("function engineHasFullscreen() {")
+ .expect("the script asks the engine first");
+ let mac_only = script[asks..]
+ .find("if (!/^Mac/.test(navigator.platform || \"\")) return false;")
+ .expect("only a Mac's engine is trusted with it");
+ let leaves = script
+ .find("if (engineHasFullscreen()) return;")
+ .expect("the polyfill stays out where the engine has fullscreen");
+ let installs = script
+ .find("window.__PAKE_FULLSCREEN_POLYFILL__ = true;")
+ .expect("the polyfill marks itself installed");
+ assert!(mac_only < 200);
+ assert!(asks < leaves && leaves < installs);
+ }
}