コード例 #1
0
        public void TestStartHiddenNested(bool startHidden, bool immediatelyVisible)
        {
            TestNestedVisibilityContainer visibility = null;

            AddStep("create container", () =>
            {
                Child          = testContainer =
                    visibility = new TestNestedVisibilityContainer(startHidden)
                {
                    State = { Value = immediatelyVisible ? Visibility.Visible : Visibility.Hidden }
                };

                if (!immediatelyVisible)
                {
                    testContainer.Show();
                }
            });

            checkVisible(!startHidden);

            AddAssert("box has transforms", () => visibility.BoxHasTransforms);
            AddStep("hide", () => testContainer.Hide());

            checkHidden();
            AddAssert("box doesn't have transforms", () => !visibility.BoxHasTransforms);

            AddAssert("fire count is 2", () => testContainer.FireCount == 2);
        }
コード例 #2
0
        public void TestNotStartHiddenButHidden()
        {
            AddStep("create container", () => Child = testContainer =
                        new TestVisibilityContainer(false)
            {
                State = { Value = Visibility.Hidden }
            });

            AddAssert("alpha above zero", () => testContainer.Alpha > 0);

            checkHidden(false);
        }
コード例 #3
0
        public void TestShowHide()
        {
            AddStep("create container", () => Child = testContainer = new TestVisibilityContainer());

            checkHidden(true);

            AddStep("show", () => testContainer.Show());
            checkVisible();

            AddStep("hide", () => testContainer.Hide());
            checkHidden();

            AddAssert("fire count is 2", () => testContainer.FireCount == 2);
        }
コード例 #4
0
            public TestNestedVisibilityContainer(bool startHidden = true)
                : base(startHidden)
            {
                Add(nested = new TestVisibilityContainer(true, Color4.Yellow));

                nested.Add(box = new Box
                {
                    Colour           = Color4.Black,
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Size             = new Vector2(0.5f),
                });
            }
コード例 #5
0
        public void TestStartHidden(bool startHidden)
        {
            AddStep("create container", () => Child = testContainer =
                        new TestVisibilityContainer(startHidden)
            {
                State = { Value = Visibility.Visible }
            });

            checkVisible(!startHidden);

            AddStep("hide", () => testContainer.Hide());
            checkHidden();

            AddAssert("fire count is 2", () => testContainer.FireCount == 2);
        }
コード例 #6
0
        public void TestShowInCtor()
        {
            AddStep("create container", () =>
            {
                var container = new TestVisibilityContainer(null);
                container.Show();

                var containingContainer = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = testContainer = container
                };

                containingContainer.OnLoadComplete += _ => testContainer.Hide();

                Child = containingContainer;
            });

            checkHidden();
        }