use torin::{prelude::*, test_utils::*}; #[test] pub fn padding() { let (mut layout, mut measurer) = test_utils(); let mut mocked_dom = TestingDOM::default(); mocked_dom.add( 0, None, vec![1], Node::from_size_and_padding( Size::Pixels(Length::new(200.0)), Size::Pixels(Length::new(200.0)), Gaps::new(5.0, 10.0, 15.0, 20.0), ), ); mocked_dom.add( 1, Some(0), vec![], Node::from_size_and_direction( Size::Percentage(Length::new(100.0)), Size::Percentage(Length::new(100.0)), DirectionMode::Vertical, ), ); layout.measure( 0, Rect::new(Point2D::new(0.0, 0.0), Size2D::new(1000.0, 1000.0)), &mut measurer, &mut mocked_dom, ); assert_eq!( layout.get(1).unwrap().area, Rect::new(Point2D::new(20.0, 5.0), Size2D::new(170.0, 180.0)), ); }