Esempio n. 1
0
        public void PopUpsHaveHighestPriorityInHitTestZOrder()
        {
            var popUp1 = new PopUp <IWidget>(LayoutTestStyle.Create())
            {
                Padding = new Insets(10), Content = LayoutTestWidget.FixedSize(500, 300)
            };

            popUp1.Anchor = AnchoredRect.CreateTopLeftAnchored(10, 20);

            var popUp2 = new PopUp <IWidget>(LayoutTestStyle.Create())
            {
                Padding = new Insets(10), Content = LayoutTestWidget.FixedSize(500, 300)
            };

            popUp2.Anchor = AnchoredRect.CreateTopLeftAnchored(10, 20);

            var screen = Substitute.For <IScreenService>();

            var root = new RootPane(screen, LayoutTestStyle.Create());

            root.UIStyle.StyleResolver.AddRoot(root);
            root.Content = LayoutTestWidget.FixedSize(400, 400).WithAnchorRect(AnchoredRect.Full);
            root.AddPopUp(popUp1);
            root.AddPopUp(popUp2);

            root.Arrange(new Rectangle(0, 0, 1270, 770));

            root.Content.PerformHitTest(new Point(100, 100)).ShouldBeSameObjectReference(root.Content);
            popUp1.PerformHitTest(new Point(100, 100)).ShouldBeSameObjectReference(popUp1.Content);
            popUp2.PerformHitTest(new Point(100, 100)).ShouldBeSameObjectReference(popUp2.Content);
            root.PerformHitTest(new Point(100, 100)).ShouldBeSameObjectReference(popUp2.Content);
        }
Esempio n. 2
0
        public void PopUpLayoutTest()
        {
            var p = new PopUp <IWidget>(LayoutTestStyle.Create())
            {
                Padding = new Insets(10), Content = LayoutTestWidget.FixedSize(500, 300)
            };

            p.Anchor = AnchoredRect.CreateTopLeftAnchored(10, 20);

            var screen = Substitute.For <IScreenService>();

            var root = new RootPane(screen, LayoutTestStyle.Create());

            root.UIStyle.StyleResolver.AddRoot(root);
            root.AddPopUp(p);

            root.Arrange(new Rectangle(0, 0, 1270, 770));

            p.LayoutRect.Should().Be(new Rectangle(10, 20, 520, 320));
        }