瀏覽代碼

don't render headless tests

Evan Almloff 2 年之前
父節點
當前提交
ae71e4ce33
共有 2 個文件被更改,包括 12 次插入2 次删除
  1. 6 1
      packages/desktop/headless_tests/events.rs
  2. 6 1
      packages/desktop/headless_tests/rendering.rs

+ 6 - 1
packages/desktop/headless_tests/events.rs

@@ -3,6 +3,8 @@ use dioxus::prelude::*;
 use dioxus_desktop::DesktopContext;
 
 pub(crate) fn check_app_exits(app: Component) {
+    use dioxus_desktop::tao::window::WindowBuilder;
+    use dioxus_desktop::Config;
     // This is a deadman's switch to ensure that the app exits
     let should_panic = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(true));
     let should_panic_clone = should_panic.clone();
@@ -13,7 +15,10 @@ pub(crate) fn check_app_exits(app: Component) {
         }
     });
 
-    dioxus_desktop::launch(app);
+    dioxus_desktop::launch_cfg(
+        app,
+        Config::new().with_window(WindowBuilder::new().with_visible(false)),
+    );
 
     should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
 }

+ 6 - 1
packages/desktop/headless_tests/rendering.rs

@@ -2,6 +2,8 @@ use dioxus::prelude::*;
 use dioxus_desktop::DesktopContext;
 
 pub(crate) fn check_app_exits(app: Component) {
+    use dioxus_desktop::tao::window::WindowBuilder;
+    use dioxus_desktop::Config;
     // This is a deadman's switch to ensure that the app exits
     let should_panic = std::sync::Arc::new(std::sync::atomic::AtomicBool::new(true));
     let should_panic_clone = should_panic.clone();
@@ -12,7 +14,10 @@ pub(crate) fn check_app_exits(app: Component) {
         }
     });
 
-    dioxus_desktop::launch(app);
+    dioxus_desktop::launch_cfg(
+        app,
+        Config::new().with_window(WindowBuilder::new().with_visible(false)),
+    );
 
     should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
 }