extern crate ordered_float;
extern crate yoga;
mod test_utils;
use yoga::*;
#[test]
fn test_static_position_insets_have_no_effect_left_top() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_position_type(PositionType::Static);
root_child0.set_position(Edge::Left, StyleUnit::Point(50_f32.into()));
root_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0.set_height(StyleUnit::Point(100_f32.into()));
root.insert_child(&mut root_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(100_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(100_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(100_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(100_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
}
#[test]
fn test_static_position_insets_have_no_effect_right_bottom() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_position_type(PositionType::Static);
root_child0.set_position(Edge::Right, StyleUnit::Point(50_f32.into()));
root_child0.set_position(Edge::Bottom, StyleUnit::Point(50_f32.into()));
root_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0.set_height(StyleUnit::Point(100_f32.into()));
root.insert_child(&mut root_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(100_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(100_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(100_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(100_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_insets_relative_to_positioned_ancestor() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::RowReverse);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row_reverse(
) {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::RowReverse);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_insets_relative_to_positioned_ancestor_row() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::Row);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_row() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::Row);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_column_reverse_static_position_absolute_child_insets_relative_to_positioned_ancestor_column_reverse(
) {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_insets_relative_to_positioned_ancestor_deep() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0_child0_child0
.set_margin(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0_child0_child0_child0
.set_position(Edge::Left, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0_child0_child0_child0
.set_position(Edge::Top, StyleUnit::Point(50_f32.into()));
root_child0_child0_child0_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0_child0_child0
.insert_child(&mut root_child0_child0_child0_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0_child0_child0.get_layout_height());
assert_eq!(-350_f32, root_child0_child0_child0_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_width_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_width_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_width_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_height_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_height_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_height_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_left_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_left_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_left_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_right_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_right_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_right_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_top_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_top_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_top_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_position(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_bottom_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_bottom_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_bottom_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_position(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_margin_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_margin_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_margin_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_padding_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_padding_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_padding_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_border_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_border_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_border_percentage() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0.set_height(StyleUnit::Point(200_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_width(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(200_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(200_f32, root_child0.get_layout_width());
assert_eq!(200_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_containing_block_padding_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-100_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_containing_block_padding_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_containing_block_padding_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Static);
root_child0_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_containing_block_content_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_relative_child_containing_block_content_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_static_child_containing_block_content_box() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_containing_block_padding_and_border() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(8_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0.set_border(Edge::Left, 2_f32);
root_child0.set_border(Edge::Top, 5_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 4_f32);
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(61_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(11_f32, root_child0_child0.get_layout_left());
assert_eq!(13_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(160_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(239_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(292_f32, root_child0_child0.get_layout_left());
assert_eq!(13_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(-60_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(160_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(239_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root_child0.set_width(StyleUnit::Point(500_f32.into()));
root_child0.set_height(StyleUnit::Point(500_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(200_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(63_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(1_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(279_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-2_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_no_position_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root_child0.set_width(StyleUnit::Point(500_f32.into()));
root_child0.set_height(StyleUnit::Point(500_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(200_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(63_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(279_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-15_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_zero_for_inset_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root_child0.set_width(StyleUnit::Point(500_f32.into()));
root_child0.set_height(StyleUnit::Point(500_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(200_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(0_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(63_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-1_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(279_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-265_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_start_inset_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root_child0.set_width(StyleUnit::Point(500_f32.into()));
root_child0.set_height(StyleUnit::Point(500_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(200_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Start, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(63_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(11_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(279_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-2_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_end_inset_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root_child0.set_width(StyleUnit::Point(500_f32.into()));
root_child0.set_height(StyleUnit::Point(500_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0_child0.set_width(StyleUnit::Point(200_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(200_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::End, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(41_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Percent(63_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(270_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(513_f32, root.get_layout_width());
assert_eq!(506_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(500_f32, root_child0.get_layout_width());
assert_eq!(500_f32, root_child0.get_layout_height());
assert_eq!(279_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0.get_layout_width());
assert_eq!(200_f32, root_child0_child0.get_layout_height());
assert_eq!(-261_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(306_f32, root_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_row_reverse_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_flex_direction(FlexDirection::RowReverse);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_height(StyleUnit::Percent(12_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(-128_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(133_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(23_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(133_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(23_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_column_reverse_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_flex_direction(FlexDirection::ColumnReverse);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-82_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(-15_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(-82_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_justify_flex_start_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(111_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_justify_flex_start_position_set_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(30_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(106_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(106_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_no_definite_size_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(23_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(9_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(133_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(9_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(133_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_both_insets_set_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_position(Edge::Left, StyleUnit::Percent(23_f32.into()));
root_child0_child0_child0.set_position(Edge::Right, StyleUnit::Point(13_f32.into()));
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(9_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(69_f32, root.get_layout_width());
assert_eq!(79_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(56_f32, root_child0.get_layout_width());
assert_eq!(73_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0.get_layout_width());
assert_eq!(22_f32, root_child0_child0.get_layout_height());
assert_eq!(-3_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
}
#[test]
fn test_static_position_justify_center_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_justify_content(Justify::Center);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(85_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(111_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(85_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_justify_flex_end_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_justify_content(Justify::FlexEnd);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(111_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_align_flex_start_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_align_items(Align::FlexStart);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(111_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_align_center_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_align_items(Align::Center);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(65_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(39_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(75_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(75_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(65_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(39_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(75_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(75_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_align_flex_end_amalgamation() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_margin(Edge::Left, StyleUnit::Point(4_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(5_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(2_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(9_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(13_f32.into()));
root_child0.set_border(Edge::Left, 5_f32);
root_child0.set_border(Edge::Top, 6_f32);
root_child0.set_border(Edge::Right, 7_f32);
root_child0.set_border(Edge::Bottom, 8_f32);
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_align_items(Align::FlexEnd);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_margin(Edge::Left, StyleUnit::Point(8_f32.into()));
root_child0_child0.set_margin(Edge::Top, StyleUnit::Point(6_f32.into()));
root_child0_child0.set_margin(Edge::Right, StyleUnit::Point(3_f32.into()));
root_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Left, StyleUnit::Point(1_f32.into()));
root_child0_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0_child0.set_padding(Edge::Right, StyleUnit::Point(9_f32.into()));
root_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0_child0.set_border(Edge::Left, 8_f32);
root_child0_child0.set_border(Edge::Top, 10_f32);
root_child0_child0.set_border(Edge::Right, 2_f32);
root_child0_child0.set_border(Edge::Bottom, 1_f32);
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0.set_width(StyleUnit::Percent(21_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child0_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child0_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child0_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child0_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child0_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child0_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child0.insert_child(&mut root_child0_child0_child0_child0, 0);
let mut root_child0_child0_child1 = Node::new_with_config(&mut config);
root_child0_child0_child1.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1.set_border(Edge::Left, 2_f32);
root_child0_child0_child1.set_border(Edge::Top, 1_f32);
root_child0_child0_child1.set_border(Edge::Right, 5_f32);
root_child0_child0_child1.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child1, 1);
let mut root_child0_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child0_child1_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child1_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child1_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child1_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child1_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child1_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child1_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child1_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child1.insert_child(&mut root_child0_child0_child1_child0, 0);
let mut root_child0_child0_child2 = Node::new_with_config(&mut config);
root_child0_child0_child2.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2.set_border(Edge::Left, 2_f32);
root_child0_child0_child2.set_border(Edge::Top, 1_f32);
root_child0_child0_child2.set_border(Edge::Right, 5_f32);
root_child0_child0_child2.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child2, 2);
let mut root_child0_child0_child2_child0 = Node::new_with_config(&mut config);
root_child0_child0_child2_child0.set_margin(Edge::Left, StyleUnit::Point(9_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Top, StyleUnit::Point(12_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Right, StyleUnit::Point(4_f32.into()));
root_child0_child0_child2_child0.set_margin(Edge::Bottom, StyleUnit::Point(7_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Left, StyleUnit::Point(5_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Top, StyleUnit::Point(3_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Right, StyleUnit::Point(8_f32.into()));
root_child0_child0_child2_child0.set_padding(Edge::Bottom, StyleUnit::Point(10_f32.into()));
root_child0_child0_child2_child0.set_border(Edge::Left, 2_f32);
root_child0_child0_child2_child0.set_border(Edge::Top, 1_f32);
root_child0_child0_child2_child0.set_border(Edge::Right, 5_f32);
root_child0_child0_child2_child0.set_border(Edge::Bottom, 9_f32);
root_child0_child0_child2_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0_child2_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0_child2.insert_child(&mut root_child0_child0_child2_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(111_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(131_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(215_f32, root.get_layout_width());
assert_eq!(301_f32, root.get_layout_height());
assert_eq!(4_f32, root_child0.get_layout_left());
assert_eq!(5_f32, root_child0.get_layout_top());
assert_eq!(202_f32, root_child0.get_layout_width());
assert_eq!(295_f32, root_child0.get_layout_height());
assert_eq!(15_f32, root_child0_child0.get_layout_left());
assert_eq!(21_f32, root_child0_child0.get_layout_top());
assert_eq!(166_f32, root_child0_child0.get_layout_width());
assert_eq!(244_f32, root_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(-77_f32, root_child0_child0_child0_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child1.get_layout_left());
assert_eq!(29_f32, root_child0_child0_child1.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child1.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child1.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child1_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child1_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child1_child0.get_layout_height());
assert_eq!(18_f32, root_child0_child0_child2.get_layout_left());
assert_eq!(140_f32, root_child0_child0_child2.get_layout_top());
assert_eq!(20_f32, root_child0_child0_child2.get_layout_width());
assert_eq!(92_f32, root_child0_child0_child2.get_layout_height());
assert_eq!(-97_f32, root_child0_child0_child2_child0.get_layout_left());
assert_eq!(16_f32, root_child0_child0_child2_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0_child2_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child2_child0.get_layout_height());
}
#[test]
fn test_static_position_static_root() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Static);
root.set_padding(Edge::Left, StyleUnit::Point(6_f32.into()));
root.set_padding(Edge::Top, StyleUnit::Point(1_f32.into()));
root.set_padding(Edge::Right, StyleUnit::Point(11_f32.into()));
root.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root.set_width(StyleUnit::Point(100_f32.into()));
root.set_height(StyleUnit::Point(200_f32.into()));
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_position_type(PositionType::Absolute);
root_child0.set_margin(Edge::Left, StyleUnit::Point(12_f32.into()));
root_child0.set_margin(Edge::Top, StyleUnit::Point(11_f32.into()));
root_child0.set_margin(Edge::Right, StyleUnit::Point(15_f32.into()));
root_child0.set_margin(Edge::Bottom, StyleUnit::Point(1_f32.into()));
root_child0.set_padding(Edge::Left, StyleUnit::Point(3_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(7_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(5_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(4_f32.into()));
root_child0.set_border(Edge::Left, 4_f32);
root_child0.set_border(Edge::Top, 3_f32);
root_child0.set_border(Edge::Right, 2_f32);
root_child0.set_border(Edge::Bottom, 1_f32);
root_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0.set_height(StyleUnit::Percent(50_f32.into()));
root.insert_child(&mut root_child0, 0);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(18_f32, root_child0.get_layout_left());
assert_eq!(12_f32, root_child0.get_layout_top());
assert_eq!(50_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(100_f32, root.get_layout_width());
assert_eq!(200_f32, root.get_layout_height());
assert_eq!(24_f32, root_child0.get_layout_left());
assert_eq!(12_f32, root_child0.get_layout_top());
assert_eq!(50_f32, root_child0.get_layout_width());
assert_eq!(100_f32, root_child0.get_layout_height());
}
#[test]
fn test_static_position_absolute_child_multiple() {
let mut config = Config::new();
let mut root = Node::new_with_config(&mut config);
root.set_position_type(PositionType::Absolute);
let mut root_child0 = Node::new_with_config(&mut config);
root_child0.set_padding(Edge::Left, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Top, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Right, StyleUnit::Point(100_f32.into()));
root_child0.set_padding(Edge::Bottom, StyleUnit::Point(100_f32.into()));
root_child0.set_width(StyleUnit::Point(400_f32.into()));
root_child0.set_height(StyleUnit::Point(400_f32.into()));
root.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0.set_position_type(PositionType::Static);
root_child0_child0.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child0.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child0, 0);
let mut root_child0_child0_child0 = Node::new_with_config(&mut config);
root_child0_child0_child0.set_position_type(PositionType::Absolute);
root_child0_child0_child0.set_width(StyleUnit::Percent(10_f32.into()));
root_child0_child0_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child0.insert_child(&mut root_child0_child0_child0, 0);
let mut root_child0_child1 = Node::new_with_config(&mut config);
root_child0_child1.set_position_type(PositionType::Static);
root_child0_child1.set_width(StyleUnit::Point(100_f32.into()));
root_child0_child1.set_height(StyleUnit::Point(100_f32.into()));
root_child0.insert_child(&mut root_child0_child1, 1);
let mut root_child0_child1_child0 = Node::new_with_config(&mut config);
root_child0_child1_child0.set_position_type(PositionType::Absolute);
root_child0_child1_child0.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child1_child0.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child1.insert_child(&mut root_child0_child1_child0, 0);
let mut root_child0_child1_child1 = Node::new_with_config(&mut config);
root_child0_child1_child1.set_position_type(PositionType::Absolute);
root_child0_child1_child1.set_width(StyleUnit::Percent(50_f32.into()));
root_child0_child1_child1.set_height(StyleUnit::Point(50_f32.into()));
root_child0_child1.insert_child(&mut root_child0_child1_child1, 1);
let mut root_child0_child2 = Node::new_with_config(&mut config);
root_child0_child2.set_position_type(PositionType::Absolute);
root_child0_child2.set_width(StyleUnit::Point(25_f32.into()));
root_child0_child2.set_height(StyleUnit::Point(50_f32.into()));
root_child0.insert_child(&mut root_child0_child2, 2);
root.calculate_layout(Undefined, Undefined, Direction::LTR);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(100_f32, root_child0_child1.get_layout_left());
assert_eq!(200_f32, root_child0_child1.get_layout_top());
assert_eq!(100_f32, root_child0_child1.get_layout_width());
assert_eq!(100_f32, root_child0_child1.get_layout_height());
assert_eq!(0_f32, root_child0_child1_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child1_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child1_child0.get_layout_height());
assert_eq!(0_f32, root_child0_child1_child1.get_layout_left());
assert_eq!(0_f32, root_child0_child1_child1.get_layout_top());
assert_eq!(200_f32, root_child0_child1_child1.get_layout_width());
assert_eq!(50_f32, root_child0_child1_child1.get_layout_height());
assert_eq!(100_f32, root_child0_child2.get_layout_left());
assert_eq!(100_f32, root_child0_child2.get_layout_top());
assert_eq!(25_f32, root_child0_child2.get_layout_width());
assert_eq!(50_f32, root_child0_child2.get_layout_height());
root.calculate_layout(Undefined, Undefined, Direction::RTL);
assert_eq!(0_f32, root.get_layout_left());
assert_eq!(0_f32, root.get_layout_top());
assert_eq!(400_f32, root.get_layout_width());
assert_eq!(400_f32, root.get_layout_height());
assert_eq!(0_f32, root_child0.get_layout_left());
assert_eq!(0_f32, root_child0.get_layout_top());
assert_eq!(400_f32, root_child0.get_layout_width());
assert_eq!(400_f32, root_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child0.get_layout_left());
assert_eq!(100_f32, root_child0_child0.get_layout_top());
assert_eq!(100_f32, root_child0_child0.get_layout_width());
assert_eq!(100_f32, root_child0_child0.get_layout_height());
assert_eq!(60_f32, root_child0_child0_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child0_child0.get_layout_top());
assert_eq!(40_f32, root_child0_child0_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child0_child0.get_layout_height());
assert_eq!(200_f32, root_child0_child1.get_layout_left());
assert_eq!(200_f32, root_child0_child1.get_layout_top());
assert_eq!(100_f32, root_child0_child1.get_layout_width());
assert_eq!(100_f32, root_child0_child1.get_layout_height());
assert_eq!(-100_f32, root_child0_child1_child0.get_layout_left());
assert_eq!(0_f32, root_child0_child1_child0.get_layout_top());
assert_eq!(200_f32, root_child0_child1_child0.get_layout_width());
assert_eq!(50_f32, root_child0_child1_child0.get_layout_height());
assert_eq!(-100_f32, root_child0_child1_child1.get_layout_left());
assert_eq!(0_f32, root_child0_child1_child1.get_layout_top());
assert_eq!(200_f32, root_child0_child1_child1.get_layout_width());
assert_eq!(50_f32, root_child0_child1_child1.get_layout_height());
assert_eq!(275_f32, root_child0_child2.get_layout_left());
assert_eq!(100_f32, root_child0_child2.get_layout_top());
assert_eq!(25_f32, root_child0_child2.get_layout_width());
assert_eq!(50_f32, root_child0_child2.get_layout_height());
}