Integration: #3335 header Esc test allows the half-pixel return scroll that #3201 brings

#3201 makes entering an empty header scroll to it; Esc then scrolls back to the caret, landing 0.5 px from the start (17291.0 vs 17290.5). The test checks the view is back within a pixel.
This commit is contained in:
aiongg
2026-10-22 02:19:18 +00:00
parent 6e8113891e
commit b07e045d7e
+4 -1
View File
@@ -4770,7 +4770,10 @@ mod tests {
frame(&mut a, Vec::new());
}
assert_eq!(a.session.sel, before.0, "Esc left the header for where the caret was");
assert_eq!(a.canvas.scroll_offset, before.1, "the view stays on that page");
// Entering an empty header scrolls to it (#3201) and Esc scrolls back to the caret, which
// can land half a pixel from where the view started.
let drift = a.canvas.scroll_offset - before.1;
assert!(drift.x.abs() <= 1.0 && drift.y.abs() <= 1.0, "the view stays on that page: {:?} vs {:?}", a.canvas.scroll_offset, before.1);
}
fn control_frame(a: &mut WordApp, ctx: &egui::Context, focused: bool) {