123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- using PixiEditor.Models.DataHolders;
- using PixiEditor.Models.Layers;
- using PixiEditor.Models.Position;
- using SkiaSharp;
- using Xunit;
- namespace PixiEditorTests.ModelsTests.LayersTests
- {
- public class LayerTests
- {
- //[Fact]
- //public void TestThatEmptyLayerGeneratesCorrectly()
- //{
- // Layer layer = new Layer("layer");
- // Assert.Equal("layer", layer.Name);
- // Assert.Equal(1, layer.Width);
- // Assert.Equal(1, layer.Height);
- // Assert.Equal(1, layer.LayerBitmap.Width);
- // Assert.Equal(1, layer.LayerBitmap.Height);
- //}
- //[Fact]
- //public void TestThatEmptyLayerWithSizeGeneratesCorrectly()
- //{
- // Layer layer = new Layer("layer", 10, 10);
- // Assert.Equal("layer", layer.Name);
- // Assert.Equal(10, layer.Width);
- // Assert.Equal(10, layer.Height);
- // Assert.Equal(10, layer.LayerBitmap.Width);
- // Assert.Equal(10, layer.LayerBitmap.Height);
- //}
- //[Fact]
- //public void TestThatLayerFromBitmapGeneratesCorrectly()
- //{
- // using Surface bmp = new Surface(10, 10);
- // Layer layer = new Layer("layer", bmp);
- // Assert.Equal("layer", layer.Name);
- // Assert.Equal(10, layer.Width);
- // Assert.Equal(10, layer.Height);
- // Assert.Equal(10, layer.LayerBitmap.Width);
- // Assert.Equal(10, layer.LayerBitmap.Height);
- //}
- //[Fact]
- //public void TestThatCloneClonesCorrectly()
- //{
- // Layer layer = new Layer("test", 5, 2);
- // Layer clone = layer.Clone();
- // LayersTestHelper.LayersAreEqual(layer, clone);
- //}
- //[Fact]
- //public void TestThatCloneIsMakingDeepCopyOfBitmap()
- //{
- // Layer layer = new Layer("test", 5, 2);
- // Layer clone = layer.Clone();
- // clone.LayerBitmap.SetSRGBPixel(0, 0, SKColors.Lime); // Actually we are checking if modifying clone bitmap does not affect original
- // Assert.NotEqual(SKColors.Lime, layer.GetPixel(0, 0));
- //}
- //[Fact]
- //public void TestThatResizeResizesBitmap()
- //{
- // Layer layer = new Layer("layer", 1, 1);
- // layer.SetPixel(new Coordinates(0, 0), SKColors.Black);
- // layer.Resize(2, 2, 2, 2);
- // Assert.Equal(2, layer.Width);
- // Assert.Equal(2, layer.Height);
- // Assert.Equal(2, layer.MaxWidth);
- // Assert.Equal(2, layer.MaxHeight);
- // // 4 is new area of bitmap
- // for (int y = 0; y < layer.Height; y++)
- // {
- // for (int x = 0; x < layer.Width; x++)
- // {
- // Assert.Equal(SKColors.Black, layer.GetPixel(x, y));
- // }
- // }
- //}
- //[Fact]
- //public void TestThatGetPixelReturnsTransparentIfOutOfBounds()
- //{
- // Layer layer = new Layer("layer");
- // Assert.Equal(0, layer.GetPixel(-1, 999).Alpha);
- //}
- //[Fact]
- //public void TestThatSetPixelsSetsPixels() // This also tests if Dynamic Resize works
- //{
- // Coordinates[] pixels = { new Coordinates(4, 2), new Coordinates(0, 0), new Coordinates(15, 2) };
- // Layer layer = new Layer("layer");
- // layer.SetPixels(BitmapPixelChanges.FromSingleColoredArray(pixels, SKColors.Lime));
- // for (int i = 0; i < pixels.Length; i++)
- // {
- // Assert.Equal(SKColors.Lime, layer.GetPixelWithOffset(pixels[i].X, pixels[i].Y));
- // }
- //}
- //[Fact]
- //public void TestThatClipCanvasResizesBitmapCorrectly()
- //{
- // Layer layer = new Layer("layer", 10, 10);
- // layer.SetPixel(new Coordinates(4, 4), SKColors.Blue);
- // layer.ClipCanvas();
- // Assert.Equal(1, layer.Width);
- // Assert.Equal(1, layer.Height);
- // Assert.Equal(SKColors.Blue, layer.GetPixel(0, 0));
- //}
- }
- }
|