public void StackPanelCenteredOnAGrid_Works() { // < Grid Style = "BaseScreenStyle" > //< StackPanel > // < Image // Size = ".8,.18" // Content = "Images/LogoTile" /> var container = new VarmintWidgetGrid() { Size = new Vector2(10, 20), HorizontalContentAlignment = HorizontalContentAlignment.Center }; var panel = new VarmintWidgetStackPanel() { }; var panelChild1 = new VarmintWidgetGrid() { Size = new Vector2(6, 1) }; panel.AddChild(panelChild1); container.AddChild(panel); container.Prepare(null); Assert.AreEqual(new Vector2(2, 0), panel.Offset); Assert.AreEqual(new Vector2(0, 0), panelChild1.Offset); }
public void StretchParameter_Works_WhenPanelIsStretchedToParent() { var container = new VarmintWidgetGrid() { Size = new Vector2(30, 20) }; var panel = new VarmintWidgetStackPanel() { Stretch = new VarmintWidget.StretchParameter("1,1") }; var panelChild1 = new VarmintWidgetGrid() { Size = new Vector2(1, 1), Stretch = new VarmintWidget.StretchParameter("1,1") }; panel.AddChild(panelChild1); container.AddChild(panel); container.Prepare(null); Assert.AreEqual(new Vector2(30, 20), panel.Size); Assert.AreEqual(new Vector2(30, 20), panelChild1.Size); }