Пример #1
0
        public void Format_NoMargins_NoSize_NoStretch_LimitsByMax()
        {
            var layoutText =
                @"<TestWidget>
                    <Grid Name=""Bob"" MyAlignment=""Center,Top"" Size=""2,3"">
                    </Grid>
                </TestWidget>";
            var target = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            var grid   = target.FindWidgetByName("Bob");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(10, 20));
            Assert.AreEqual(new Vector2(10, 20), target.Size);
            Assert.AreEqual(new Vector2(2, 3), grid.Size);
            Assert.AreEqual(new Vector2(4, 0), grid.Offset);

            // if child is bigger than parent, it gets truncated
            layoutText =
                @"<TestWidget>
                    <Grid Name=""Bob"" MyAlignment=""Center,Top"" Size=""200,3000"">
                    </Grid>
                </TestWidget>";
            target = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            grid   = target.FindWidgetByName("Bob");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(10, 20));
            Assert.AreEqual(new Vector2(10, 20), target.Size);
            Assert.AreEqual(new Vector2(10, 20), grid.Size);
            Assert.AreEqual(new Vector2(0, 0), grid.Offset);
        }
Пример #2
0
        public void GeneralPropertySerializationWorks()
        {
            var layoutText =
                @"<TestWidget 
                    Parameters=""Foo=Bar,that`Blech=223""
                    OnTap=""HandleTap""
                    Offset=""0.1,0.2""
                    Size=""10,11""
                />";
            var bindToMe = new BindingThing();

            var target = TestUtils.LoadFromText(this, layoutText, "Barney");

            target.BindingContext = bindToMe;
            target.Prepare(new Dictionary <string, VarmintWidgetStyle>());
            Assert.AreEqual("Barney", target.Name);
            Assert.AreEqual("Bar,that", target.Parameters["Foo"]);
            Assert.AreEqual("223", target.Parameters["Blech"]);
            Assert.AreEqual(0.1f, target.Offset.X);
            Assert.AreEqual(0.2f, target.Offset.Y);
            Assert.AreEqual(10, target.Size.X);
            Assert.AreEqual(11, target.Size.Y);
            target.HandleTap(new Vector2(1, 1));
            Assert.AreEqual(1, bindToMe.FooCalls);
        }
Пример #3
0
        public void Format_ImageAlignment_Works()
        {
            var mockRenderer = new MockRenderer(10, 20);

            mockRenderer.MeasureTextReturn = new Vector2(1, 1);
            var layoutText = @"
                <Grid>
                    <Image
                        Name=""TextLogo""
                        Margin = ""0,6""
                        Size = ""6,2""
                        ContentAlignment = ""Left,""
                        Content = ""TextLogo"" >
                        <Label Content=""foo"" />
                    </Image> 
                </Grid>
                ";
            var target     = (VarmintWidgetGrid)TestUtils.LoadFromText(mockRenderer, layoutText, "(root)");
            var image      = target.FindWidgetByName("TextLogo");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(20, 40));
            Assert.AreEqual(new Vector2(6, 2), image.Size);
            Assert.AreEqual(new Vector2(0, 6), image.Offset);
        }
Пример #4
0
        public void Format_ExtremeMargins_AffectsAlignment()
        {
            var layoutText =
                @"<Grid>
                      <Grid Name=""BigGrid"" Margin=""0,0,0,0""  />
                      <Grid Name=""SmallGrid"" Margin="",,0,0"" Size=""12,3"" >
                        <StackPanel Name=""StackPanel""  >
                          <Grid Size=""4,1""/>
                        </StackPanel>  
                      </Grid>
                    </Grid>";
            var target     = (VarmintWidgetGrid)TestUtils.LoadFromText(this, layoutText, "(root)");
            var bigGrid    = target.FindWidgetByName("BigGrid");
            var smallGrid  = target.FindWidgetByName("SmallGrid");
            var stackPanel = target.FindWidgetByName("StackPanel");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(20, 40));
            Assert.AreEqual(new Vector2(20, 40), target.Size);
            Assert.AreEqual(new Vector2(20, 40), bigGrid.Size);
            Assert.AreEqual(new Vector2(0, 0), bigGrid.Offset);
            Assert.AreEqual(new Vector2(12, 3), smallGrid.Size);
            Assert.AreEqual(new Vector2(8, 37), smallGrid.Offset);
            Assert.AreEqual(new Vector2(12, 3), stackPanel.Size);
            Assert.AreEqual(new Vector2(0, 0), stackPanel.Offset);
        }
Пример #5
0
        public void Format_Label_Autosizes_ToText()
        {
            var layoutText = @"
                <TestWidget MyAlignment=""Stretch,Stretch"" >
                    <Grid Name=""TheGrid"">
                        <Label Name=""TheLabel"" Content=""Hi"" />
                    </Grid>
                </TestWidget>";
            var target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            var label      = (VarmintWidgetLabel)target.FindWidgetByName("TheLabel");

            var renderer = new MockRenderer(10, 10);

            renderer.MeasureTextReturn = new Vector2(.5f, .2f);
            label.Renderer             = renderer;
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(5, 8), label.Size);
            Assert.AreEqual(new Vector2(0, 0), label.Offset);

            label.MyAlignment = new AlignmentTuple(Alignment.Center, Alignment.Center);
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(.5f, .2f), label.Size);
            Assert.AreEqual(new Vector2(2.25f, 3.9f), label.Offset);
        }
Пример #6
0
        public void StackPanel_NormalHorizontal_Works()
        {
            var renderer = new MockRenderer(10, 20);

            renderer.MeasureTextReturn = new Vector2(1, 3);

            var layoutText =
                @"<Grid  ContentAlignment=""Left,Top"">
                    <StackPanel Name=""panel"" Orientation=""Horizontal"" >
                        <Grid Size=""2,5""  Name=""gridChild"" />
                        <Label Content=""Hi"" Name=""labelChild""/>
                    </StackPanel>
                   </Grid>";

            var target = TestUtils.LoadFromText(renderer, layoutText, "Target");

            target.Prepare(new Dictionary <string, VarmintWidgetStyle>());
            target.UpdateFormatting(renderer.ScreenSize);


            var panel      = target.FindWidgetByName("panel");
            var gridChild  = target.FindWidgetByName("gridChild");
            var labelChild = target.FindWidgetByName("labelChild");

            // Should size to children
            Assert.AreEqual(new Vector2(3, 5), panel.Size);
            Assert.AreEqual(new Vector2(0, 0), panel.Offset);

            // children should have correct size and offset
            Assert.AreEqual(new Vector2(2, 5), gridChild.Size);
            Assert.AreEqual(new Vector2(0, 0), gridChild.Offset);
            Assert.AreEqual(new Vector2(1, 3), labelChild.Size);
            Assert.AreEqual(new Vector2(2, 0), labelChild.Offset);
        }
Пример #7
0
        public void Format_ContentIsPreserved()
        {
            var mockRenderer = new MockRenderer(10, 20);

            mockRenderer.MeasureTextReturn = new Vector2(1, 1);
            var layoutText = @"<Label Content=""Free Balloons"" />";
            var target     = (VarmintWidgetLabel)TestUtils.LoadFromText(mockRenderer, layoutText, "(root)");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(20, 40));
            Assert.AreEqual("Free Balloons", target.Content);
        }
Пример #8
0
        public void ChildPropertyThrowsIfMoreThanOneDeep()
        {
            var layoutText =
                @"
<ChildPropertyWidget>
    <ChildPropertyWidget.Foo.Foo>
        <Grid Name=""greg"" />
    </ChildPropertyWidget.Foo.Foo>
</ChildPropertyWidget>";
            var bindToMe = new BindingThing();

            Assert.AreEqual("Property setter specification is too deep.  Only one dot allowed! (ChildPropertyWidget.Foo.Foo)",
                            Assert.ThrowsException <ApplicationException>(() => { TestUtils.LoadFromText(this, layoutText, "CP"); }).Message);
        }
Пример #9
0
        public void ChildPropertyThrowsIfBadType()
        {
            var layoutText =
                @"
<ChildPropertyWidget>
    <ChildPropertyWidget.Name>
        <ChildPropertyWidget Name=""greg"" />
    </ChildPropertyWidget.Name>
</ChildPropertyWidget>";
            var bindToMe = new BindingThing();

            Assert.AreEqual("Property ChildPropertyWidget.Name cannot be assigned Type ChildPropertyWidget",
                            Assert.ThrowsException <ApplicationException>(() => { TestUtils.LoadFromText(this, layoutText, "CP"); }).Message);
        }
Пример #10
0
        public void ChildPropertyIsNullWhenChildContentNotSpecified()
        {
            var layoutText =
                @"
<ChildPropertyWidget>
    <ChildPropertyWidget.Foo>
    </ChildPropertyWidget.Foo>
</ChildPropertyWidget>";
            var bindToMe = new BindingThing();

            var target = (ChildPropertyWidget)TestUtils.LoadFromText(this, layoutText, "CP");

            Assert.AreEqual(false, target.HasChildren);
            Assert.AreEqual(null, target.Foo);
        }
Пример #11
0
        public void ChildPropertyThrowsIfTooManyChildren()
        {
            var layoutText =
                @"
<ChildPropertyWidget>
    <ChildPropertyWidget.Foo>
        <ChildPropertyWidget Name=""greg"" />
        <ChildPropertyWidget Name=""bob"" />
    </ChildPropertyWidget.Foo>
</ChildPropertyWidget>";
            var bindToMe = new BindingThing();

            Assert.AreEqual("Too many child nodes on a property setter.  You only get one! (ChildPropertyWidget.Foo)",
                            Assert.ThrowsException <ApplicationException>(() => { TestUtils.LoadFromText(this, layoutText, "CP"); }).Message);
        }
Пример #12
0
        public void Format_Handles_HighAlignment()
        {
            var layoutText = @"<TestWidget MyAlignment=""Right,Bottom"" Size=""1,2"" />";
            var target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(1, 2), target.Size);
            Assert.AreEqual(new Vector2(4, 6), target.Offset);

            // Extra size should be truncated
            layoutText = @"<TestWidget  MyAlignment=""Left,Top""  Size=""1000,2000"" Margin="".5"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(4, 7), target.Size);
            Assert.AreEqual(new Vector2(.5f, .5f), target.Offset);
        }
Пример #13
0
        public void ChildPropertySettingWorks()
        {
            var layoutText =
                @"
<ChildPropertyWidget>
    <Grid Name=""Gumby"" />
    <ChildPropertyWidget.Foo>
        <ChildPropertyWidget Name=""greg"" />
    </ChildPropertyWidget.Foo>
</ChildPropertyWidget>";
            var bindToMe = new BindingThing();

            var target = (ChildPropertyWidget)TestUtils.LoadFromText(this, layoutText, "CP");

            Assert.AreEqual(true, target.HasChildren);
            Assert.AreEqual("Gumby", target.Children.First().Name);
            Assert.AreEqual("greg", target.Foo.Name);
        }
Пример #14
0
        public void StackPanel_NormalHorizontal_AlignedContent_Works()
        {
            var renderer = new MockRenderer(10, 20);

            renderer.MeasureTextReturn = new Vector2(1, 3);

            var layoutText =
                @"<Grid  ContentAlignment=""Left,Top"">
                    <StackPanel Name=""FirstPanel"">
                        <StackPanel Name=""panel1"" Orientation=""Horizontal"" ContentAlignment=""Center"">
                            <Grid Size=""2,5""  Name=""grid1"" />
                            <Grid  Name=""gridStretched1"" MyAlignment=""Stretch"" />
                            <Label Content=""Hi"" Name=""labelChild1"" Margin=""1""/>
                            <Grid  Name=""gridStretched2"" MyAlignment=""Stretch"" />
                       </StackPanel>
                    </StackPanel>
                   </Grid>";

            var target = TestUtils.LoadFromText(renderer, layoutText, "Target");

            target.Prepare(new Dictionary <string, VarmintWidgetStyle>());
            target.UpdateFormatting(renderer.ScreenSize);

            var panel  = target.FindWidgetByName("panel1");
            var child1 = target.FindWidgetByName("grid1");
            var child2 = target.FindWidgetByName("gridStretched1");
            var child3 = target.FindWidgetByName("labelChild1");
            var child4 = target.FindWidgetByName("gridStretched2");

            // Should size to children, which will push it to the max extent
            Assert.AreEqual(new Vector2(10, 20), panel.Size);
            Assert.AreEqual(new Vector2(0, 0), panel.Offset);

            // children should have correct size and offset
            Assert.AreEqual(new Vector2(2, 5), child1.Size);
            Assert.AreEqual(new Vector2(2.5f, 20), child2.Size);
            Assert.AreEqual(new Vector2(1, 3), child3.Size);
            Assert.AreEqual(new Vector2(2.5f, 20), child4.Size);

            Assert.AreEqual(new Vector2(0, 7.5f), child1.Offset);
            Assert.AreEqual(new Vector2(2, 0), child2.Offset);
            Assert.AreEqual(new Vector2(5.5f, 8.5f), child3.Offset);
            Assert.AreEqual(new Vector2(7.5f, 0), child4.Offset);
        }
Пример #15
0
        public void StackPanelCenteredOnAGrid_WorksFromSerialized()
        {
            var layoutText =
                @"<Grid  HorizontalContentAlignment=""Center"" Size=""10,20"">
                    <StackPanel Name=""panel"">
                        <Grid Size=""6,1""  Name=""panelChild"" />
                    </StackPanel>
                   </Grid>";

            var target = TestUtils.LoadFromText(this, layoutText, "Barney");

            target.Prepare(new Dictionary <string, VarmintWidgetStyle>());

            var panel       = target.FindWidgetByName("panel");
            var panelChild1 = target.FindWidgetByName("panelChild");

            Assert.AreEqual(new Vector2(2, 0), panel.Offset);
            Assert.AreEqual(new Vector2(0, 0), panelChild1.Offset);
        }
Пример #16
0
        public void Format_NonStretchedAlignments_SizeToChildren_WhenSizeIsMissing()
        {
            var mockRenderer = new MockRenderer(10, 20);

            mockRenderer.MeasureTextReturn = new Vector2(1, 1);
            var layoutText = @"
                <Grid ContentAlignment=""Left,Top"">
                    <Grid Name=""CheckMe"">
                        <Grid Size=""5,4"" Margin=""1"">
                            <Grid Size=""2,2"">
                            </Grid>
                        </Grid>
                    </Grid>
                </Grid>
                ";
            var target     = (VarmintWidgetGrid)TestUtils.LoadFromText(mockRenderer, layoutText, "(root)");
            var checkMe    = target.FindWidgetByName("CheckMe");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(20, 40));
            Assert.AreEqual(new Vector2(20, 40), target.Size);
            Assert.AreEqual(new Vector2(7, 6), checkMe.Size);
        }
Пример #17
0
        public void Format_Handles_StretchAlignment()
        {
            var layoutText = @"<TestWidget MyAlignment=""Stretch,Stretch"" />";
            var target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");

            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(5, 8), target.Size);
            Assert.AreEqual(new Vector2(0, 0), target.Offset);

            // margins should constrain the stretch
            layoutText = @"<TestWidget MyAlignment=""Stretch,Stretch"" Margin=""1"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(3, 6), target.Size);
            Assert.AreEqual(new Vector2(1, 1), target.Offset);

            layoutText = @"<TestWidget MyAlignment=""Stretch,Stretch"" Margin=""1.5,2"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(2, 4), target.Size);
            Assert.AreEqual(new Vector2(1.5f, 2), target.Offset);

            layoutText = @"<TestWidget MyAlignment=""Stretch,Stretch"" Margin="",,.5"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(new Vector2(4.5f, 8), target.Size);
            Assert.AreEqual(new Vector2(0, 0), target.Offset);

            // Should throw if Size is specified with stretch
            layoutText = @"<TestWidget MyAlignment=""Stretch,Stretch"" Size=""1,1"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            Assert.ThrowsException <ArgumentException>(() => target.UpdateFormatting(new Vector2(5, 8)));

            layoutText = @"<TestWidget MyAlignment="",Stretch"" Size="",1"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            Assert.ThrowsException <ArgumentException>(() => target.UpdateFormatting(new Vector2(5, 8)));

            layoutText = @"<TestWidget MyAlignment=""Stretch,"" Size=""1,"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            Assert.ThrowsException <ArgumentException>(() => target.UpdateFormatting(new Vector2(5, 8)));

            // Specifying no alignment and a size should default to Left or Top
            layoutText = @"<TestWidget MyAlignment="",Stretch"" Size=""1,"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(null, target.MyAlignment.X);
            Assert.AreEqual(Alignment.Stretch, target.MyAlignment.Y);
            Assert.AreEqual(new Vector2(0, 0), target.Offset);

            layoutText = @"<TestWidget MyAlignment=""Stretch,"" Size="",1"" />";
            target     = (TestWidget)TestUtils.LoadFromText(this, layoutText, "(root)");
            target.Prepare(null);
            target.UpdateFormatting(new Vector2(5, 8));
            Assert.AreEqual(Alignment.Stretch, target.MyAlignment.X);
            Assert.AreEqual(null, target.MyAlignment.Y);
            Assert.AreEqual(new Vector2(0, 0), target.Offset);
        }
Пример #18
0
        public void StylingPrecedenceIsEnforced()
        {
            var styleText =
                @"
                <Style
                    Name=""Style1""
                    FooProp=""ShouldNotCrash""
                    Size=""{SizeProperty}""
                    ForegroundColor=""Red""
                >
                    <Style
                        Name=""SubStyle""
                    />
                </Style>";
            var globalStyleText =
                @"
                <Style
                    Name=""Style2""
                    BackgroundColor=""Yellow""
                >
                    <Style
                        ApplyTo=""TestWidget""
                    />
                    <Style
                        ApplyTo=""TW""
                        Margin=""7""
                    />
                </Style>";
            var layoutText =
                @"
                <TestWidget 
                    Style=""SubStyle""
                    ForegroundColor=""Blue""
                >
                    <Label Name=""MyLabel"" BackgroundColor=""Gray"" />
                </TestWidget>";
            var bindToMe = new BindingThing();

            var style       = TestUtils.LoadFromText(this, styleText, "Fooz");
            var globalStyle = TestUtils.LoadFromText(this, globalStyleText, "Freee");
            var target      = TestUtils.LoadFromText(this, layoutText, "StyleTest");

            target.BindingContext = bindToMe;
            var styleLibrary = new Dictionary <string, VarmintWidgetStyle>();

            foreach (var styleItem in style.FindWidgetsByType <VarmintWidgetStyle>())
            {
                styleLibrary.Add(styleItem.Name, styleItem);
            }
            foreach (var styleItem in globalStyle.FindWidgetsByType <VarmintWidgetStyle>())
            {
                styleLibrary.Add(styleItem.Name, styleItem);
            }
            target.Prepare(styleLibrary);

            Assert.AreEqual("StyleTest", target.Name);
            Assert.AreEqual(Color.Blue, target.ForegroundColor);
            Assert.AreEqual(Color.Yellow, target.BackgroundColor);
            Assert.AreEqual(7, target.Margin.Left);
            Assert.AreEqual(new Vector2(2, 3), target.Size);

            var label = target.FindWidgetByName("MyLabel");

            Assert.AreEqual(Color.Gray, label.BackgroundColor);
            // Global style should only apply to certain types
            Assert.AreEqual(null, label.Margin.Left);
        }
Пример #19
0
        public void StackPanel_NormalVerical_StretchedContent_Works()
        {
            var renderer = new MockRenderer(10, 20);

            renderer.MeasureTextReturn = new Vector2(4, 1);

            var layoutText =
                @"<Grid  ContentAlignment=""Left,Top"">
                    <StackPanel>
                        <StackPanel Name=""panel1"" Orientation=""Vertical"" ContentAlignment=""Left,"">
                            <Grid Size=""6,1""  Name=""gridChild1"" />
                            <Label Content=""Hi"" Name=""labelChild1""/>
                        </StackPanel>
                        <StackPanel Name=""panel2"" Orientation=""Vertical"" ContentAlignment=""Center,"">
                            <Grid Size=""6,1""  Name=""gridChild2"" />
                            <Label Content=""Hi"" Name=""labelChild2""/>
                        </StackPanel>
                        <StackPanel Name=""panel3"" Orientation=""Vertical"" ContentAlignment=""Right,"">
                            <Grid Size=""6,1""  Name=""gridChild3"" />
                            <Label Content=""Hi"" Name=""labelChild3""/>
                        </StackPanel>
                    </StackPanel>
                   </Grid>";

            var target = TestUtils.LoadFromText(renderer, layoutText, "Target");

            target.Prepare(new Dictionary <string, VarmintWidgetStyle>());
            target.UpdateFormatting(renderer.ScreenSize);


            var panel      = target.FindWidgetByName("panel1");
            var gridChild  = target.FindWidgetByName("gridChild1");
            var labelChild = target.FindWidgetByName("labelChild1");

            // Should size to children
            Assert.AreEqual(new Vector2(6, 2), panel.Size);
            Assert.AreEqual(new Vector2(0, 0), panel.Offset);

            // children should have correct size and offset
            Assert.AreEqual(new Vector2(6, 1), gridChild.Size);
            Assert.AreEqual(new Vector2(0, 0), gridChild.Offset);
            Assert.AreEqual(new Vector2(4, 1), labelChild.Size);
            Assert.AreEqual(new Vector2(0, 1), labelChild.Offset);


            panel      = target.FindWidgetByName("panel2");
            gridChild  = target.FindWidgetByName("gridChild2");
            labelChild = target.FindWidgetByName("labelChild2");

            // Should size to children
            Assert.AreEqual(new Vector2(6, 2), panel.Size);
            Assert.AreEqual(new Vector2(0, 2), panel.Offset);

            // children should have correct size and offset
            Assert.AreEqual(new Vector2(6, 1), gridChild.Size);
            Assert.AreEqual(new Vector2(0, 0), gridChild.Offset);
            Assert.AreEqual(new Vector2(4, 1), labelChild.Size);
            Assert.AreEqual(new Vector2(1, 1), labelChild.Offset);


            panel      = target.FindWidgetByName("panel3");
            gridChild  = target.FindWidgetByName("gridChild3");
            labelChild = target.FindWidgetByName("labelChild3");

            // Should size to children
            Assert.AreEqual(new Vector2(6, 2), panel.Size);
            Assert.AreEqual(new Vector2(0, 4), panel.Offset);

            // children should have correct size and offset
            Assert.AreEqual(new Vector2(6, 1), gridChild.Size);
            Assert.AreEqual(new Vector2(0, 0), gridChild.Offset);
            Assert.AreEqual(new Vector2(4, 1), labelChild.Size);
            Assert.AreEqual(new Vector2(2, 1), labelChild.Offset);
        }