SpaceMouse test: make the app before the reading, which goes stale on a slow runner (#1711)

Thanks @phanoob.
This commit is contained in:
phanoob authored and GitHub committed 2026-10-16 09:26:20 -04:00
1 parent 54925cdcd5
commit 37ebe24839
1 file changed
+3 -2
+3 -2
View File
@@ -486,6 +486,9 @@ mod tests {
#[test]
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 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 mut reading = Reading::new(now);
reading.axes.rotation = [0, 350, 0];
@@ -497,8 +500,6 @@ mod tests {
wheel: WheelGuard::default(),
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());
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] });