Ejemplo n.º 1
0
        public void CanvasDrawsDrawable()
        {
            using (var drawable = new TestDrawable())
                using (var bmp = new SKBitmap(100, 100))
                    using (var canvas = new SKCanvas(bmp))
                    {
                        canvas.DrawDrawable(drawable, 0, 0);

                        Assert.Equal(SKColors.Blue, bmp.GetPixel(50, 50));
                    }
        }
Ejemplo n.º 2
0
        public void CanInstantiateDrawable()
        {
            using (var drawable = new TestDrawable())
            {
                Assert.Equal(SKRect.Create(100, 100), drawable.Bounds);
                Assert.Equal(1, drawable.BoundsFireCount);

                using (var bmp = new SKBitmap(100, 100))
                    using (var canvas = new SKCanvas(bmp))
                    {
                        drawable.Draw(canvas, 0, 0);
                        Assert.Equal(1, drawable.DrawFireCount);

                        canvas.DrawDrawable(drawable, 0, 0);
                        Assert.Equal(2, drawable.DrawFireCount);
                    }

                var picture = drawable.Snapshot();
                Assert.NotNull(picture);
                Assert.Equal(1, drawable.SnapshotFireCount);
            }
        }