Store new_parents on Window instead of layout context

This commit is contained in:
Nathan Sobo 2023-08-29 21:43:48 -06:00
parent 42cd257287
commit 2e7356a53e
6 changed files with 22 additions and 86 deletions

View file

@ -666,14 +666,8 @@ mod tests {
});
let mut list = List::new(state.clone());
let mut new_parents = Default::default();
let mut notify_views_if_parents_change = Default::default();
let mut layout_cx = LayoutContext::new(
cx,
&mut new_parents,
&mut notify_views_if_parents_change,
false,
);
let mut layout_cx = LayoutContext::new(cx, &mut notify_views_if_parents_change, false);
let (size, _) = list.layout(constraint, &mut view, &mut layout_cx);
assert_eq!(size, vec2f(100., 40.));
assert_eq!(
@ -698,12 +692,7 @@ mod tests {
cx,
);
let mut layout_cx = LayoutContext::new(
cx,
&mut new_parents,
&mut notify_views_if_parents_change,
false,
);
let mut layout_cx = LayoutContext::new(cx, &mut notify_views_if_parents_change, false);
let (_, logical_scroll_top) = list.layout(constraint, &mut view, &mut layout_cx);
assert_eq!(
logical_scroll_top,
@ -728,12 +717,7 @@ mod tests {
}
);
let mut layout_cx = LayoutContext::new(
cx,
&mut new_parents,
&mut notify_views_if_parents_change,
false,
);
let mut layout_cx = LayoutContext::new(cx, &mut notify_views_if_parents_change, false);
let (size, logical_scroll_top) = list.layout(constraint, &mut view, &mut layout_cx);
assert_eq!(size, vec2f(100., 40.));
assert_eq!(
@ -852,14 +836,9 @@ mod tests {
let mut list = List::new(state.clone());
let window_size = vec2f(width, height);
let mut new_parents = Default::default();
let mut notify_views_if_parents_change = Default::default();
let mut layout_cx = LayoutContext::new(
cx,
&mut new_parents,
&mut notify_views_if_parents_change,
false,
);
let mut layout_cx =
LayoutContext::new(cx, &mut notify_views_if_parents_change, false);
let (size, logical_scroll_top) = list.layout(
SizeConstraint::new(vec2f(0., 0.), window_size),
&mut view,