mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-07 12:16:42 +01:00
more built-in centering
This commit is contained in:
parent
8454b95df8
commit
a6a4eb80fd
5 changed files with 33 additions and 17 deletions
|
|
@ -14,12 +14,18 @@ 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 = ();
|
||||
// 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!(Content::<Tui>::layout(&unit, area), [20, 20, 0, 0]);
|
||||
|
||||
assert_eq!(Fill::<Tui, _>::x(unit).layout(area), [10, 20, 20, 0]);
|
||||
assert_eq!(Fill::<Tui, _>::y(unit).layout(area), [20, 10, 0, 20]);
|
||||
assert_eq!(Fill::<Tui, _>::xy(unit).layout(area), area);
|
||||
|
||||
assert_eq!(Align::<Tui, _>::c(unit).layout(area), [20, 20, 0, 0]);
|
||||
assert_eq!(Align::<Tui, _>::c(" ").layout(area), [20, 20, 0, 0]);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue