Honor fixed child alignment inside parent-selected slots
This commit is contained in:
1 parent
2ed5503717
commit
39f7b08c6c
2 files changed
+26
-14
No files matched your search
@@ -716,3 +716,24 @@ fn a_stack_sized_by_a_child_does_not_take_that_childs_fraction_twice() {
|
||||
assert_corners!(h, half, (0, 0), (200, 200));
|
||||
assert_corners!(h, behind, (0, 0), (200, 200));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_fixed_child_is_centered_in_its_wrappers_share() {
|
||||
let mut h = Harness::new((600, 300));
|
||||
let leaf = rect(Color::RED).sized((100, 100)).center().add(&mut h.rsc);
|
||||
let wrapper = leaf
|
||||
.wrapper()
|
||||
.width(leftover(2))
|
||||
.height(rel(1.0))
|
||||
.add(&mut h.rsc);
|
||||
let other = rect(Color::BLUE).width(200).add(&mut h.rsc);
|
||||
h.set_root((other, wrapper).span(Dir::RIGHT));
|
||||
|
||||
assert_corners!(h, wrapper, (200, 0), (600, 300));
|
||||
assert_corners!(h, leaf, (350, 100), (450, 200));
|
||||
|
||||
h.resize((900, 400));
|
||||
h.frame();
|
||||
assert_corners!(h, wrapper, (200, 0), (900, 400));
|
||||
assert_corners!(h, leaf, (500, 150), (600, 250));
|
||||
}
|
||||
Reference in new issue
Block a user