test scafolding
This commit is contained in:
1 parent
c645e1c6aa
commit
f381e56ab3
2 files changed
+34
No files matched your search
@@ -57,4 +57,10 @@ hot-reload = ["dioxus-hot-reload"]
|
|||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
dioxus-core-macro = { path = "../core-macro" }
|
dioxus-core-macro = { path = "../core-macro" }
|
||||||
dioxus-hooks = { path = "../hooks" }
|
dioxus-hooks = { path = "../hooks" }
|
||||||
|
dioxus = { path = "../dioxus" }
|
||||||
# image = "0.24.0" # enable this when generating a new desktop image
|
# image = "0.24.0" # enable this when generating a new desktop image
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "headless_tests"
|
||||||
|
path = "headless_tests/main.rs"
|
||||||
|
harness = false
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Check that all events are being forwarded to the mock.
|
||||||
|
//! This example roughly shows how events are serialized into Rust from JavaScript.
|
||||||
|
//!
|
||||||
|
//! There is some conversion happening when input types are checkbox/radio/select/textarea etc.
|
||||||
|
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
|
||||||
|
mod events;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
events::test_events();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn check_app_exits(app: Component) {
|
||||||
|
// 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();
|
||||||
|
std::thread::spawn(move || {
|
||||||
|
std::thread::sleep(std::time::Duration::from_secs(100));
|
||||||
|
if should_panic_clone.load(std::sync::atomic::Ordering::SeqCst) {
|
||||||
|
panic!("App did not exit successfully")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dioxus_desktop::launch(app);
|
||||||
|
|
||||||
|
should_panic.store(false, std::sync::atomic::Ordering::SeqCst);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user