Esempio n. 1
0
        private void PerformTopToBottomStackTest()
        {
            var stackingContainer = TestScreen.GetGraphicalUiElementByName("TopToBottomStackTest");

            var firstChild  = stackingContainer.Children[0] as GraphicalUiElement;
            var secondChild = stackingContainer.Children[1] as GraphicalUiElement;
            // first make sure the children are stacked correctly:
            var firstAbsolute  = firstChild.AbsoluteY;
            var secondAbsolute = secondChild.AbsoluteY;

            secondAbsolute.ShouldBe(firstAbsolute + firstChild.GetAbsoluteHeight());

            // now shift the first child down
            firstChild.Y += 64;

            firstAbsolute  = firstChild.AbsoluteY;
            secondAbsolute = secondChild.AbsoluteY;

            secondAbsolute.ShouldBe(firstAbsolute + firstChild.GetAbsoluteHeight());

            var lastChildBeforeDynamicallyAdded = stackingContainer.Children.Last() as GraphicalUiElement;

            // Add objects dynamically and see if they stack properly too
            var newNineSlice = new NineSliceRuntime();

            newNineSlice.Parent = stackingContainer;

            newNineSlice.AbsoluteY.ShouldBeGreaterThan(lastChildBeforeDynamicallyAdded.AbsoluteY, "because newly-added children of a stack panel should be positioned at the end of the stack");

            float lastAbsoluteYBeforeMove = newNineSlice.AbsoluteY;

            firstChild.Y += 64;
            newNineSlice.AbsoluteY.ShouldBeGreaterThan(lastAbsoluteYBeforeMove, "because moving the first child in a stack should also move dynamically-added children of the stack");
        }
Esempio n. 2
0
        private void PerformDependsOnChildrenTest()
        {
            // This control has children which have widths that depend on the parent, so they have dependent units on the X axis, not Y axis. The stack panel should still
            // auto-size itself based on the heights of the children.
            var stackPanel = TestScreen.GetGraphicalUiElementByName("StackWithChildrenWidthDependsOnParent");

            stackPanel.GetAbsoluteHeight().ShouldNotBe(0, "because the height of the container should be set even though the the width of the contained nine slice depends on its parent.");
        }
Esempio n. 3
0
        private void PerformDynamicParentAssignmentTest()
        {
            var circle = new GumRuntimes.CircleRuntime();

            circle.Parent = TestScreen.GetGraphicalUiElementByName("ContainerInstance") as GraphicalUiElement;
        }