예제 #1
0
파일: When_Shape.cs 프로젝트: jokm1/uno-2
        public async Task When_Shape_Stretch_UniformToFill()
        {
            var topLevelGrid = new Grid();

            var grid = new Grid()
            {
                Width = 200, Height = 100
            };

            topLevelGrid.Children.Add(grid);

            var SUT = new Path()
            {
                Stretch = Stretch.Uniform
            };

            grid.Children.Add(SUT);

            var g   = new PathGeometry();
            var fig = new PathFigure()
            {
                StartPoint = new Point(50, 50)
            };
            var arc = new ArcSegment()
            {
                Size           = new Size(50, 50),
                RotationAngle  = 45,
                IsLargeArc     = false,
                SweepDirection = SweepDirection.Clockwise,
                Point          = new Point(70, 70)
            };

            fig.Segments.Add(arc);
            g.Figures.Add(fig);
            SUT.Data = g;

            TestServices.WindowHelper.WindowContent = topLevelGrid;
            await TestServices.WindowHelper.WaitForIdle();

            Assert.IsTrue(MathEx.ApproxEqual(50, SUT.LayoutSlotWithMarginsAndAlignments.X, 1E-3));
            Assert.IsTrue(MathEx.ApproxEqual(0, SUT.LayoutSlotWithMarginsAndAlignments.Y, 1E-3));
            Assert.IsTrue(MathEx.ApproxEqual(100, SUT.LayoutSlotWithMarginsAndAlignments.Width, 1E-3));
            Assert.IsTrue(MathEx.ApproxEqual(100, SUT.LayoutSlotWithMarginsAndAlignments.Height, 1E-3));
        }