From b618686498ca5f07a160aa1567d6dc1c80ea406b Mon Sep 17 00:00:00 2001 From: meloalright Date: Sat, 16 Nov 2024 16:19:22 +0800 Subject: [PATCH] feat(flex): flex reading api should be immutable borrow api --- examples/async.rs | 0 include/safe.h | 8 +- src/lib.rs | 16 +- src/safe.cc | 8 +- src/safe.rs | 8 +- tests/flex_direction_test.rs | 196 ++++----- tests/flex_test.rs | 216 +++++----- tests/flex_wrap_test.rs | 768 +++++++++++++++++------------------ tests/layout_macro_test.rs | 4 +- 9 files changed, 612 insertions(+), 612 deletions(-) create mode 100644 examples/async.rs diff --git a/examples/async.rs b/examples/async.rs new file mode 100644 index 0000000..e69de29 diff --git a/include/safe.h b/include/safe.h index 1170be3..b2aa5fa 100644 --- a/include/safe.h +++ b/include/safe.h @@ -28,8 +28,8 @@ void set_align_content(std::unique_ptr & node, int align_conten void set_justify_content(std::unique_ptr & node, int justify_content); void insert_child(std::unique_ptr & node, std::unique_ptr & child, int index); void do_layout(std::unique_ptr & node, double parent_width, double parent_height, int direction); -double get_width(std::unique_ptr & node); -double get_height(std::unique_ptr & node); -double get_left(std::unique_ptr & node); -double get_top(std::unique_ptr & node); +double get_width(std::unique_ptr const & node); +double get_height(std::unique_ptr const & node); +double get_left(std::unique_ptr const & node); +double get_top(std::unique_ptr const & node); void print(std::unique_ptr const & node); diff --git a/src/lib.rs b/src/lib.rs index 667aa50..cbc5c13 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -139,15 +139,15 @@ pub fn do_layout( direction as i32, ); } -pub fn get_width(node: &mut TaitankSafeNode) -> f64 { - ffi::get_width(&mut node.unique_ptr) +pub fn get_width(node: &TaitankSafeNode) -> f64 { + ffi::get_width(&node.unique_ptr) } -pub fn get_height(node: &mut TaitankSafeNode) -> f64 { - ffi::get_height(&mut node.unique_ptr) +pub fn get_height(node: &TaitankSafeNode) -> f64 { + ffi::get_height(&node.unique_ptr) } -pub fn get_left(node: &mut TaitankSafeNode) -> f64 { - ffi::get_left(&mut node.unique_ptr) +pub fn get_left(node: &TaitankSafeNode) -> f64 { + ffi::get_left(&node.unique_ptr) } -pub fn get_top(node: &mut TaitankSafeNode) -> f64 { - ffi::get_top(&mut node.unique_ptr) +pub fn get_top(node: &TaitankSafeNode) -> f64 { + ffi::get_top(&node.unique_ptr) } diff --git a/src/safe.cc b/src/safe.cc index cb0c980..ff12f5b 100644 --- a/src/safe.cc +++ b/src/safe.cc @@ -295,19 +295,19 @@ void set_justify_content(std::unique_ptr & node, int justify) { } } -double get_width(std::unique_ptr & node) { +double get_width(std::unique_ptr const & node) { return taitank::GetWidth(node->ptr); } -double get_height(std::unique_ptr & node) { +double get_height(std::unique_ptr const & node) { return taitank::GetHeight(node->ptr); } -double get_left(std::unique_ptr & node) { +double get_left(std::unique_ptr const & node) { return taitank::GetLeft(node->ptr); } -double get_top(std::unique_ptr & node) { +double get_top(std::unique_ptr const & node) { return taitank::GetTop(node->ptr); } diff --git a/src/safe.rs b/src/safe.rs index 66d2ed6..2bb39ff 100644 --- a/src/safe.rs +++ b/src/safe.rs @@ -32,10 +32,10 @@ pub mod ffi { parent_height: f64, direction: i32, ); - fn get_width(node: &mut UniquePtr) -> f64; - fn get_height(node: &mut UniquePtr) -> f64; - fn get_left(node: &mut UniquePtr) -> f64; - fn get_top(node: &mut UniquePtr) -> f64; + fn get_width(node: &UniquePtr) -> f64; + fn get_height(node: &UniquePtr) -> f64; + fn get_left(node: &UniquePtr) -> f64; + fn get_top(node: &UniquePtr) -> f64; fn print(node: &UniquePtr); } } diff --git a/tests/flex_direction_test.rs b/tests/flex_direction_test.rs index 54f9590..76478b6 100644 --- a/tests/flex_direction_test.rs +++ b/tests/flex_direction_test.rs @@ -22,46 +22,46 @@ mod tests { layout!(&mut root); - assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); - assert_eq!(30.0, get_height(&mut root)); + assert_eq!(0.0, get_left(&root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); + assert_eq!(30.0, get_height(&root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(20.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(20.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(30.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(20.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(20.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); } @@ -86,45 +86,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(30.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(30.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(10.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(20.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(30.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(30.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(20.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(10.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); } @@ -149,45 +149,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(20.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(20.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(20.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(20.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); } @@ -213,45 +213,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(10.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(20.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(90.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(80.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(70.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); } @@ -277,45 +277,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(90.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(90.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(80.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(80.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(70.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(70.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(90.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(90.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(80.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(80.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(10.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(70.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(70.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(10.0, get_height(&mut root_child2)); } #[test] @@ -340,45 +340,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(90.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(80.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(70.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(10.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(10.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(10.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(10.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(10.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); assert_eq!(20.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(10.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(10.0, get_width(&root_child2)); assert_eq!(100.0, get_height(&mut root_child2)); } } diff --git a/tests/flex_test.rs b/tests/flex_test.rs index 7e260cd..687ba13 100644 --- a/tests/flex_test.rs +++ b/tests/flex_test.rs @@ -19,35 +19,35 @@ mod tests { do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::LTR); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(75.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(75.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(75.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(25.0, get_height(&mut root_child1)); layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(75.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(75.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(75.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(25.0, get_height(&mut root_child1)); } @@ -68,35 +68,35 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(75.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(75.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(75.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(25.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(25.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(25.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(75.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(75.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(25.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(25.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); } @@ -118,35 +118,35 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(50.0, get_height(&mut root_child1)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(50.0, get_height(&mut root_child1)); } @@ -169,35 +169,35 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(50.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(50.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(50.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(50.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(50.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(50.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(50.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(50.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(50.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(50.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); } @@ -225,45 +225,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(50.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(50.0, get_width(&root)); assert_eq!(75.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(50.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(50.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(50.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(50.0, get_width(&root_child1)); assert_eq!(0.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(50.0, get_top(&mut root_child2)); - assert_eq!(50.0, get_width(&mut root_child2)); + assert_eq!(50.0, get_top(&root_child2)); + assert_eq!(50.0, get_width(&root_child2)); assert_eq!(50.0, get_height(&mut root_child2)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(50.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(50.0, get_width(&root)); assert_eq!(75.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(50.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(50.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(50.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(50.0, get_width(&root_child1)); assert_eq!(0.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(50.0, get_top(&mut root_child2)); - assert_eq!(50.0, get_width(&mut root_child2)); + assert_eq!(50.0, get_top(&root_child2)); + assert_eq!(50.0, get_width(&root_child2)); assert_eq!(50.0, get_height(&mut root_child2)); } @@ -292,45 +292,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(60.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(60.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(60.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(80.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(80.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(20.0, get_height(&mut root_child2)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(60.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(60.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(60.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(80.0, get_top(&mut root_child2)); - assert_eq!(100.0, get_width(&mut root_child2)); + assert_eq!(80.0, get_top(&root_child2)); + assert_eq!(100.0, get_width(&root_child2)); assert_eq!(20.0, get_height(&mut root_child2)); } @@ -351,35 +351,35 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(0.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0)); assert_eq!(0.0, get_height(&mut root_child0_child0)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(0.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0)); assert_eq!(0.0, get_height(&mut root_child0_child0)); } @@ -405,45 +405,45 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(200.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(200.0, get_width(&root)); assert_eq!(500.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(200.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(200.0, get_width(&root_child0)); assert_eq!(132.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(132.0, get_top(&mut root_child1)); - assert_eq!(200.0, get_width(&mut root_child1)); + assert_eq!(132.0, get_top(&root_child1)); + assert_eq!(200.0, get_width(&root_child1)); assert_eq!(92.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(224.0, get_top(&mut root_child2)); - assert_eq!(200.0, get_width(&mut root_child2)); + assert_eq!(224.0, get_top(&root_child2)); + assert_eq!(200.0, get_width(&root_child2)); assert_eq!(184.0, get_height(&mut root_child2)); do_layout(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(200.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(200.0, get_width(&root)); assert_eq!(500.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(200.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(200.0, get_width(&root_child0)); assert_eq!(132.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(132.0, get_top(&mut root_child1)); - assert_eq!(200.0, get_width(&mut root_child1)); + assert_eq!(132.0, get_top(&root_child1)); + assert_eq!(200.0, get_width(&root_child1)); assert_eq!(92.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(224.0, get_top(&mut root_child2)); - assert_eq!(200.0, get_width(&mut root_child2)); + assert_eq!(224.0, get_top(&root_child2)); + assert_eq!(200.0, get_width(&root_child2)); assert_eq!(184.0, get_height(&mut root_child2)); } } diff --git a/tests/flex_wrap_test.rs b/tests/flex_wrap_test.rs index 9d50cb6..9de656e 100644 --- a/tests/flex_wrap_test.rs +++ b/tests/flex_wrap_test.rs @@ -32,55 +32,55 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(60.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(60.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(30.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(30.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(30.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(30.0, get_height(&mut root_child1)); assert_eq!(0.0, get_left(&mut root_child2)); - assert_eq!(60.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(60.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(30.0, get_left(&mut root_child3)); - assert_eq!(0.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(0.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(60.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(60.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(30.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(30.0, get_height(&mut root_child0)); assert_eq!(30.0, get_left(&mut root_child1)); - assert_eq!(30.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(30.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(30.0, get_height(&mut root_child1)); assert_eq!(30.0, get_left(&mut root_child2)); - assert_eq!(60.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(60.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(0.0, get_left(&mut root_child3)); - assert_eq!(0.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(0.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); } @@ -115,55 +115,55 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(30.0, get_height(&mut root_child0)); assert_eq!(30.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(30.0, get_height(&mut root_child1)); assert_eq!(60.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(0.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(70.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(30.0, get_height(&mut root_child0)); assert_eq!(40.0, get_left(&mut root_child1)); - assert_eq!(0.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(0.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(30.0, get_height(&mut root_child1)); assert_eq!(10.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(70.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); } @@ -199,55 +199,55 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(20.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(20.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(30.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(60.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(0.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(70.0, get_left(&mut root_child0)); - assert_eq!(20.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(20.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(40.0, get_left(&mut root_child1)); - assert_eq!(10.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(10.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(10.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(70.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); } @@ -283,55 +283,55 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(10.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(10.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(30.0, get_left(&mut root_child1)); - assert_eq!(5.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(5.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(60.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(0.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(60.0, get_height(&mut root)); assert_eq!(70.0, get_left(&mut root_child0)); - assert_eq!(10.0, get_top(&mut root_child0)); - assert_eq!(30.0, get_width(&mut root_child0)); + assert_eq!(10.0, get_top(&root_child0)); + assert_eq!(30.0, get_width(&root_child0)); assert_eq!(10.0, get_height(&mut root_child0)); assert_eq!(40.0, get_left(&mut root_child1)); - assert_eq!(5.0, get_top(&mut root_child1)); - assert_eq!(30.0, get_width(&mut root_child1)); + assert_eq!(5.0, get_top(&root_child1)); + assert_eq!(30.0, get_width(&root_child1)); assert_eq!(20.0, get_height(&mut root_child1)); assert_eq!(10.0, get_left(&mut root_child2)); - assert_eq!(0.0, get_top(&mut root_child2)); - assert_eq!(30.0, get_width(&mut root_child2)); + assert_eq!(0.0, get_top(&root_child2)); + assert_eq!(30.0, get_width(&root_child2)); assert_eq!(30.0, get_height(&mut root_child2)); assert_eq!(70.0, get_left(&mut root_child3)); - assert_eq!(30.0, get_top(&mut root_child3)); - assert_eq!(30.0, get_width(&mut root_child3)); + assert_eq!(30.0, get_top(&root_child3)); + assert_eq!(30.0, get_width(&root_child3)); assert_eq!(30.0, get_height(&mut root_child3)); } @@ -358,35 +358,35 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(55.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(55.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(55.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(55.0, get_width(&root_child1)); assert_eq!(50.0, get_height(&mut root_child1)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(100.0, get_height(&mut root)); assert_eq!(45.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(55.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(55.0, get_width(&root_child0)); assert_eq!(50.0, get_height(&mut root_child0)); assert_eq!(45.0, get_left(&mut root_child1)); - assert_eq!(50.0, get_top(&mut root_child1)); - assert_eq!(55.0, get_width(&mut root_child1)); + assert_eq!(50.0, get_top(&root_child1)); + assert_eq!(55.0, get_width(&root_child1)); assert_eq!(50.0, get_height(&mut root_child1)); } @@ -418,55 +418,55 @@ mod tests { layout!(&mut root); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(200.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0)); assert_eq!(100.0, get_height(&mut root_child0_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0_child0)); assert_eq!(100.0, get_height(&mut root_child0_child0_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(100.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(100.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(0.0, get_left(&mut root)); - assert_eq!(0.0, get_top(&mut root)); - assert_eq!(100.0, get_width(&mut root)); + assert_eq!(0.0, get_top(&root)); + assert_eq!(100.0, get_width(&root)); assert_eq!(200.0, get_height(&mut root)); assert_eq!(0.0, get_left(&mut root_child0)); - assert_eq!(0.0, get_top(&mut root_child0)); - assert_eq!(100.0, get_width(&mut root_child0)); + assert_eq!(0.0, get_top(&root_child0)); + assert_eq!(100.0, get_width(&root_child0)); assert_eq!(100.0, get_height(&mut root_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0)); assert_eq!(100.0, get_height(&mut root_child0_child0)); assert_eq!(0.0, get_left(&mut root_child0_child0_child0)); - assert_eq!(0.0, get_top(&mut root_child0_child0_child0)); - assert_eq!(100.0, get_width(&mut root_child0_child0_child0)); + assert_eq!(0.0, get_top(&root_child0_child0_child0)); + assert_eq!(100.0, get_width(&root_child0_child0_child0)); assert_eq!(100.0, get_height(&mut root_child0_child0_child0)); assert_eq!(0.0, get_left(&mut root_child1)); - assert_eq!(100.0, get_top(&mut root_child1)); - assert_eq!(100.0, get_width(&mut root_child1)); + assert_eq!(100.0, get_top(&root_child1)); + assert_eq!(100.0, get_width(&root_child1)); assert_eq!(100.0, get_height(&mut root_child1)); } @@ -490,35 +490,35 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 150.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 150.0); assert_eq!(get_height(&mut root), 100.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 50.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 50.0); assert_eq!(get_height(&mut root_child0), 100.0); assert_eq!(get_left(&mut root_child1), 50.0); - assert_eq!(get_top(&mut root_child1), 0.0); - assert_eq!(get_width(&mut root_child1), 50.0); + assert_eq!(get_top(&root_child1), 0.0); + assert_eq!(get_width(&root_child1), 50.0); assert_eq!(get_height(&mut root_child1), 100.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 150.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 150.0); assert_eq!(get_height(&mut root), 100.0); assert_eq!(get_left(&mut root_child0), 100.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 50.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 50.0); assert_eq!(get_height(&mut root_child0), 100.0); assert_eq!(get_left(&mut root_child1), 50.0); - assert_eq!(get_top(&mut root_child1), 0.0); - assert_eq!(get_width(&mut root_child1), 50.0); + assert_eq!(get_top(&root_child1), 0.0); + assert_eq!(get_width(&root_child1), 50.0); assert_eq!(get_height(&mut root_child1), 100.0); } @@ -558,65 +558,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 30.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 60.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 0.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 30.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 70.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 40.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 10.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 70.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 40.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } @@ -656,65 +656,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 30.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 60.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 0.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 30.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 70.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 40.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 10.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 70.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 40.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } @@ -753,65 +753,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 300.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 300.0); assert_eq!(get_height(&mut root), 50.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 40.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 40.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 30.0); - assert_eq!(get_top(&mut root_child1), 30.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 30.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 60.0); - assert_eq!(get_top(&mut root_child2), 20.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 20.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 90.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 120.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 300.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 300.0); assert_eq!(get_height(&mut root), 50.0); assert_eq!(get_left(&mut root_child0), 270.0); - assert_eq!(get_top(&mut root_child0), 40.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 40.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 240.0); - assert_eq!(get_top(&mut root_child1), 30.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 30.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 210.0); - assert_eq!(get_top(&mut root_child2), 20.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 20.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 180.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 150.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } @@ -851,65 +851,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 30.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 60.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 0.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 30.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 70.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 40.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 10.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 70.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 40.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } @@ -949,65 +949,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 30.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 60.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 0.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 30.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 100.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 100.0); assert_eq!(get_height(&mut root), 80.0); assert_eq!(get_left(&mut root_child0), 70.0); - assert_eq!(get_top(&mut root_child0), 70.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 70.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 40.0); - assert_eq!(get_top(&mut root_child1), 60.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 60.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 10.0); - assert_eq!(get_top(&mut root_child2), 50.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 50.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 70.0); - assert_eq!(get_top(&mut root_child3), 10.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 10.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 40.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } @@ -1047,65 +1047,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 100.0); assert_eq!(get_left(&mut root_child0), 170.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 170.0); - assert_eq!(get_top(&mut root_child1), 10.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 10.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 170.0); - assert_eq!(get_top(&mut root_child2), 30.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 30.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 170.0); - assert_eq!(get_top(&mut root_child3), 60.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 60.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 140.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 100.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 30.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 30.0); assert_eq!(get_height(&mut root_child0), 10.0); assert_eq!(get_left(&mut root_child1), 0.0); - assert_eq!(get_top(&mut root_child1), 10.0); - assert_eq!(get_width(&mut root_child1), 30.0); + assert_eq!(get_top(&root_child1), 10.0); + assert_eq!(get_width(&root_child1), 30.0); assert_eq!(get_height(&mut root_child1), 20.0); assert_eq!(get_left(&mut root_child2), 0.0); - assert_eq!(get_top(&mut root_child2), 30.0); - assert_eq!(get_width(&mut root_child2), 30.0); + assert_eq!(get_top(&root_child2), 30.0); + assert_eq!(get_width(&root_child2), 30.0); assert_eq!(get_height(&mut root_child2), 30.0); assert_eq!(get_left(&mut root_child3), 0.0); - assert_eq!(get_top(&mut root_child3), 60.0); - assert_eq!(get_width(&mut root_child3), 30.0); + assert_eq!(get_top(&root_child3), 60.0); + assert_eq!(get_width(&root_child3), 30.0); assert_eq!(get_height(&mut root_child3), 40.0); assert_eq!(get_left(&mut root_child4), 30.0); - assert_eq!(get_top(&mut root_child4), 0.0); - assert_eq!(get_width(&mut root_child4), 30.0); + assert_eq!(get_top(&root_child4), 0.0); + assert_eq!(get_width(&root_child4), 30.0); assert_eq!(get_height(&mut root_child4), 50.0); } #[test] @@ -1133,45 +1133,45 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 0.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 50.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 120.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); } @@ -1200,45 +1200,45 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 0.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 50.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 120.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); } @@ -1267,45 +1267,45 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 0.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 200.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 200.0); assert_eq!(get_height(&mut root), 200.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 200.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 200.0); assert_eq!(get_height(&mut root_child0), 160.0); assert_eq!(get_left(&mut root_child0_child0), 50.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 150.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 150.0); assert_eq!(get_height(&mut root_child0_child0), 80.0); assert_eq!(get_left(&mut root_child0_child1), 120.0); - assert_eq!(get_top(&mut root_child0_child1), 80.0); - assert_eq!(get_width(&mut root_child0_child1), 80.0); + assert_eq!(get_top(&root_child0_child1), 80.0); + assert_eq!(get_width(&root_child0_child1), 80.0); assert_eq!(get_height(&mut root_child0_child1), 80.0); } @@ -1342,45 +1342,45 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 700.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 700.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 250.0); - assert_eq!(get_top(&mut root_child0), 30.0); - assert_eq!(get_width(&mut root_child0), 100.0); + assert_eq!(get_top(&root_child0), 30.0); + assert_eq!(get_width(&root_child0), 100.0); assert_eq!(get_height(&mut root_child0), 200.0); assert_eq!(get_left(&mut root_child1), 200.0); - assert_eq!(get_top(&mut root_child1), 250.0); - assert_eq!(get_width(&mut root_child1), 200.0); + assert_eq!(get_top(&root_child1), 250.0); + assert_eq!(get_width(&root_child1), 200.0); assert_eq!(get_height(&mut root_child1), 200.0); assert_eq!(get_left(&mut root_child2), 420.0); - assert_eq!(get_top(&mut root_child2), 200.0); - assert_eq!(get_width(&mut root_child2), 100.0); + assert_eq!(get_top(&root_child2), 200.0); + assert_eq!(get_width(&root_child2), 100.0); assert_eq!(get_height(&mut root_child2), 100.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 700.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 700.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 350.0); - assert_eq!(get_top(&mut root_child0), 30.0); - assert_eq!(get_width(&mut root_child0), 100.0); + assert_eq!(get_top(&root_child0), 30.0); + assert_eq!(get_width(&root_child0), 100.0); assert_eq!(get_height(&mut root_child0), 200.0); assert_eq!(get_left(&mut root_child1), 300.0); - assert_eq!(get_top(&mut root_child1), 250.0); - assert_eq!(get_width(&mut root_child1), 200.0); + assert_eq!(get_top(&root_child1), 250.0); + assert_eq!(get_width(&root_child1), 200.0); assert_eq!(get_height(&mut root_child1), 200.0); assert_eq!(get_left(&mut root_child2), 180.0); - assert_eq!(get_top(&mut root_child2), 200.0); - assert_eq!(get_width(&mut root_child2), 100.0); + assert_eq!(get_top(&root_child2), 200.0); + assert_eq!(get_width(&root_child2), 100.0); assert_eq!(get_height(&mut root_child2), 100.0); } @@ -1423,45 +1423,45 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 700.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 700.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 300.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 100.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 100.0); assert_eq!(get_height(&mut root_child0), 180.0); assert_eq!(get_left(&mut root_child1), 250.0); - assert_eq!(get_top(&mut root_child1), 200.0); - assert_eq!(get_width(&mut root_child1), 200.0); + assert_eq!(get_top(&root_child1), 200.0); + assert_eq!(get_width(&root_child1), 200.0); assert_eq!(get_height(&mut root_child1), 180.0); assert_eq!(get_left(&mut root_child2), 300.0); - assert_eq!(get_top(&mut root_child2), 400.0); - assert_eq!(get_width(&mut root_child2), 100.0); + assert_eq!(get_top(&root_child2), 400.0); + assert_eq!(get_width(&root_child2), 100.0); assert_eq!(get_height(&mut root_child2), 100.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 700.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 700.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 300.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 100.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 100.0); assert_eq!(get_height(&mut root_child0), 180.0); assert_eq!(get_left(&mut root_child1), 250.0); - assert_eq!(get_top(&mut root_child1), 200.0); - assert_eq!(get_width(&mut root_child1), 200.0); + assert_eq!(get_top(&root_child1), 200.0); + assert_eq!(get_width(&root_child1), 200.0); assert_eq!(get_height(&mut root_child1), 180.0); assert_eq!(get_left(&mut root_child2), 300.0); - assert_eq!(get_top(&mut root_child2), 400.0); - assert_eq!(get_width(&mut root_child2), 100.0); + assert_eq!(get_top(&root_child2), 400.0); + assert_eq!(get_width(&root_child2), 100.0); assert_eq!(get_height(&mut root_child2), 100.0); } @@ -1497,33 +1497,33 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 500.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 500.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 85.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 85.0); assert_eq!(get_height(&mut root_child0), 80.0); assert_eq!(get_left(&mut root_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child1), 0.0); - assert_eq!(get_top(&mut root_child0_child1), 40.0); - assert_eq!(get_width(&mut root_child0_child1), 40.0); + assert_eq!(get_top(&root_child0_child1), 40.0); + assert_eq!(get_width(&root_child0_child1), 40.0); assert_eq!(get_height(&mut root_child0_child1), 40.0); assert_eq!(get_left(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child1_child0), 40.0); + assert_eq!(get_top(&root_child0_child1_child0), 0.0); + assert_eq!(get_width(&root_child0_child1_child0), 40.0); assert_eq!(get_height(&mut root_child0_child1_child0), 40.0); } @@ -1559,65 +1559,65 @@ mod tests { layout!(&mut root); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 500.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 500.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 0.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 70.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 70.0); assert_eq!(get_height(&mut root_child0), 90.0); assert_eq!(get_left(&mut root_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child1), 0.0); - assert_eq!(get_top(&mut root_child0_child1), 50.0); - assert_eq!(get_width(&mut root_child0_child1), 40.0); + assert_eq!(get_top(&root_child0_child1), 50.0); + assert_eq!(get_width(&root_child0_child1), 40.0); assert_eq!(get_height(&mut root_child0_child1), 40.0); assert_eq!(get_left(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child1_child0), 40.0); + assert_eq!(get_top(&root_child0_child1_child0), 0.0); + assert_eq!(get_width(&root_child0_child1_child0), 40.0); assert_eq!(get_height(&mut root_child0_child1_child0), 40.0); layout!(&mut root, std::f64::NAN, std::f64::NAN, Direction::RTL); assert_eq!(get_left(&mut root), 0.0); - assert_eq!(get_top(&mut root), 0.0); - assert_eq!(get_width(&mut root), 500.0); + assert_eq!(get_top(&root), 0.0); + assert_eq!(get_width(&root), 500.0); assert_eq!(get_height(&mut root), 500.0); assert_eq!(get_left(&mut root_child0), 430.0); - assert_eq!(get_top(&mut root_child0), 0.0); - assert_eq!(get_width(&mut root_child0), 70.0); + assert_eq!(get_top(&root_child0), 0.0); + assert_eq!(get_width(&root_child0), 70.0); assert_eq!(get_height(&mut root_child0), 90.0); assert_eq!(get_left(&mut root_child0_child0), 30.0); - assert_eq!(get_top(&mut root_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child0_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child0_child0), 40.0); + assert_eq!(get_top(&root_child0_child0_child0), 0.0); + assert_eq!(get_width(&root_child0_child0_child0), 40.0); assert_eq!(get_height(&mut root_child0_child0_child0), 40.0); assert_eq!(get_left(&mut root_child0_child1), 30.0); - assert_eq!(get_top(&mut root_child0_child1), 50.0); - assert_eq!(get_width(&mut root_child0_child1), 40.0); + assert_eq!(get_top(&root_child0_child1), 50.0); + assert_eq!(get_width(&root_child0_child1), 40.0); assert_eq!(get_height(&mut root_child0_child1), 40.0); assert_eq!(get_left(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_top(&mut root_child0_child1_child0), 0.0); - assert_eq!(get_width(&mut root_child0_child1_child0), 40.0); + assert_eq!(get_top(&root_child0_child1_child0), 0.0); + assert_eq!(get_width(&root_child0_child1_child0), 40.0); assert_eq!(get_height(&mut root_child0_child1_child0), 40.0); } diff --git a/tests/layout_macro_test.rs b/tests/layout_macro_test.rs index d30c076..adc3d85 100644 --- a/tests/layout_macro_test.rs +++ b/tests/layout_macro_test.rs @@ -11,8 +11,8 @@ mod tests { taitank_safe::layout!(&mut node); assert_eq!(taitank_safe::get_left(&mut node), 0.0); - assert_eq!(taitank_safe::get_top(&mut node), 0.0); - assert_eq!(taitank_safe::get_width(&mut node), 100.0); + assert_eq!(taitank_safe::get_top(&node), 0.0); + assert_eq!(taitank_safe::get_width(&node), 100.0); assert_eq!(taitank_safe::get_height(&mut node), 100.0); } }