SpaceMouse test: make the app before the reading, which goes stale on a slow runner (#1711)
Thanks @phanoob.
This commit is contained in:
1 parent
54925cdcd5
commit
37ebe24839
1 file changed
+3
-2
@@ -486,6 +486,9 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn each_frame_hands_the_view_its_motion_through_the_drivers_mapping() {
|
fn each_frame_hands_the_view_its_motion_through_the_drivers_mapping() {
|
||||||
// The reader's latest tilt, and a profile that makes tilt roll: the frame's motion rolls.
|
// The reader's latest tilt, and a profile that makes tilt roll: the frame's motion rolls.
|
||||||
|
// The app is made first: on a slow runner that takes longer than a reading stays fresh.
|
||||||
|
let mut app = SolveApp::new(solidcraft_engine::Session::default(), solidcraft_ui_egui::Services::default());
|
||||||
|
app.home.open = false;
|
||||||
let now = Instant::now();
|
let now = Instant::now();
|
||||||
let mut reading = Reading::new(now);
|
let mut reading = Reading::new(now);
|
||||||
reading.axes.rotation = [0, 350, 0];
|
reading.axes.rotation = [0, 350, 0];
|
||||||
@@ -497,8 +500,6 @@ mod tests {
|
|||||||
wheel: WheelGuard::default(),
|
wheel: WheelGuard::default(),
|
||||||
started: now,
|
started: now,
|
||||||
};
|
};
|
||||||
let mut app = SolveApp::new(solidcraft_engine::Session::default(), solidcraft_ui_egui::Services::default());
|
|
||||||
app.home.open = false;
|
|
||||||
mouse.tick(&mut app, &Context::default());
|
mouse.tick(&mut app, &Context::default());
|
||||||
let DeviceMotion { motion, seconds } = app.viewport.device_motion.expect("the frame hands the page its motion");
|
let DeviceMotion { motion, seconds } = app.viewport.device_motion.expect("the frame hands the page its motion");
|
||||||
assert_eq!(motion, Motion { translation: [0.0; 3], rotation: [0.0, 0.0, -1.0] });
|
assert_eq!(motion, Motion { translation: [0.0; 3], rotation: [0.0, 0.0, -1.0] });
|
||||||
|
|||||||
Reference in new issue
Block a user