Esempio n. 1
0
        public void RectIteratorHasCorrectRects()
        {
            var rectA = SKRectI.Create(10, 10, 100, 100);
            var rectB = SKRectI.Create(50, 50, 100, 100);

            using var region = new SKRegion(rectA);
            region.Op(rectB, SKRegionOperation.Union);

            using var iterator = region.CreateRectIterator();

            Assert.True(iterator.Next(out var rect));
            Assert.Equal(SKRectI.Create(10, 10, 100, 40), rect);

            Assert.True(iterator.Next(out rect));
            Assert.Equal(SKRectI.Create(10, 50, 140, 60), rect);

            Assert.True(iterator.Next(out rect));
            Assert.Equal(SKRectI.Create(50, 110, 100, 40), rect);

            Assert.False(iterator.Next(out rect));
            Assert.Equal(SKRect.Empty, rect);

            Assert.False(iterator.Next(out rect));
            Assert.Equal(SKRect.Empty, rect);
        }
Esempio n. 2
0
        public void RectIteratorHasCorrectRectsForEmpty()
        {
            using var region = new SKRegion();

            using var iterator = region.CreateRectIterator();

            Assert.False(iterator.Next(out var rect));
            Assert.Equal(SKRect.Empty, rect);

            Assert.False(iterator.Next(out rect));
            Assert.Equal(SKRect.Empty, rect);
        }