public void When_Child_Has_Fixed_Size_Smaller_than_Parent() { var parentSize = new Windows.Foundation.Size(100, 100); var childSize = new Windows.Foundation.Size(500, 500); var SUT = new Border() { Width = parentSize.Width, Height = parentSize.Height }; var child = new View() { Width = childSize.Width, Height = childSize.Height }; SUT.AddChild(child); SUT.Measure(new Windows.Foundation.Size(100, 100)); var measuredSize = SUT.DesiredSize; SUT.Arrange(new Windows.Foundation.Rect(0, 0, 100, 100)); Assert.AreEqual(parentSize, measuredSize); Assert.AreEqual(new Windows.Foundation.Rect(0, 0, parentSize.Width, parentSize.Height), child.Arranged); }
public void When_Child_Is_Not_Stretch_With_MinSize() { var parentSize = new Windows.Foundation.Size(500, 500); var minSize = new Windows.Foundation.Size(100, 100); var SUT = new Border() { Width = parentSize.Width, Height = parentSize.Height }; var child = new View() { MinWidth = minSize.Width, MinHeight = minSize.Height, HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Top }; SUT.AddChild(child); SUT.Measure(new Windows.Foundation.Size(500, 500)); var measuredSize = SUT.DesiredSize; SUT.Arrange(new Windows.Foundation.Rect(0, 0, 500, 500)); Assert.AreEqual(parentSize, measuredSize); Assert.AreEqual(new Windows.Foundation.Rect(0, 0, minSize.Width, minSize.Height), child.Arranged); }
public void When_Child_Is_Stretch_With_MaxSize() { var parentSize = new Windows.Foundation.Size(500, 500); var maxSize = new Windows.Foundation.Size(100, 100); var SUT = new Border() { Width = parentSize.Width, Height = parentSize.Height }; var child = new View() { MaxWidth = maxSize.Width, MaxHeight = maxSize.Height }; SUT.AddChild(child); SUT.Measure(new Windows.Foundation.Size(500, 500)); var measuredSize = SUT.DesiredSize; SUT.Arrange(new Windows.Foundation.Rect(0, 0, 500, 500)); Assert.AreEqual(parentSize, measuredSize); Assert.AreEqual(new Windows.Foundation.Rect((SUT.Width - maxSize.Width) / 2, (SUT.Height - maxSize.Height) / 2, maxSize.Width, maxSize.Height), child.Arranged); }
public static void Main() { UserInterfaceControl button = new Button(); UserInterfaceControl border = new Border(); UserInterfaceControl text = new Text(); button.AddChild(text); border.AddChild(button); border.ShowOnDisplay(0); }
public Menu() { AcceptingInput = true; menuItems = new List <MenuItem>(); itemPanel = new StackPanel(); var border = new Border(); border.Padding = new Thickness(10); border.AddChild(itemPanel); Child = border; selectedIndex = -1; }
public void When_Child_Is_Stretch() { var parentSize = new Windows.Foundation.Size(500, 500); var SUT = new Border() { Width = parentSize.Width, Height = parentSize.Height }; var child = new View(); SUT.AddChild(child); SUT.Measure(new Windows.Foundation.Size(500, 500)); var measuredSize = SUT.DesiredSize; SUT.Arrange(new Windows.Foundation.Rect(0, 0, 500, 500)); Assert.AreEqual(parentSize, measuredSize); Assert.AreEqual(new Windows.Foundation.Rect(0, 0, parentSize.Width, parentSize.Height), child.Arranged); }