public void FlexLayoutRecognizesVisibilityChange() { var root = new Grid(); var flexLayout = new FlexLayout() as IFlexLayout; var view = new TestLabel(); var view2 = new TestLabel(); root.Add(flexLayout); flexLayout.Add(view as IView); flexLayout.Add(view2 as IView); var manager = new FlexLayoutManager(flexLayout); // Measure and arrange the layout while the first view is visible var measure = manager.Measure(1000, 1000); manager.ArrangeChildren(new Rect(Point.Zero, measure)); // Keep track of where the second view is arranged var whenVisible = view2.Frame.X; // Change the visibility view.IsVisible = false; // Measure and arrange againg measure = manager.Measure(1000, 1000); manager.ArrangeChildren(new Rect(Point.Zero, measure)); var whenInvisible = view2.Frame.X; // The location of the second view should have changed // now that the first view is not visible Assert.True(whenInvisible != whenVisible); }
public void FlexLayoutMeasuresImagesUnconstrained() { var root = new Grid(); var flexLayout = new FlexLayout() as IFlexLayout; var image = new TestImage(); root.Add(flexLayout); flexLayout.Add(image as IView); var manager = new FlexLayoutManager(flexLayout); _ = manager.Measure(1000, 1000); Assert.True(image.Passed, "Image should be measured unconstrained even if the FlexLayout is constrained."); }