wip: fixing Map, centering

This commit is contained in:
🪞👃🪞 2025-01-01 17:00:28 +01:00
parent 059ff2ca79
commit d17d20e7db
10 changed files with 104 additions and 78 deletions

View file

@ -13,11 +13,13 @@ pub(crate) use ::tek_engine::*;
pub(crate) use std::marker::PhantomData;
#[cfg(test)] #[test] fn test_layout () -> Usually<()> {
use crate::tui::Tui;
let area: [u16;4] = [10, 10, 20, 20];
let unit = ();
//assert_eq!(().layout(area), [15, 15, 0, 0]); // should be independent over E, isn't
assert_eq!(Fill::x(()).layout(area), [10, 15, 20, 0]);
assert_eq!(Fill::y(()).layout(area), [15, 10, 0, 20]);
assert_eq!(Fill::xy(()).layout(area), area);
// should be independent over E, isn't
assert_eq!(Content::<Tui>::layout(&unit, area), [15, 15, 0, 0]);
assert_eq!(Fill::<Tui, _>::x(unit).layout(area), [10, 15, 20, 0]);
assert_eq!(Fill::<Tui, _>::y(unit).layout(area), [15, 10, 0, 20]);
assert_eq!(Fill::<Tui, _>::xy(unit).layout(area), area);
Ok(())
}