diff options
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/scrolling.rs | 9 | ||||
| -rw-r--r-- | src/layout/tile.rs | 11 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/layout/scrolling.rs b/src/layout/scrolling.rs index 124a61db..8434c0fd 100644 --- a/src/layout/scrolling.rs +++ b/src/layout/scrolling.rs @@ -3772,8 +3772,6 @@ impl<W: LayoutElement> Column<W> { #[cfg(test)] fn verify_invariants(&self) { - use approx::assert_abs_diff_eq; - assert!(!self.tiles.is_empty(), "columns can't be empty"); assert!(self.active_tile_idx < self.tiles.len()); assert_eq!(self.tiles.len(), self.data.len()); @@ -3800,17 +3798,12 @@ impl<W: LayoutElement> Column<W> { assert_eq!(self.clock, tile.clock); assert_eq!(self.scale, tile.scale()); assert_eq!(self.is_fullscreen, tile.window().is_pending_fullscreen()); + tile.verify_invariants(); let mut data2 = *data; data2.update(tile); assert_eq!(data, &data2, "tile data must be up to date"); - let scale = tile.scale(); - let size = tile.tile_size(); - let rounded = size.to_physical_precise_round(scale).to_logical(scale); - assert_abs_diff_eq!(size.w, rounded.w, epsilon = 1e-5); - assert_abs_diff_eq!(size.h, rounded.h, epsilon = 1e-5); - if matches!(data.height, WindowHeight::Fixed(_)) { assert!( !found_fixed, diff --git a/src/layout/tile.rs b/src/layout/tile.rs index 6646999f..83080870 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -922,4 +922,15 @@ impl<W: LayoutElement> Tile<W> { pub fn take_unmap_snapshot(&mut self) -> Option<TileRenderSnapshot> { self.unmap_snapshot.take() } + + #[cfg(test)] + pub fn verify_invariants(&self) { + use approx::assert_abs_diff_eq; + + let scale = self.scale; + let size = self.tile_size(); + let rounded = size.to_physical_precise_round(scale).to_logical(scale); + assert_abs_diff_eq!(size.w, rounded.w, epsilon = 1e-5); + assert_abs_diff_eq!(size.h, rounded.h, epsilon = 1e-5); + } } |
