extern crate ordered_float;
extern crate yoga;
mod test_utils;
use yoga::*;
#[test]
fn test_wrap_child() {
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(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_wrap_grandchild() {
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.insert_child(&mut root_child0, 0);
let mut root_child0_child0 = Node::new_with_config(&mut config);
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);
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());
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());
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());
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());
}