Esempio n. 1
0
        public void stretch_vertically()
        {
            var size = LayoutSize.StretchedVertically(30);

            size.IsFixedAspectRatio().Should().BeFalse();
            size.IsMeasurableAlong(Orientation.Horizontal).Should().BeTrue();
            size.IsMeasurableAlong(Orientation.Vertical).Should().BeFalse();
            size.IsStretchedAlong(Orientation.Vertical).Should().BeTrue();
            size.IsStretchedPerpendicular(Orientation.Vertical).Should().BeFalse();
        }
Esempio n. 2
0
        public void spacer_test()
        {
            var layout = LayoutNode.HorizontalParent("root", LayoutSize.Pixels(50, 20), LayoutStyle.Empty,
                                                     LayoutNode.StretchedSpacer(),
                                                     LayoutNode.Leaf("nudged-item", LayoutSize.StretchedVertically(10)),
                                                     LayoutNode.Spacer(5)
                                                     );

            var firstBakeResult = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(firstBakeResult));
        }
Esempio n. 3
0
        public void fixed_aspect_no_spacers()
        {
            var layout = LayoutNode.VerticalParent("root", LayoutSize.Pixels(36, 64), LayoutStyle.Empty,
                                                   LayoutNode.HorizontalParent("fixed-aspect", LayoutSize.FixedAspectRatio(16, 9), new LayoutStyle(margin: new Point(3, 3)),
                                                                               LayoutNode.Leaf("tall-item", LayoutSize.StretchedVertically(15))
                                                                               )
                                                   );

            var firstBakeResult  = layout.Bake();                                        // wide in tall
            var secondBakeResult = layout.RootNode.GetResized(new Point(64, 36)).Bake(); // wide in wide (perfect match)
            var thirdBakeResult  = layout.RootNode.GetResized(new Point(100, 36)).Bake();

            Approvals.Verify(
                LayoutNodeUtils.DrawResult(firstBakeResult)
                + "\n\n" +
                LayoutNodeUtils.DrawResult(secondBakeResult)
                + "\n\n" +
                LayoutNodeUtils.DrawResult(thirdBakeResult)
                );
        }
Esempio n. 4
0
        public void vertical_stretch_test()
        {
            var layout = LayoutNode.VerticalParent("root", LayoutSize.Pixels(50, 80), LayoutStyle.Empty,
                                                   LayoutNode.HorizontalParent("group-1", LayoutSize.Pixels(50, 20), new LayoutStyle(margin: new Point(3, 3)),
                                                                               LayoutNode.Leaf("tall-item", LayoutSize.StretchedVertically(15)),
                                                                               LayoutNode.Leaf("both-item", LayoutSize.StretchedBoth())
                                                                               ),
                                                   LayoutNode.StretchedSpacer(),
                                                   LayoutNode.VerticalParent("group-2", LayoutSize.Pixels(50, 20), new LayoutStyle(margin: new Point(3, 3)),
                                                                             LayoutNode.Leaf("tall-item-2", LayoutSize.StretchedVertically(15)),
                                                                             LayoutNode.Leaf("both-item-2", LayoutSize.StretchedBoth())
                                                                             )
                                                   );

            var firstBakeResult = layout.Bake();

            Approvals.Verify(LayoutNodeUtils.DrawResult(firstBakeResult));
        }