From 8900966300d4f5a68433da2ca142f213684351b8 Mon Sep 17 00:00:00 2001 From: Justin Gross Date: Thu, 12 Sep 2024 01:55:30 -0400 Subject: [PATCH] chore: add test_util helper assert_scroll_affects_item_zoom --- src/app.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/app.rs b/src/app.rs index b5a7b34..79a7eea 100644 --- a/src/app.rs +++ b/src/app.rs @@ -3766,6 +3766,24 @@ pub(crate) mod test_utils { ); } + pub fn assert_scroll_affects_item_zoom( + tab: &mut Tab, + message: tab::Message, + modifiers: Modifiers, + should_zoom: bool, + ) { + let grid_icon_size = tab.config.icon_sizes.grid; + let list_icon_size = tab.config.icon_sizes.list; + + debug!("Emitting {:?}", message); + tab.update(message, modifiers); + + let grid_size_changed = grid_icon_size != tab.config.icon_sizes.grid; + let list_size_changed = list_icon_size != tab.config.icon_sizes.list; + + assert_eq!(grid_size_changed || list_size_changed, should_zoom); + } + /// Assert that tab's items are equal to a path's entries. pub fn assert_eq_tab_path_contents(tab: &Tab, path: &Path) { let Location::Path(ref tab_path) = tab.location else {