use egui_kittest::wgpu::{create_render_state, default_wgpu_setup};
use rsplot::{Plot1D, PlotInteractionMode};
#[test]
fn entering_zoom_mode_clears_limits_history() {
let rs = create_render_state(default_wgpu_setup());
rsplot::install(&rs);
let mut plot = Plot1D::new(&rs, 0);
plot.plot_mut().push_limits();
plot.plot_mut().push_limits();
assert_eq!(plot.plot().limits_history_len(), 2);
plot.set_interaction_mode(PlotInteractionMode::Pan);
assert_eq!(plot.plot().limits_history_len(), 2, "Pan keeps the history");
plot.set_interaction_mode(PlotInteractionMode::Zoom);
assert_eq!(plot.plot().limits_history_len(), 0, "Zoom entry clears");
plot.plot_mut().push_limits();
plot.set_interaction_mode(PlotInteractionMode::Zoom);
assert_eq!(plot.plot().limits_history_len(), 0, "re-entry clears again");
}