Browse Source

Fix more tests, fix flabbet's fixes

Equbuxu 3 years ago
parent
commit
ec6231bc11

+ 1 - 1
PixiEditor/Models/IO/Exporter.cs

@@ -100,7 +100,7 @@ namespace PixiEditor.Models.IO
         /// <param name="exportWidth">File width.</param>
         /// <param name="exportWidth">File width.</param>
         /// <param name="exportHeight">File height.</param>
         /// <param name="exportHeight">File height.</param>
         /// <param name="bitmap">Bitmap to save.</param>
         /// <param name="bitmap">Bitmap to save.</param>
-        private static void SaveAsPng(string savePath, int exportWidth, int exportHeight, WriteableBitmap bitmap)
+        public static void SaveAsPng(string savePath, int exportWidth, int exportHeight, WriteableBitmap bitmap)
         {
         {
             try
             try
             {
             {

+ 7 - 17
PixiEditorTests/ModelsTests/ColorsTests/ExtendedColorTests.cs

@@ -1,36 +1,26 @@
-using System;
-using System.Windows.Media;
-using PixiEditor.Models.Colors;
+using PixiEditor.Models.Colors;
 using SkiaSharp;
 using SkiaSharp;
+using System;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ColorsTests
 namespace PixiEditorTests.ModelsTests.ColorsTests
 {
 {
     public class ExtendedColorTests
     public class ExtendedColorTests
     {
     {
-
-        public static readonly SKColor white = new SKColor(255, 255, 255);
-        public static readonly SKColor black = new SKColor(0, 0, 0);
-        public static readonly SKColor transparent = new SKColor(0, 0, 0, 0);
-        public static readonly SKColor red = new SKColor(255, 0, 0);
-        public static readonly SKColor green = new SKColor(0, 255, 0);
-        public static readonly SKColor blue = new SKColor(0, 0, 255);
-
         private const int AcceptableMaringOfError = 1;
         private const int AcceptableMaringOfError = 1;
 
 
-
         [Fact]
         [Fact]
         public void ChangeColorBrightnessIsNotTheSameTest()
         public void ChangeColorBrightnessIsNotTheSameTest()
         {
         {
-            SKColor newColor = ExColor.ChangeColorBrightness(white, -1);
-            Assert.NotEqual(white, newColor);
+            SKColor newColor = ExColor.ChangeColorBrightness(SKColors.White, -1);
+            Assert.NotEqual(SKColors.White, newColor);
         }
         }
 
 
         [Fact]
         [Fact]
         public void ChangeColorBrightnessNewValueTest()
         public void ChangeColorBrightnessNewValueTest()
         {
         {
-            SKColor newColor = ExColor.ChangeColorBrightness(white, -100);
-            Assert.Equal(black, newColor);
+            SKColor newColor = ExColor.ChangeColorBrightness(SKColors.White, -100);
+            Assert.Equal(SKColors.Black, newColor);
         }
         }
 
 
         // Acceptable margin of error is 1
         // Acceptable margin of error is 1
@@ -68,4 +58,4 @@ namespace PixiEditorTests.ModelsTests.ColorsTests
             Assert.True(marginOfErrorB <= AcceptableMaringOfError);
             Assert.True(marginOfErrorB <= AcceptableMaringOfError);
         }
         }
     }
     }
-}
+}

+ 5 - 8
PixiEditorTests/ModelsTests/ControllersTests/BitmapManagerTests.cs

@@ -1,10 +1,7 @@
-using System.Windows.Media;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools;
-using PixiEditor.Models.Undo;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ControllersTests
 namespace PixiEditorTests.ModelsTests.ControllersTests
@@ -84,7 +81,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             bitmapManager.ActiveDocument.AddNewLayer("Layer");
             bitmapManager.ActiveDocument.AddNewLayer("Layer");
             bitmapManager.SetActiveTool(new MockedSinglePixelPenTool());
             bitmapManager.SetActiveTool(new MockedSinglePixelPenTool());
-            bitmapManager.PrimaryColor = ExtendedColorTests.black;
+            bitmapManager.PrimaryColor = SKColors.Black;
 
 
             bitmapManager.MouseController.StartRecordingMouseMovementChanges(true);
             bitmapManager.MouseController.StartRecordingMouseMovementChanges(true);
             bitmapManager.MouseController.RecordMouseMovementChange(new Coordinates(1, 1));
             bitmapManager.MouseController.RecordMouseMovementChange(new Coordinates(1, 1));
@@ -92,7 +89,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             bitmapManager.ExecuteTool(new Coordinates(1, 1), true);
             bitmapManager.ExecuteTool(new Coordinates(1, 1), true);
 
 
-            Assert.Equal(ExtendedColorTests.black, bitmapManager.ActiveLayer.GetPixelWithOffset(1, 1));
+            Assert.Equal(SKColors.Black, bitmapManager.ActiveLayer.GetPixelWithOffset(1, 1));
         }
         }
     }
     }
-}
+}

+ 7 - 8
PixiEditorTests/ModelsTests/ControllersTests/BitmapOperationsUtilityTests.cs

@@ -1,10 +1,9 @@
-using System.Collections.Generic;
-using System.Windows.Media;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
+using System.Collections.Generic;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ControllersTests
 namespace PixiEditorTests.ModelsTests.ControllersTests
@@ -19,7 +18,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             Layer testLayer = new Layer("test layer", 10, 10);
             Layer testLayer = new Layer("test layer", 10, 10);
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
-            BitmapPixelChanges pixels = BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.black);
+            BitmapPixelChanges pixels = BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black);
             testLayer.SetPixels(pixels);
             testLayer.SetPixels(pixels);
 
 
             util.DeletePixels(new[] { testLayer }, cords);
             util.DeletePixels(new[] { testLayer }, cords);
@@ -34,7 +33,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
             BitmapManager manager = new BitmapManager
             BitmapManager manager = new BitmapManager
             {
             {
                 ActiveDocument = new Document(10, 10),
                 ActiveDocument = new Document(10, 10),
-                PrimaryColor = ExtendedColorTests.black
+                PrimaryColor = SKColors.Black
             };
             };
             manager.ActiveDocument.AddNewLayer("Test layer", 10, 10);
             manager.ActiveDocument.AddNewLayer("Test layer", 10, 10);
 
 
@@ -43,7 +42,7 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
             List<Coordinates> mouseMove = new List<Coordinates>(new[] { new Coordinates(0, 0) });
             List<Coordinates> mouseMove = new List<Coordinates>(new[] { new Coordinates(0, 0) });
 
 
             util.ExecuteTool(new Coordinates(0, 0), mouseMove, new MockedSinglePixelPenTool());
             util.ExecuteTool(new Coordinates(0, 0), mouseMove, new MockedSinglePixelPenTool());
-            Assert.Equal(manager.ActiveLayer.GetPixel(0, 0), ExtendedColorTests.black);
+            Assert.Equal(manager.ActiveLayer.GetPixel(0, 0), SKColors.Black);
         }
         }
     }
     }
-}
+}

+ 10 - 11
PixiEditorTests/ModelsTests/ControllersTests/PixelChangesControllerTests.cs

@@ -1,9 +1,8 @@
-using System;
-using System.Windows.Media;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
+using System;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ControllersTests
 namespace PixiEditorTests.ModelsTests.ControllersTests
@@ -30,8 +29,8 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             controller.AddChanges(
             controller.AddChanges(
                 new LayerChange(
                 new LayerChange(
-                    BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.black), guid),
-                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.transparent), guid));
+                    BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black), guid),
+                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Transparent), guid));
 
 
             System.Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
             System.Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
             Assert.Equal(2, changes.Length);
             Assert.Equal(2, changes.Length);
@@ -46,8 +45,8 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             controller.AddChanges(
             controller.AddChanges(
                 new LayerChange(
                 new LayerChange(
-                    BitmapPixelChanges.FromSingleColoredArray(cords2, ExtendedColorTests.black), data.Item1),
-                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords2, ExtendedColorTests.transparent), data.Item1));
+                    BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Black), data.Item1),
+                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Transparent), data.Item1));
 
 
             Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
             Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
             Assert.Single(changes);
             Assert.Single(changes);
@@ -64,9 +63,9 @@ namespace PixiEditorTests.ModelsTests.ControllersTests
 
 
             controller.AddChanges(
             controller.AddChanges(
                 new LayerChange(
                 new LayerChange(
-                    BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.black), guid),
-                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.transparent), guid));
+                    BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black), guid),
+                new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Transparent), guid));
             return new Tuple<Guid, PixelChangesController>(guid, controller);
             return new Tuple<Guid, PixelChangesController>(guid, controller);
         }
         }
     }
     }
-}
+}

+ 11 - 13
PixiEditorTests/ModelsTests/DataHoldersTests/BitmapPixelChangesTests.cs

@@ -1,8 +1,6 @@
-using System.Windows.Media;
-using PixiEditor.Exceptions;
+using PixiEditor.Exceptions;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
 using SkiaSharp;
 using SkiaSharp;
 using Xunit;
 using Xunit;
 
 
@@ -14,9 +12,9 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
         public void TestThatFromSingleColoredArrayCreatesCorrectArray()
         public void TestThatFromSingleColoredArrayCreatesCorrectArray()
         {
         {
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 0), new Coordinates(3, 2) };
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 0), new Coordinates(3, 2) };
-            BitmapPixelChanges bmpChanges = BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.green);
+            BitmapPixelChanges bmpChanges = BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Lime);
 
 
-            Assert.All(bmpChanges.ChangedPixels.Values, changeColor => Assert.Equal(ExtendedColorTests.green, changeColor));
+            Assert.All(bmpChanges.ChangedPixels.Values, changeColor => Assert.Equal(SKColors.Lime, changeColor));
             Assert.True(bmpChanges.WasBuiltAsSingleColored);
             Assert.True(bmpChanges.WasBuiltAsSingleColored);
         }
         }
 
 
@@ -25,28 +23,28 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
         {
         {
             Coordinates[] cords1 = { new Coordinates(0, 0), new Coordinates(1, 0), new Coordinates(3, 2) };
             Coordinates[] cords1 = { new Coordinates(0, 0), new Coordinates(1, 0), new Coordinates(3, 2) };
             Coordinates[] cords2 = { new Coordinates(3, 2), new Coordinates(0, 0), new Coordinates(5, 5) };
             Coordinates[] cords2 = { new Coordinates(3, 2), new Coordinates(0, 0), new Coordinates(5, 5) };
-            BitmapPixelChanges changes = BitmapPixelChanges.FromSingleColoredArray(cords1, ExtendedColorTests.green);
-            BitmapPixelChanges changes2 = BitmapPixelChanges.FromSingleColoredArray(cords2, ExtendedColorTests.red);
+            BitmapPixelChanges changes = BitmapPixelChanges.FromSingleColoredArray(cords1, SKColors.Lime);
+            BitmapPixelChanges changes2 = BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Red);
 
 
             BitmapPixelChanges output = BitmapPixelChanges.CombineOverride(new[] { changes, changes2 });
             BitmapPixelChanges output = BitmapPixelChanges.CombineOverride(new[] { changes, changes2 });
             Assert.Equal(4, output.ChangedPixels.Count);
             Assert.Equal(4, output.ChangedPixels.Count);
-            Assert.Equal(ExtendedColorTests.red, output.ChangedPixels[new Coordinates(3, 2)]);
-            Assert.Equal(ExtendedColorTests.black, output.ChangedPixels[new Coordinates(0, 0)]);
-            Assert.Equal(ExtendedColorTests.green, output.ChangedPixels[new Coordinates(1, 0)]);
+            Assert.Equal(SKColors.Red, output.ChangedPixels[new Coordinates(3, 2)]);
+            Assert.Equal(SKColors.Black, output.ChangedPixels[new Coordinates(0, 0)]);
+            Assert.Equal(SKColors.Lime, output.ChangedPixels[new Coordinates(1, 0)]);
         }
         }
 
 
         [Fact]
         [Fact]
         public void TestThatFromArraysThrowsError()
         public void TestThatFromArraysThrowsError()
         {
         {
             Assert.Throws<ArrayLengthMismatchException>(
             Assert.Throws<ArrayLengthMismatchException>(
-                () => BitmapPixelChanges.FromArrays(new[] { new Coordinates(0, 0) }, new[] { ExtendedColorTests.red, ExtendedColorTests.green }));
+                () => BitmapPixelChanges.FromArrays(new[] { new Coordinates(0, 0) }, new[] { SKColors.Red, SKColors.Lime }));
         }
         }
 
 
         [Fact]
         [Fact]
         public void TestThatFormArraysWorks()
         public void TestThatFormArraysWorks()
         {
         {
             Coordinates[] coordinatesArray = { new Coordinates(0, 0), new Coordinates(2, 3), new Coordinates(5, 5) };
             Coordinates[] coordinatesArray = { new Coordinates(0, 0), new Coordinates(2, 3), new Coordinates(5, 5) };
-            SKColor[] colorsArray = { ExtendedColorTests.red, ExtendedColorTests.green, ExtendedColorTests.blue };
+            SKColor[] colorsArray = { SKColors.Red, SKColors.Lime, SKColors.Blue };
             BitmapPixelChanges result = BitmapPixelChanges.FromArrays(coordinatesArray, colorsArray);
             BitmapPixelChanges result = BitmapPixelChanges.FromArrays(coordinatesArray, colorsArray);
             for (int i = 0; i < coordinatesArray.Length; i++)
             for (int i = 0; i < coordinatesArray.Length; i++)
             {
             {
@@ -57,4 +55,4 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             Assert.False(result.WasBuiltAsSingleColored);
             Assert.False(result.WasBuiltAsSingleColored);
         }
         }
     }
     }
-}
+}

+ 13 - 14
PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs

@@ -1,13 +1,12 @@
-using System;
-using System.Windows.Media;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Enums;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using PixiEditor.ViewModels;
 using PixiEditor.ViewModels;
 using PixiEditorTests.HelpersTests;
 using PixiEditorTests.HelpersTests;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
+using System;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.DataHoldersTests
 namespace PixiEditorTests.ModelsTests.DataHoldersTests
@@ -55,9 +54,9 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             manager.ActiveLayer.SetPixel(
             manager.ActiveLayer.SetPixel(
                 new Coordinates(
                 new Coordinates(
                 (int)Math.Ceiling(initialWidth / 2f),
                 (int)Math.Ceiling(initialWidth / 2f),
-                (int)Math.Ceiling(initialHeight / 2f)), ExtendedColorTests.black);
+                (int)Math.Ceiling(initialHeight / 2f)), SKColors.Black);
 
 
-            manager.ActiveLayer.SetPixel(new Coordinates(additionalPixelX, additionalPixelY), ExtendedColorTests.black);
+            manager.ActiveLayer.SetPixel(new Coordinates(additionalPixelX, additionalPixelY), SKColors.Black);
 
 
             document.ClipCanvas();
             document.ClipCanvas();
 
 
@@ -81,11 +80,11 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             manager.ActiveLayer.SetPixel(
             manager.ActiveLayer.SetPixel(
                 new Coordinates(
                 new Coordinates(
                 (int)Math.Ceiling(initialWidth / 2f),
                 (int)Math.Ceiling(initialWidth / 2f),
-                (int)Math.Ceiling(initialHeight / 2f)), ExtendedColorTests.black); // Set pixel in center
+                (int)Math.Ceiling(initialHeight / 2f)), SKColors.Black); // Set pixel in center
 
 
             manager.ActiveDocument.AddNewLayer("test2");
             manager.ActiveDocument.AddNewLayer("test2");
 
 
-            manager.ActiveLayer.SetPixel(new Coordinates(secondLayerPixelX, secondLayerPixelY), ExtendedColorTests.black);
+            manager.ActiveLayer.SetPixel(new Coordinates(secondLayerPixelX, secondLayerPixelY), SKColors.Black);
 
 
             document.ClipCanvas();
             document.ClipCanvas();
 
 
@@ -114,7 +113,7 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             };
             };
             manager.ActiveDocument.AddNewLayer("test");
             manager.ActiveDocument.AddNewLayer("test");
 
 
-            manager.ActiveLayer.SetPixel(new Coordinates(0, 0), ExtendedColorTests.green);
+            manager.ActiveLayer.SetPixel(new Coordinates(0, 0), SKColors.Lime);
 
 
             doc.CenterContent();
             doc.CenterContent();
 
 
@@ -134,10 +133,10 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
                 ActiveDocument = doc
                 ActiveDocument = doc
             };
             };
             manager.ActiveDocument.AddNewLayer("test");
             manager.ActiveDocument.AddNewLayer("test");
-            manager.ActiveLayer.SetPixel(new Coordinates(0, 0), ExtendedColorTests.green);
+            manager.ActiveLayer.SetPixel(new Coordinates(0, 0), SKColors.Lime);
 
 
             manager.ActiveDocument.AddNewLayer("test2");
             manager.ActiveDocument.AddNewLayer("test2");
-            manager.ActiveLayer.SetPixel(new Coordinates(1, 1), ExtendedColorTests.green);
+            manager.ActiveLayer.SetPixel(new Coordinates(1, 1), SKColors.Lime);
 
 
             foreach (var layer in manager.ActiveDocument.Layers)
             foreach (var layer in manager.ActiveDocument.Layers)
             {
             {
@@ -322,7 +321,7 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
         {
         {
             const string layerName = "New Layer";
             const string layerName = "New Layer";
 
 
-            Document document = new (10, 10);
+            Document document = new(10, 10);
 
 
             document.AddNewLayer(layerName);
             document.AddNewLayer(layerName);
             Layer duplicate = document.DuplicateLayer(0);
             Layer duplicate = document.DuplicateLayer(0);
@@ -337,7 +336,7 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
         {
         {
             const string layerName = "New Layer";
             const string layerName = "New Layer";
 
 
-            Document document = new (10, 10);
+            Document document = new(10, 10);
 
 
             document.AddNewLayer(layerName);
             document.AddNewLayer(layerName);
             document.AddNewLayer(layerName);
             document.AddNewLayer(layerName);
@@ -353,4 +352,4 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             Assert.Equal(layerName + " (16)", document.Layers[4].Name);
             Assert.Equal(layerName + " (16)", document.Layers[4].Name);
         }
         }
     }
     }
-}
+}

+ 3 - 3
PixiEditorTests/ModelsTests/DataHoldersTests/SurfaceTests.cs

@@ -27,7 +27,7 @@ namespace PixiEditorSkiaRewrite
         public void TestSurfaceSRGBPixelManipulation()
         public void TestSurfaceSRGBPixelManipulation()
         {
         {
             using Surface surface = new Surface(128, 200);
             using Surface surface = new Surface(128, 200);
-            surface.SkiaSurface.Canvas.Clear(SKExtendedColorTests.red);
+            surface.SkiaSurface.Canvas.Clear(SKColors.Red);
             surface.SkiaSurface.Canvas.DrawRect(new SKRect(10, 10, 70, 70), redPaint);
             surface.SkiaSurface.Canvas.DrawRect(new SKRect(10, 10, 70, 70), redPaint);
             surface.SetSRGBPixel(73, 21, greenColor);
             surface.SetSRGBPixel(73, 21, greenColor);
             Assert.Equal(redColor, surface.GetSRGBPixel(14, 14));
             Assert.Equal(redColor, surface.GetSRGBPixel(14, 14));
@@ -79,12 +79,12 @@ namespace PixiEditorSkiaRewrite
         }
         }
 
 
         [Fact]
         [Fact]
-        public void TestSurfaceToSurface()
+        public void TestSurfaceToWriteableBitmap()
         {
         {
             using Surface original = new Surface(30, 40);
             using Surface original = new Surface(30, 40);
             original.SkiaSurface.Canvas.Clear(redColor);
             original.SkiaSurface.Canvas.Clear(redColor);
             original.SkiaSurface.Canvas.DrawRect(5, 5, 20, 20, greenPaint);
             original.SkiaSurface.Canvas.DrawRect(5, 5, 20, 20, greenPaint);
-            var bitmap = original.ToSurface();
+            var bitmap = original.ToWriteableBitmap();
             byte[] pixels = new byte[30 * 40 * 4];
             byte[] pixels = new byte[30 * 40 * 4];
             bitmap.CopyPixels(pixels, 30 * 4, 0);
             bitmap.CopyPixels(pixels, 30 * 4, 0);
             Assert.Equal(redColor, new SKColor(pixels[2], pixels[1], pixels[0], pixels[3]));
             Assert.Equal(redColor, new SKColor(pixels[2], pixels[1], pixels[0], pixels[3]));

+ 7 - 8
PixiEditorTests/ModelsTests/IO/ExporterTests.cs

@@ -1,11 +1,10 @@
-using System.IO;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
+using System.IO;
+using System.Windows.Media.Imaging;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.IO
 namespace PixiEditorTests.ModelsTests.IO
@@ -31,9 +30,9 @@ namespace PixiEditorTests.ModelsTests.IO
             string filePath = "testFile.pixi";
             string filePath = "testFile.pixi";
 
 
             document.Layers.Add(new Layer("layer1"));
             document.Layers.Add(new Layer("layer1"));
-            document.Layers[0].SetPixel(new Coordinates(1, 1), ExtendedColorTests.white);
+            document.Layers[0].SetPixel(new Coordinates(1, 1), SKColors.White);
 
 
-            document.Swatches.Add(ExtendedColorTests.white);
+            document.Swatches.Add(SKColors.White);
 
 
             Exporter.SaveAsEditableFile(document, filePath);
             Exporter.SaveAsEditableFile(document, filePath);
 
 
@@ -42,4 +41,4 @@ namespace PixiEditorTests.ModelsTests.IO
             File.Delete(filePath);
             File.Delete(filePath);
         }
         }
     }
     }
-}
+}

+ 1 - 4
PixiEditorTests/ModelsTests/IO/ImporterTests.cs

@@ -1,12 +1,9 @@
 using PixiEditor.Exceptions;
 using PixiEditor.Exceptions;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.IO;
 using PixiEditor.Models.IO;
-using PixiEditorTests.ModelsTests.ColorsTests;
 using SkiaSharp;
 using SkiaSharp;
 using System;
 using System;
 using System.IO;
 using System.IO;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.IO
 namespace PixiEditorTests.ModelsTests.IO
@@ -79,7 +76,7 @@ namespace PixiEditorTests.ModelsTests.IO
         public void TestSaveAndLoadGZippedBytes()
         public void TestSaveAndLoadGZippedBytes()
         {
         {
             using Surface original = new Surface(123, 456);
             using Surface original = new Surface(123, 456);
-            original.SkiaSurface.Canvas.Clear(ExtendedColorTests.red);
+            original.SkiaSurface.Canvas.Clear(SKColors.Red);
             using SKPaint paint = new SKPaint();
             using SKPaint paint = new SKPaint();
             paint.BlendMode = SKBlendMode.Src;
             paint.BlendMode = SKBlendMode.Src;
             paint.Color = new SKColor(128, 64, 32, 16);
             paint.Color = new SKColor(128, 64, 32, 16);

+ 22 - 45
PixiEditorTests/ModelsTests/ImageManipulationTests/BitmapUtilsTests.cs

@@ -1,40 +1,17 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.ImageManipulation;
 using PixiEditor.Models.ImageManipulation;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
+using System;
+using System.Collections.Generic;
+using System.Linq;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ImageManipulationTests
 namespace PixiEditorTests.ModelsTests.ImageManipulationTests
 {
 {
     public class BitmapUtilsTests
     public class BitmapUtilsTests
     {
     {
-        [Fact]
-        public void TestBytesToSurface()
-        {
-            int width = 10;
-            int height = 10;
-            Coordinates[] coloredPoints = { new Coordinates(0, 0), new Coordinates(3, 6), new Coordinates(9, 9) };
-            Surface bmp = BitmapFactory.New(width, height);
-            for (int i = 0; i < coloredPoints.Length; i++)
-            {
-                bmp.SetPixel(coloredPoints[i].X, coloredPoints[i].Y, ExtendedColorTests.green);
-            }
-
-            byte[] byteArray = bmp.ToByteArray();
-
-            Surface convertedBitmap = BitmapUtils.BytesToSurface(width, height, byteArray);
-
-            for (int i = 0; i < coloredPoints.Length; i++)
-            {
-                Assert.Equal(ExtendedColorTests.green, convertedBitmap.GetPixel(coloredPoints[i].X, coloredPoints[i].Y));
-            }
-        }
 
 
         [Fact]
         [Fact]
         public void TestThatCombineLayersReturnsCorrectBitmap()
         public void TestThatCombineLayersReturnsCorrectBitmap()
@@ -42,14 +19,14 @@ namespace PixiEditorTests.ModelsTests.ImageManipulationTests
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
             Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
 
 
-            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, ExtendedColorTests.green));
+            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, SKColors.Lime));
 
 
-            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, ExtendedColorTests.red));
+            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, SKColors.Red));
 
 
             Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
             Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
 
 
-            Assert.Equal(ExtendedColorTests.green, outputBitmap.GetPixel(0, 0));
-            Assert.Equal(ExtendedColorTests.red, outputBitmap.GetPixel(1, 1));
+            Assert.Equal(SKColors.Lime, outputBitmap.GetSRGBPixel(0, 0));
+            Assert.Equal(SKColors.Red, outputBitmap.GetSRGBPixel(1, 1));
         }
         }
 
 
         [Fact]
         [Fact]
@@ -58,13 +35,13 @@ namespace PixiEditorTests.ModelsTests.ImageManipulationTests
             Coordinates[] cords = { new Coordinates(0, 0) };
             Coordinates[] cords = { new Coordinates(0, 0) };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
 
 
-            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.green));
+            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Lime));
 
 
-            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, ExtendedColorTests.red));
+            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Red));
 
 
             Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
             Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
 
 
-            Assert.Equal(ExtendedColorTests.red, outputBitmap.GetSRGBPixel(0, 0));
+            Assert.Equal(SKColors.Red, outputBitmap.GetSRGBPixel(0, 0));
         }
         }
 
 
         [Fact]
         [Fact]
@@ -77,26 +54,26 @@ namespace PixiEditorTests.ModelsTests.ImageManipulationTests
             };
             };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
             Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
 
 
-            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, ExtendedColorTests.green));
-            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, ExtendedColorTests.red));
+            layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, SKColors.Lime));
+            layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, SKColors.Red));
 
 
-            Dictionary<Guid, Color[]> output = BitmapUtils.GetPixelsForSelection(layers, cords);
+            Dictionary<Guid, SKColor[]> output = BitmapUtils.GetPixelsForSelection(layers, cords);
 
 
-            List<Color> colors = new List<Color>();
+            List<SKColor> colors = new List<SKColor>();
 
 
-            foreach (KeyValuePair<Guid, Color[]> layerColor in output.ToArray())
+            foreach (KeyValuePair<Guid, SKColor[]> layerColor in output.ToArray())
             {
             {
-                foreach (Color color in layerColor.Value)
+                foreach (SKColor color in layerColor.Value)
                 {
                 {
                     colors.Add(color);
                     colors.Add(color);
                 }
                 }
             }
             }
 
 
-            Assert.Single(colors.Where(x => x == ExtendedColorTests.green));
-            Assert.Single(colors.Where(x => x == ExtendedColorTests.red));
-            Assert.Equal(6, colors.Count(x => x.A == 0)); // 6 because layer is 4 pixels,
+            Assert.Single(colors.Where(x => x == SKColors.Lime));
+            Assert.Single(colors.Where(x => x == SKColors.Red));
+            Assert.Equal(6, colors.Count(x => x.Alpha == 0)); // 6 because layer is 4 pixels,
 
 
             // 2 * 4 = 8, 2 other color pixels, so 8 - 2 = 6
             // 2 * 4 = 8, 2 other color pixels, so 8 - 2 = 6
         }
         }
     }
     }
-}
+}

+ 11 - 13
PixiEditorTests/ModelsTests/LayersTests/LayerTests.cs

@@ -1,9 +1,7 @@
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.LayersTests
 namespace PixiEditorTests.ModelsTests.LayersTests
@@ -65,9 +63,9 @@ namespace PixiEditorTests.ModelsTests.LayersTests
 
 
             Layer clone = layer.Clone();
             Layer clone = layer.Clone();
 
 
-            clone.LayerBitmap.SetSRGBPixel(0, 0, ExtendedColorTests.green); // Actually we are checking if modifying clone bitmap does not affect original
+            clone.LayerBitmap.SetSRGBPixel(0, 0, SKColors.Lime); // Actually we are checking if modifying clone bitmap does not affect original
 
 
-            Assert.NotEqual(ExtendedColorTests.green, layer.GetPixel(0, 0));
+            Assert.NotEqual(SKColors.Lime, layer.GetPixel(0, 0));
         }
         }
 
 
         [Fact]
         [Fact]
@@ -75,7 +73,7 @@ namespace PixiEditorTests.ModelsTests.LayersTests
         {
         {
             Layer layer = new Layer("layer", 1, 1);
             Layer layer = new Layer("layer", 1, 1);
 
 
-            layer.SetPixel(new Coordinates(0, 0), ExtendedColorTests.black);
+            layer.SetPixel(new Coordinates(0, 0), SKColors.Black);
 
 
             layer.Resize(2, 2, 2, 2);
             layer.Resize(2, 2, 2, 2);
 
 
@@ -89,7 +87,7 @@ namespace PixiEditorTests.ModelsTests.LayersTests
             {
             {
                 for (int x = 0; x < layer.Width; x++)
                 for (int x = 0; x < layer.Width; x++)
                 {
                 {
-                    Assert.Equal(ExtendedColorTests.black, layer.GetPixel(x, y));
+                    Assert.Equal(SKColors.Black, layer.GetPixel(x, y));
                 }
                 }
             }
             }
         }
         }
@@ -109,11 +107,11 @@ namespace PixiEditorTests.ModelsTests.LayersTests
 
 
             Layer layer = new Layer("layer");
             Layer layer = new Layer("layer");
 
 
-            layer.SetPixels(BitmapPixelChanges.FromSingleColoredArray(pixels, ExtendedColorTests.green));
+            layer.SetPixels(BitmapPixelChanges.FromSingleColoredArray(pixels, SKColors.Lime));
 
 
             for (int i = 0; i < pixels.Length; i++)
             for (int i = 0; i < pixels.Length; i++)
             {
             {
-                Assert.Equal(ExtendedColorTests.green, layer.GetPixelWithOffset(pixels[i].X, pixels[i].Y));
+                Assert.Equal(SKColors.Lime, layer.GetPixelWithOffset(pixels[i].X, pixels[i].Y));
             }
             }
         }
         }
 
 
@@ -121,13 +119,13 @@ namespace PixiEditorTests.ModelsTests.LayersTests
         public void TestThatClipCanvasResizesBitmapCorrectly()
         public void TestThatClipCanvasResizesBitmapCorrectly()
         {
         {
             Layer layer = new Layer("layer", 10, 10);
             Layer layer = new Layer("layer", 10, 10);
-            layer.SetPixel(new Coordinates(4, 4), ExtendedColorTests.blue);
+            layer.SetPixel(new Coordinates(4, 4), SKColors.Blue);
 
 
             layer.ClipCanvas();
             layer.ClipCanvas();
 
 
             Assert.Equal(1, layer.Width);
             Assert.Equal(1, layer.Width);
             Assert.Equal(1, layer.Height);
             Assert.Equal(1, layer.Height);
-            Assert.Equal(ExtendedColorTests.blue, layer.GetPixel(0, 0));
+            Assert.Equal(SKColors.Blue, layer.GetPixel(0, 0));
         }
         }
     }
     }
-}
+}

+ 5 - 6
PixiEditorTests/ModelsTests/ToolsTests/BrightnessToolTests.cs

@@ -1,8 +1,7 @@
-using System.Windows.Media;
-using PixiEditor.Models.Layers;
+using PixiEditor.Models.Layers;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Tools.Tools;
 using PixiEditor.Models.Tools.Tools;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ToolsTests
 namespace PixiEditorTests.ModelsTests.ToolsTests
@@ -17,12 +16,12 @@ namespace PixiEditorTests.ModelsTests.ToolsTests
         // If correction factor is negative, testing color will be white, otherwise black
         // If correction factor is negative, testing color will be white, otherwise black
         public void TestThatBrightnessToolChangesPixelBrightness(float correctionFactor, byte expectedR, byte expectedG, byte expectedB)
         public void TestThatBrightnessToolChangesPixelBrightness(float correctionFactor, byte expectedR, byte expectedG, byte expectedB)
         {
         {
-            Color expectedColor = Color.FromRgb(expectedR, expectedG, expectedB);
+            SKColor expectedColor = new SKColor(expectedR, expectedG, expectedB);
 
 
             BrightnessTool tool = new BrightnessTool();
             BrightnessTool tool = new BrightnessTool();
 
 
             Layer layer = new Layer("test", 1, 1);
             Layer layer = new Layer("test", 1, 1);
-            layer.SetPixel(new Coordinates(0, 0), correctionFactor < 0 ? ExtendedColorTests.white : ExtendedColorTests.black);
+            layer.SetPixel(new Coordinates(0, 0), correctionFactor < 0 ? SKColors.White : SKColors.Black);
 
 
             PixiEditor.Models.DataHolders.BitmapPixelChanges changes = tool.ChangeBrightness(layer, new Coordinates(0, 0), 1, correctionFactor);
             PixiEditor.Models.DataHolders.BitmapPixelChanges changes = tool.ChangeBrightness(layer, new Coordinates(0, 0), 1, correctionFactor);
             layer.SetPixels(changes);
             layer.SetPixels(changes);
@@ -30,4 +29,4 @@ namespace PixiEditorTests.ModelsTests.ToolsTests
             Assert.Equal(expectedColor, layer.GetPixel(0, 0));
             Assert.Equal(expectedColor, layer.GetPixel(0, 0));
         }
         }
     }
     }
-}
+}

+ 5 - 5
PixiEditorTests/ModelsTests/ToolsTests/PenToolTests.cs

@@ -1,7 +1,7 @@
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Tools.Tools;
 using PixiEditor.Models.Tools.Tools;
 using PixiEditorTests.HelpersTests;
 using PixiEditorTests.HelpersTests;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.ToolsTests
 namespace PixiEditorTests.ModelsTests.ToolsTests
@@ -19,11 +19,11 @@ namespace PixiEditorTests.ModelsTests.ToolsTests
             Coordinates end2 = new Coordinates(1, 0);
             Coordinates end2 = new Coordinates(1, 0);
             Coordinates start2 = new Coordinates(1, 1);
             Coordinates start2 = new Coordinates(1, 1);
 
 
-            pen.Draw(start, end, ExtendedColorTests.black, 1, true);
-            pen.Draw(end, end2, ExtendedColorTests.black, 1, true);
-            var points = pen.Draw(end2, start2, ExtendedColorTests.black, 1, true);
+            pen.Draw(start, end, SKColors.Black, 1, true);
+            pen.Draw(end, end2, SKColors.Black, 1, true);
+            var points = pen.Draw(end2, start2, SKColors.Black, 1, true);
 
 
             Assert.Contains(points.ChangedPixels, x => x.Value.Alpha == 0);
             Assert.Contains(points.ChangedPixels, x => x.Value.Alpha == 0);
         }
         }
     }
     }
-}
+}

+ 8 - 14
PixiEditorTests/ModelsTests/UndoTests/StorageBasedChangeTests.cs

@@ -1,18 +1,12 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using PixiEditor.Models.Controllers;
+using PixiEditor.Models.Controllers;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Layers;
 using PixiEditor.Models.Undo;
 using PixiEditor.Models.Undo;
-using PixiEditorTests.ModelsTests.ColorsTests;
 using PixiEditorTests.ModelsTests.LayersTests;
 using PixiEditorTests.ModelsTests.LayersTests;
+using SkiaSharp;
+using System;
+using System.Collections.ObjectModel;
+using System.IO;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ModelsTests.UndoTests
 namespace PixiEditorTests.ModelsTests.UndoTests
@@ -34,8 +28,8 @@ namespace PixiEditorTests.ModelsTests.UndoTests
             Document testDocument = new Document(10, 10);
             Document testDocument = new Document(10, 10);
             using Surface testBitmap = new Surface(10, 10);
             using Surface testBitmap = new Surface(10, 10);
             using Surface testBitmap2 = new Surface(5, 8);
             using Surface testBitmap2 = new Surface(5, 8);
-            testBitmap.SetSRGBPixel(0, 0, ExtendedColorTests.black);
-            testBitmap2.SetSRGBPixel(4, 4, ExtendedColorTests.blue);
+            testBitmap.SetSRGBPixel(0, 0, SKColors.Black);
+            testBitmap2.SetSRGBPixel(4, 4, SKColors.Blue);
             Random random = new Random();
             Random random = new Random();
             testDocument.Layers = new ObservableCollection<Layer>()
             testDocument.Layers = new ObservableCollection<Layer>()
             {
             {
@@ -167,4 +161,4 @@ namespace PixiEditorTests.ModelsTests.UndoTests
             Assert.True(redoInvoked);
             Assert.True(redoInvoked);
         }
         }
     }
     }
-}
+}

+ 9 - 10
PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

@@ -3,10 +3,9 @@ using PixiEditor.Models.Position;
 using PixiEditor.Models.Tools.Tools;
 using PixiEditor.Models.Tools.Tools;
 using PixiEditor.ViewModels;
 using PixiEditor.ViewModels;
 using PixiEditorTests.HelpersTests;
 using PixiEditorTests.HelpersTests;
-using PixiEditorTests.ModelsTests.ColorsTests;
+using SkiaSharp;
 using System.IO;
 using System.IO;
 using System.Windows.Input;
 using System.Windows.Input;
-using System.Windows.Media;
 using Xunit;
 using Xunit;
 
 
 namespace PixiEditorTests.ViewModelsTests
 namespace PixiEditorTests.ViewModelsTests
@@ -31,13 +30,13 @@ namespace PixiEditorTests.ViewModelsTests
         {
         {
             ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
             ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
 
 
-            viewModel.ColorsSubViewModel.PrimaryColor = ExtendedColorTests.black;
-            viewModel.ColorsSubViewModel.SecondaryColor = ExtendedColorTests.white;
+            viewModel.ColorsSubViewModel.PrimaryColor = SKColors.Black;
+            viewModel.ColorsSubViewModel.SecondaryColor = SKColors.White;
 
 
             viewModel.ColorsSubViewModel.SwapColorsCommand.Execute(null);
             viewModel.ColorsSubViewModel.SwapColorsCommand.Execute(null);
 
 
-            Assert.Equal(ExtendedColorTests.white, viewModel.ColorsSubViewModel.PrimaryColor);
-            Assert.Equal(ExtendedColorTests.black, viewModel.ColorsSubViewModel.SecondaryColor);
+            Assert.Equal(SKColors.White, viewModel.ColorsSubViewModel.PrimaryColor);
+            Assert.Equal(SKColors.Black, viewModel.ColorsSubViewModel.SecondaryColor);
         }
         }
 
 
         [StaFact]
         [StaFact]
@@ -131,11 +130,11 @@ namespace PixiEditorTests.ViewModelsTests
             ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
             ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
             viewModel.BitmapManager.ActiveDocument = new Document(1, 1);
             viewModel.BitmapManager.ActiveDocument = new Document(1, 1);
 
 
-            viewModel.ColorsSubViewModel.AddSwatch(ExtendedColorTests.green);
-            viewModel.ColorsSubViewModel.AddSwatch(ExtendedColorTests.green);
+            viewModel.ColorsSubViewModel.AddSwatch(SKColors.Lime);
+            viewModel.ColorsSubViewModel.AddSwatch(SKColors.Lime);
 
 
             Assert.Single(viewModel.BitmapManager.ActiveDocument.Swatches);
             Assert.Single(viewModel.BitmapManager.ActiveDocument.Swatches);
-            Assert.Equal(ExtendedColorTests.green, viewModel.BitmapManager.ActiveDocument.Swatches[0]);
+            Assert.Equal(SKColors.Lime, viewModel.BitmapManager.ActiveDocument.Swatches[0]);
         }
         }
 
 
         [StaTheory]
         [StaTheory]
@@ -171,4 +170,4 @@ namespace PixiEditorTests.ViewModelsTests
             Assert.True(viewModel.DocumentIsNotNull(null));
             Assert.True(viewModel.DocumentIsNotNull(null));
         }
         }
     }
     }
-}
+}