Fix flakey windows tests (#2332)
This commit is contained in:
1 parent
c9ab09b348
commit
5ce91e1bfc
31 files changed
+217
-136
No files matched your search
@@ -2,7 +2,6 @@ use std::collections::HashMap;
|
||||
|
||||
use dioxus::html::geometry::euclid::Vector3D;
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::prelude::consume_context;
|
||||
use dioxus_desktop::DesktopContext;
|
||||
|
||||
#[path = "./utils.rs"]
|
||||
@@ -179,7 +178,10 @@ fn test_mouse_dblclick_div() -> Element {
|
||||
println!("{:?}", event.data);
|
||||
assert!(event.data.modifiers().is_empty());
|
||||
assert!(
|
||||
event.data.held_buttons().contains(dioxus_html::input_data::MouseButton::Primary),
|
||||
event
|
||||
.data
|
||||
.held_buttons()
|
||||
.contains(dioxus_html::input_data::MouseButton::Primary),
|
||||
);
|
||||
assert!(
|
||||
event
|
||||
@@ -282,7 +284,8 @@ fn test_mouse_scroll_div() -> Element {
|
||||
onwheel: move |event| {
|
||||
println!("{:?}", event.data);
|
||||
let dioxus_html::geometry::WheelDelta::Pixels(delta) = event.data.delta() else {
|
||||
panic!("Expected delta to be in pixels") };
|
||||
panic!("Expected delta to be in pixels")
|
||||
};
|
||||
assert_eq!(delta, Vector3D::new(1.0, 2.0, 3.0));
|
||||
RECEIVED_EVENTS.with_mut(|x| *x += 1);
|
||||
}
|
||||
@@ -476,11 +479,16 @@ fn test_form_input() -> Element {
|
||||
r#type: "text",
|
||||
name: "username",
|
||||
id: "form-username",
|
||||
oninput: set_username,
|
||||
oninput: set_username
|
||||
}
|
||||
input { r#type: "text", name: "full-name", value: "lorem" }
|
||||
input { r#type: "password", name: "password", value: "ipsum" }
|
||||
input { r#type: "radio", name: "color", value: "red", checked: true }
|
||||
input {
|
||||
r#type: "radio",
|
||||
name: "color",
|
||||
value: "red",
|
||||
checked: true
|
||||
}
|
||||
input { r#type: "radio", name: "color", value: "blue" }
|
||||
button { r#type: "submit", value: "Submit", "Submit the form" }
|
||||
}
|
||||
@@ -511,13 +519,21 @@ fn test_form_submit() -> Element {
|
||||
rsx! {
|
||||
div {
|
||||
h1 { "Form" }
|
||||
form {
|
||||
id: "form-submitter",
|
||||
onsubmit: set_values,
|
||||
input { r#type: "text", name: "username", id: "username", value: "goodbye" }
|
||||
form { id: "form-submitter", onsubmit: set_values,
|
||||
input {
|
||||
r#type: "text",
|
||||
name: "username",
|
||||
id: "username",
|
||||
value: "goodbye"
|
||||
}
|
||||
input { r#type: "text", name: "full-name", value: "lorem" }
|
||||
input { r#type: "password", name: "password", value: "ipsum" }
|
||||
input { r#type: "radio", name: "color", value: "red", checked: true }
|
||||
input {
|
||||
r#type: "radio",
|
||||
name: "color",
|
||||
value: "red",
|
||||
checked: true
|
||||
}
|
||||
input { r#type: "radio", name: "color", value: "blue" }
|
||||
button { r#type: "submit", value: "Submit", "Submit the form" }
|
||||
}
|
||||
@@ -547,9 +563,9 @@ fn test_select_multiple_options() -> Element {
|
||||
assert_eq!(values, vec!["usa", "canada"]);
|
||||
RECEIVED_EVENTS.with_mut(|x| *x += 1);
|
||||
},
|
||||
option { id: "usa", value: "usa", "USA" }
|
||||
option { id: "canada", value: "canada", "Canada" }
|
||||
option { id: "mexico", value: "mexico", selected: true, "Mexico" }
|
||||
option { id: "usa", value: "usa", "USA" }
|
||||
option { id: "canada", value: "canada", "Canada" }
|
||||
option { id: "mexico", value: "mexico", selected: true, "Mexico" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
use dioxus::prelude::*;
|
||||
use dioxus_core::Element;
|
||||
use dioxus_desktop::DesktopContext;
|
||||
|
||||
#[path = "./utils.rs"]
|
||||
@@ -53,26 +52,17 @@ fn check_html_renders() -> Element {
|
||||
}
|
||||
|
||||
let dyn_value = 0;
|
||||
let dyn_element = rsx! {
|
||||
div {
|
||||
dangerous_inner_html: "<p>hello world</p>",
|
||||
}
|
||||
};
|
||||
let dyn_element = rsx! { div { dangerous_inner_html: "<p>hello world</p>" } };
|
||||
|
||||
rsx! {
|
||||
div {
|
||||
id: "main_div",
|
||||
div { id: "main_div",
|
||||
div {
|
||||
width: "100px",
|
||||
height: "100px",
|
||||
color: "rgb({dyn_value}, {dyn_value}, {dyn_value})",
|
||||
id: 5,
|
||||
input {
|
||||
"type": "checkbox",
|
||||
},
|
||||
h1 {
|
||||
"text"
|
||||
}
|
||||
input { "type": "checkbox" }
|
||||
h1 { "text" }
|
||||
{dyn_element}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ pub fn check_app_exits(app: fn() -> Element) {
|
||||
});
|
||||
|
||||
LaunchBuilder::desktop()
|
||||
.with_cfg(Config::new().with_window(WindowBuilder::new().with_visible(true)))
|
||||
.with_cfg(Config::new().with_window(WindowBuilder::new().with_visible(false)))
|
||||
.launch(app);
|
||||
|
||||
// Stop deadman's switch
|
||||
|
||||
Reference in new issue
Block a user