ftui-layout 0.4.0

Flex and grid layout solvers for FrankenTUI.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use ftui_core::geometry::Rect;
use ftui_layout::{Constraint, Direction, LayoutCacheKey};

#[test]
fn ratio_canonicalization() {
    let area = Rect::new(0, 0, 100, 100);
    let c1 = [Constraint::Ratio(1, 2)];
    let c2 = [Constraint::Ratio(2, 4)];

    let k1 = LayoutCacheKey::new(area, &c1, Direction::Horizontal, None);
    let k2 = LayoutCacheKey::new(area, &c2, Direction::Horizontal, None);

    assert_eq!(
        k1, k2,
        "Ratio(1,2) and Ratio(2,4) should be equivalent for caching"
    );
}