Browse Source

*fixed* tests

flabbet 2 years ago
parent
commit
20b0fad88d
58 changed files with 3 additions and 3382 deletions
  1. 1 14
      src/PixiEditorTests/ApplicationFixture.cs
  2. 0 57
      src/PixiEditorTests/Helpers/ViewModelHelper.cs
  3. 0 19
      src/PixiEditorTests/HelpersTests/ConvertersTests/DoubleToIntConverterTest.cs
  4. 0 37
      src/PixiEditorTests/HelpersTests/ConvertersTests/FileExtensionToColorConverterTests.cs
  5. 0 40
      src/PixiEditorTests/HelpersTests/DependencyInjectionTests.cs
  6. 0 28
      src/PixiEditorTests/HelpersTests/SizeCalculatorTest.cs
  7. 0 44
      src/PixiEditorTests/HelpersTests/SupportedFilesHelperTests.cs
  8. 0 59
      src/PixiEditorTests/Mocks/PreferenceSettingsMock.cs
  9. 0 60
      src/PixiEditorTests/ModelsTests/ColorsTests/ExtendedColorTests.cs
  10. 0 96
      src/PixiEditorTests/ModelsTests/ControllersTests/BitmapManagerTests.cs
  11. 0 47
      src/PixiEditorTests/ModelsTests/ControllersTests/BitmapOperationsUtilityTests.cs
  12. 0 129
      src/PixiEditorTests/ModelsTests/ControllersTests/ClipboardControllerTests.cs
  13. 0 21
      src/PixiEditorTests/ModelsTests/ControllersTests/MockedSinglePixelPenTool.cs
  14. 0 76
      src/PixiEditorTests/ModelsTests/ControllersTests/MouseMovementControllerTests.cs
  15. 0 70
      src/PixiEditorTests/ModelsTests/ControllersTests/PixelChangesControllerTests.cs
  16. 0 19
      src/PixiEditorTests/ModelsTests/ControllersTests/ReadonlyUtilityTests.cs
  17. 0 81
      src/PixiEditorTests/ModelsTests/ControllersTests/ShortcutControllerTests.cs
  18. 0 6
      src/PixiEditorTests/ModelsTests/ControllersTests/TestPropertyClass.cs
  19. 0 23
      src/PixiEditorTests/ModelsTests/ControllersTests/TestReadonlyTool.cs
  20. 0 254
      src/PixiEditorTests/ModelsTests/ControllersTests/UndoManagerTests.cs
  21. 0 34
      src/PixiEditorTests/ModelsTests/DataHoldersTests/BitmapPixelChangesTests.cs
  22. 0 152
      src/PixiEditorTests/ModelsTests/DataHoldersTests/DocumentLayersTests.cs
  23. 0 354
      src/PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs
  24. 0 243
      src/PixiEditorTests/ModelsTests/DataHoldersTests/LayerStructureTests.cs
  25. 0 71
      src/PixiEditorTests/ModelsTests/DataHoldersTests/RecentlyOpenedDocumentTests.cs
  26. 0 79
      src/PixiEditorTests/ModelsTests/DataHoldersTests/SelectionTests.cs
  27. 0 108
      src/PixiEditorTests/ModelsTests/DataHoldersTests/SurfaceTests.cs
  28. BIN
      src/PixiEditorTests/ModelsTests/IO/BigImage.jpeg
  29. BIN
      src/PixiEditorTests/ModelsTests/IO/BigImage.jpg
  30. BIN
      src/PixiEditorTests/ModelsTests/IO/BigImage.png
  31. BIN
      src/PixiEditorTests/ModelsTests/IO/BigPixiFile.pixi
  32. 0 0
      src/PixiEditorTests/ModelsTests/IO/CorruptedJpg.jpg
  33. 0 0
      src/PixiEditorTests/ModelsTests/IO/CorruptedPNG.png
  34. BIN
      src/PixiEditorTests/ModelsTests/IO/CorruptedPNG2.png
  35. BIN
      src/PixiEditorTests/ModelsTests/IO/CorruptedPixiFile.pixi
  36. 0 43
      src/PixiEditorTests/ModelsTests/IO/ExporterTests.cs
  37. 0 94
      src/PixiEditorTests/ModelsTests/IO/ImporterTests.cs
  38. BIN
      src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.jpeg
  39. BIN
      src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.jpg
  40. BIN
      src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.png
  41. BIN
      src/PixiEditorTests/ModelsTests/IO/SmallEnoughPixiFile.pixi
  42. BIN
      src/PixiEditorTests/ModelsTests/IO/TestImage.png
  43. 0 78
      src/PixiEditorTests/ModelsTests/ImageManipulationTests/BitmapUtilsTests.cs
  44. 0 130
      src/PixiEditorTests/ModelsTests/LayersTests/LayerTests.cs
  45. 0 25
      src/PixiEditorTests/ModelsTests/LayersTests/LayersTestHelper.cs
  46. 0 49
      src/PixiEditorTests/ModelsTests/PositionTests/CoordinatesCalculatorTests.cs
  47. 0 25
      src/PixiEditorTests/ModelsTests/PositionTests/CoordinatesTests.cs
  48. 0 31
      src/PixiEditorTests/ModelsTests/PositionTests/RectTests.cs
  49. 0 31
      src/PixiEditorTests/ModelsTests/ToolsTests/BrightnessToolTests.cs
  50. 0 28
      src/PixiEditorTests/ModelsTests/ToolsTests/LineToolTests.cs
  51. 0 28
      src/PixiEditorTests/ModelsTests/ToolsTests/PenToolTests.cs
  52. 0 29
      src/PixiEditorTests/ModelsTests/ToolsTests/RectangleToolTests.cs
  53. 0 76
      src/PixiEditorTests/ModelsTests/ToolsTests/ToolbarTests/ToolbarBaseTests.cs
  54. 0 162
      src/PixiEditorTests/ModelsTests/UndoTests/StorageBasedChangeTests.cs
  55. 0 108
      src/PixiEditorTests/ModelsTests/UserPreferencesTests/PreferencesSettingsTests.cs
  56. 2 8
      src/PixiEditorTests/PixiEditorTests.csproj
  57. 0 44
      src/PixiEditorTests/UpdateModuleTests/UpdateCheckerTests.cs
  58. 0 172
      src/PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

+ 1 - 14
src/PixiEditorTests/ApplicationFixture.cs

@@ -1,8 +1,4 @@
 using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Windows;
-using PixiEditor;
-using PixiEditor.Models.Undo;
 
 namespace PixiEditorTests;
 
@@ -11,15 +7,6 @@ public class ApplicationFixture
 {
     public ApplicationFixture()
     {
-        if (Application.Current == null)
-        {
-            App app = new App();
-            app.InitializeComponent();
-        }
 
-        if (!Directory.Exists(Path.GetDirectoryName(StorageBasedChange.DefaultUndoChangeLocation)))
-        {
-            Directory.CreateDirectory(StorageBasedChange.DefaultUndoChangeLocation);
-        }
     }
-}
+}

+ 0 - 57
src/PixiEditorTests/Helpers/ViewModelHelper.cs

@@ -1,57 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Tools;
-using PixiEditor.Models.UserPreferences;
-using PixiEditor.ViewModels;
-using PixiEditor.ViewModels.SubViewModels.Main;
-using PixiEditorTests.Mocks;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace PixiEditorTests.HelpersTests;
-
-public static class ViewModelHelper
-{
-    //public static IServiceCollection GetViewModelMainCollection()
-    //{
-    //    return new ServiceCollection()
-    //        .AddScoped<IPreferences, PreferenceSettingsMock>()
-    //        .AddSingleton<BitmapManager>();
-    //}
-
-    //public static ViewModelMain MockedViewModelMain()
-    //{
-    //    IServiceCollection provider = MockedServiceCollection();
-
-    //    return new ViewModelMain(provider);
-    //}
-
-    //public static IServiceCollection MockedServiceCollection()
-    //{
-    //    return new ServiceCollection()
-    //        .AddSingleton<IPreferences>(new Mocks.PreferenceSettingsMock())
-    //        .AddSingleton<StylusViewModel>()
-    //        .AddSingleton<BitmapManager>()
-    //        .AddSingleton<ToolsViewModel>();
-    //}
-
-    //public static T BuildMockedTool<T>(bool requireViewModelMain = false)
-    //    where T : Tool
-    //{
-    //    IServiceProvider services;
-
-    //    if (requireViewModelMain)
-    //    {
-    //        services = MockedViewModelMain().Services;
-    //    }
-    //    else
-    //    {
-    //        services = MockedServiceCollection().BuildServiceProvider();
-    //    }
-
-    //    return ToolBuilder.BuildTool<T>(services);
-    //}
-}

+ 0 - 19
src/PixiEditorTests/HelpersTests/ConvertersTests/DoubleToIntConverterTest.cs

@@ -1,19 +0,0 @@
-using System.Globalization;
-using PixiEditor.Helpers.Converters;
-using Xunit;
-
-namespace PixiEditorTests.Helpers;
-
-public class DoubleToIntConverterTest
-{
-    [Fact]
-    public void TestThatConvertConvertsDoubleToInt()
-    {
-        DoubleToIntConverter converter = new DoubleToIntConverter();
-
-        object value = converter.Convert(5.123, typeof(int), null, CultureInfo.CurrentCulture);
-
-        Assert.IsType<int>(value);
-        Assert.Equal(5, (int)value);
-    }
-}

+ 0 - 37
src/PixiEditorTests/HelpersTests/ConvertersTests/FileExtensionToColorConverterTests.cs

@@ -1,37 +0,0 @@
-using PixiEditor.Helpers;
-using PixiEditor.Helpers.Converters;
-using System.Globalization;
-using System.Linq;
-using System.Windows.Media;
-using Xunit;
-
-namespace PixiEditorTests.HelpersTests.ConvertersTests;
-
-public class FileExtensionToColorConverterTests
-{
-    private static SolidColorBrush GetTypedColor(string ext)
-    {
-        var converter = new FileExtensionToColorConverter();
-        object value = converter.Convert(ext, typeof(int), null, CultureInfo.CurrentCulture);
-        Assert.IsType<SolidColorBrush>(value);
-        return value as SolidColorBrush;
-    }
-
-    [Fact]
-    public void TestThatEachFormatHasColor()
-    {
-        SupportedFilesHelper.AllSupportedExtensions.ToList().ForEach(i =>
-        {
-            var typed = GetTypedColor(i);
-            Assert.NotEqual(FileExtensionToColorConverter.UnknownBrush, typed);
-        });
-    }
-               
-    [Fact]
-    public void TestThatUnsupportedFormatHasDefaultColor()
-    {
-        var converter = new FileExtensionToColorConverter();
-        var typed = GetTypedColor(".abc");
-        Assert.Equal(FileExtensionToColorConverter.UnknownBrush, typed);
-    }
-}

+ 0 - 40
src/PixiEditorTests/HelpersTests/DependencyInjectionTests.cs

@@ -1,40 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using PixiEditor.Helpers;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace PixiEditorTests.HelpersTests;
-
-[Collection("Application collection")]
-public class DependencyInjectionTests
-{
-    private class TestService
-    {
-    }
-
-    private class TestInjectable
-    {
-        public TestService TestService { get; }
-
-        public TestInjectable(TestService service)
-        {
-            TestService = service;
-        }
-    }
-
-    [Fact]
-    public void TestThatInjectingWorks()
-    {
-        IServiceProvider provider = new ServiceCollection()
-            .AddSingleton<TestService>()
-            .BuildServiceProvider();
-
-        TestInjectable injectable = provider.Inject<TestInjectable>();
-
-        Assert.NotNull(injectable.TestService);
-    }
-}

+ 0 - 28
src/PixiEditorTests/HelpersTests/SizeCalculatorTest.cs

@@ -1,28 +0,0 @@
-using PixiEditor.Helpers;
-using Xunit;
-
-namespace PixiEditorTests.HelpersTests;
-
-public class SizeCalculatorTest
-{
-    [Theory]
-    [InlineData(50, 64, 64, 32, 32)]
-    [InlineData(100, 64, 64, 64, 64)]
-    [InlineData(200, 128, 128, 256, 256)]
-    public void TestCalculationOfAbsoluteFromPercentageWorks(int percent, int currentWidth, int currentHeight, int expectedWidth, int expectedHeight)
-    {
-        var newSize = SizeCalculator.CalcAbsoluteFromPercentage(percent, new System.Drawing.Size(currentWidth, currentHeight));
-        Assert.Equal(expectedWidth, newSize.Width);
-        Assert.Equal(expectedHeight, newSize.Height);
-    }
-
-    [Theory]
-    [InlineData(32, 64, 50)]
-    [InlineData(32, 32, 100)]
-    [InlineData(64, 32, 200)]
-    public void TestCalculationOfPercentageFromAbsoluteWorks(int currentSize, int initSize, int expectedPerc)
-    {
-        var perc = SizeCalculator.CalcPercentageFromAbsolute(initSize, currentSize);
-        Assert.Equal(perc, expectedPerc);
-    }
-}

+ 0 - 44
src/PixiEditorTests/HelpersTests/SupportedFilesHelperTests.cs

@@ -1,44 +0,0 @@
-using PixiEditor.Helpers;
-using Xunit;
-
-namespace PixiEditorTests.HelpersTests;
-
-public class SupportedFilesHelperTests
-{
-    [Fact]
-    public void TestAllExtensionsAreSupported()
-    {
-        var all = SupportedFilesHelper.AllSupportedExtensions;
-        Assert.Contains(all, i => i == ".pixi");
-        Assert.Contains(all, i => i == ".png");
-        Assert.Contains(all, i => i == ".jpg");
-        Assert.Contains(all, i => i == ".jpeg");
-        Assert.Contains(all, i => i == ".bmp");
-        Assert.Contains(all, i => i == ".gif");
-    }
-
-    [Fact]
-    public void TestBuildSaveFilter()
-    {
-        var filter = SupportedFilesHelper.BuildSaveFilter(true);
-        Assert.Equal("PixiEditor Files|*.pixi|Png Images|*.png|Jpeg Images|*.jpeg|Bmp Images|*.bmp|Gif Images|*.gif", filter);
-    }
-
-    [Fact]
-    public void TestBuildOpenFilter()
-    {
-        var filter = SupportedFilesHelper.BuildOpenFilter();
-        Assert.Equal("Any |*.pixi;*.png;*.jpeg;*.jpg;*.bmp;*.gif|PixiEditor Files |*.pixi|Image Files |*.png;*.jpeg;*.jpg;*.bmp;*.gif", filter);
-    }
-
-    [Fact]
-    public void TestIsSupportedFile()
-    {
-        Assert.True(SupportedFilesHelper.IsSupportedFile("foo.png"));
-        Assert.True(SupportedFilesHelper.IsSupportedFile("foo.bmp"));
-        Assert.True(SupportedFilesHelper.IsSupportedFile("foo.jpg"));
-        Assert.True(SupportedFilesHelper.IsSupportedFile("foo.jpeg"));
-
-        Assert.False(SupportedFilesHelper.IsSupportedFile("foo.abc"));
-    }
-}

+ 0 - 59
src/PixiEditorTests/Mocks/PreferenceSettingsMock.cs

@@ -1,59 +0,0 @@
-using System;
-using PixiEditor.Models.UserPreferences;
-
-namespace PixiEditorTests.Mocks;
-
-public class PreferenceSettingsMock : IPreferences
-{
-    public void AddCallback(string setting, Action<object> action)
-    {
-    }
-
-    public void AddCallback<T>(string name, Action<T> action)
-    {
-    }
-
-#nullable enable
-
-    public T? GetLocalPreference<T>(string name)
-    {
-        return default;
-    }
-
-    public T? GetLocalPreference<T>(string name, T? fallbackValue)
-    {
-        return fallbackValue;
-    }
-
-    public T? GetPreference<T>(string name)
-    {
-        return default;
-    }
-
-    public T? GetPreference<T>(string name, T? fallbackValue)
-    {
-        return fallbackValue;
-    }
-
-#nullable disable
-
-    public void Init()
-    {
-    }
-
-    public void Init(string path, string localPath)
-    {
-    }
-
-    public void Save()
-    {
-    }
-
-    public void UpdateLocalPreference<T>(string name, T value)
-    {
-    }
-
-    public void UpdatePreference<T>(string name, T value)
-    {
-    }
-}

+ 0 - 60
src/PixiEditorTests/ModelsTests/ColorsTests/ExtendedColorTests.cs

@@ -1,60 +0,0 @@
-using PixiEditor.Models.Colors;
-using SkiaSharp;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ColorsTests;
-
-public class ExtendedColorTests
-{
-    private const int AcceptableMaringOfError = 1;
-
-    [Fact]
-    public void ChangeColorBrightnessIsNotTheSameTest()
-    {
-        SKColor newColor = ExColor.ChangeColorBrightness(SKColors.White, -1);
-        Assert.NotEqual(SKColors.White, newColor);
-    }
-
-    [Fact]
-    public void ChangeColorBrightnessNewValueTest()
-    {
-        SKColor newColor = ExColor.ChangeColorBrightness(SKColors.White, -100);
-        Assert.Equal(SKColors.Black, newColor);
-    }
-
-    // Acceptable margin of error is 1
-    [Theory]
-    [InlineData(0, 0, 0, 0, 0, 0)]
-    [InlineData(255, 255, 255, 0, 0, 100)]
-    [InlineData(182, 55, 55, 0, 53.6f, 46.5f)]
-    [InlineData(20, 47, 255, 233, 100, 53.9f)]
-    [InlineData(137, 43, 226, 271, 75.9f, 52.7f)]
-    public void RgbToHslTest(int r, int g, int b, int h, float s, float l)
-    {
-        Tuple<int, float, float> hsl = ExColor.RgbToHsl(r, g, b);
-        float marginOfErrorH = Math.Abs(hsl.Item1 - h);
-        float marginOfErrorS = Math.Abs(hsl.Item2 - s);
-        float marginOfErrorL = Math.Abs(hsl.Item3 - l);
-        Assert.True(marginOfErrorH <= AcceptableMaringOfError);
-        Assert.True(marginOfErrorS <= AcceptableMaringOfError);
-        Assert.True(marginOfErrorL <= AcceptableMaringOfError);
-    }
-
-    [Theory]
-    [InlineData(0, 0, 0, 0, 0, 0)]
-    [InlineData(0, 0, 100, 255, 255, 255)]
-    [InlineData(0, 53.6f, 46.5f, 182, 55, 55)]
-    [InlineData(297, 100, 17.1f, 82, 0, 87)]
-    [InlineData(271, 75.9f, 52.7f, 137, 43, 226)]
-    public void HslToRgbTest(int h, float s, float l, int r, int g, int b)
-    {
-        SKColor rgb = ExColor.HslToRgb(h, s, l);
-        int marginOfErrorR = Math.Abs(rgb.Red - r);
-        int marginOfErrorG = Math.Abs(rgb.Green - g);
-        int marginOfErrorB = Math.Abs(rgb.Blue - b);
-        Assert.True(marginOfErrorR <= AcceptableMaringOfError);
-        Assert.True(marginOfErrorG <= AcceptableMaringOfError);
-        Assert.True(marginOfErrorB <= AcceptableMaringOfError);
-    }
-}

+ 0 - 96
src/PixiEditorTests/ModelsTests/ControllersTests/BitmapManagerTests.cs

@@ -1,96 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class BitmapManagerTests
-{
-    //[Fact]
-    //public void TestThatBitmapManagerSetsCorrectTool()
-    //{
-    //    BitmapManager bitmapManager = new BitmapManager();
-    //    bitmapManager.SetActiveTool(new MockedSinglePixelPenTool());
-    //    Assert.Equal(typeof(MockedSinglePixelPenTool), bitmapManager.SelectedTool.GetType());
-    //}
-
-    //[Fact]
-    //public void TestThatBitmapManagerAddsEmptyNewLayer()
-    //{
-    //    string layerName = "TestLayer";
-    //    BitmapManager bitmapManager = new BitmapManager
-    //    {
-    //        ActiveDocument = new Document(10, 10)
-    //    };
-    //    bitmapManager.ActiveDocument.AddNewLayer(layerName);
-    //    Assert.Single(bitmapManager.ActiveDocument.Layers);
-    //    Assert.Equal(layerName, bitmapManager.ActiveDocument.ActiveLayer.Name);
-    //    Assert.Equal(1, bitmapManager.ActiveDocument.ActiveLayer.Width);
-    //    Assert.Equal(1, bitmapManager.ActiveDocument.ActiveLayer.Height);
-    //}
-
-    //[Fact]
-    //public void TestThatBitmapManagerRemovesLayer()
-    //{
-    //    BitmapManager bitmapManager = new BitmapManager
-    //    {
-    //        ActiveDocument = new Document(10, 10)
-    //    };
-    //    bitmapManager.ActiveDocument.AddNewLayer("_");
-    //    bitmapManager.ActiveDocument.AddNewLayer("_1");
-    //    Assert.Equal(2, bitmapManager.ActiveDocument.Layers.Count);
-    //    bitmapManager.ActiveDocument.RemoveLayer(0);
-    //    Assert.Single(bitmapManager.ActiveDocument.Layers);
-    //}
-
-    //[Fact]
-    //public void TestThatGeneratePreviewLayerGeneratesPreviewLayer()
-    //{
-    //    BitmapManager bitmapManager = new BitmapManager
-    //    {
-    //        ActiveDocument = new Document(10, 10)
-    //    };
-    //    bitmapManager.ActiveDocument.GeneratePreviewLayer();
-    //    Assert.NotNull(bitmapManager.ActiveDocument.PreviewLayer);
-    //    Assert.Equal(1, bitmapManager.ActiveDocument.PreviewLayer.Width); // Size is 1x1
-    //    Assert.Equal(1, bitmapManager.ActiveDocument.PreviewLayer.Height);
-    //    Assert.Equal(0, bitmapManager.ActiveDocument.PreviewLayer.OffsetX + bitmapManager.ActiveDocument.PreviewLayer.OffsetY); // Offset is zero
-    //    Assert.Equal(bitmapManager.ActiveDocument.Width, bitmapManager.ActiveDocument.PreviewLayer.MaxWidth);
-    //    Assert.Equal(bitmapManager.ActiveDocument.Height, bitmapManager.ActiveDocument.PreviewLayer.MaxHeight);
-    //}
-
-    //[Fact]
-    //public void TestThatIsOperationToolWorks()
-    //{
-    //    MockedSinglePixelPenTool singlePixelPen = new MockedSinglePixelPenTool();
-    //    Assert.True(BitmapManager.IsOperationTool(singlePixelPen));
-    //}
-
-    //[StaFact]
-    //public void TestThatBitmapChangesExecuteToolExecutesPenTool()
-    //{
-    //    BitmapManager bitmapManager = new BitmapManager
-    //    {
-    //        Documents = new System.Collections.ObjectModel.ObservableCollection<Document>()
-    //        {
-    //            new Document(5, 5)
-    //        }
-    //    };
-
-    //    bitmapManager.ActiveDocument = bitmapManager.Documents[0];
-
-    //    bitmapManager.ActiveDocument.AddNewLayer("Layer");
-    //    bitmapManager.SetActiveTool(new MockedSinglePixelPenTool());
-    //    bitmapManager.PrimaryColor = SKColors.Black;
-
-    //    bitmapManager.MouseController.StartRecordingMouseMovementChanges(true);
-    //    bitmapManager.MouseController.RecordMouseMovementChange(new Coordinates(1, 1));
-    //    bitmapManager.MouseController.StopRecordingMouseMovementChanges();
-
-    //    bitmapManager.ExecuteTool(new Coordinates(1, 1), true);
-
-    //    Assert.Equal(SKColors.Black, bitmapManager.ActiveLayer.GetPixelWithOffset(1, 1));
-    //}
-}

+ 0 - 47
src/PixiEditorTests/ModelsTests/ControllersTests/BitmapOperationsUtilityTests.cs

@@ -1,47 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using System.Collections.Generic;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class BitmapOperationsUtilityTests
-{
-    //[Fact]
-    //public void TestThatBitmapOperationsUtilityDeletesPixels()
-    //{
-    //    BitmapOperationsUtility util = new BitmapOperationsUtility(new BitmapManager());
-    //    util.Manager.ActiveDocument = new Document(10, 10);
-
-    //    Layer testLayer = new Layer("test layer", 10, 10);
-    //    Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
-    //    BitmapPixelChanges pixels = BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black);
-    //    testLayer.SetPixels(pixels);
-
-    //    util.DeletePixels(new[] { testLayer }, cords);
-
-    //    Assert.Equal(0, testLayer.GetPixel(0, 0).Alpha);
-    //    Assert.Equal(0, testLayer.GetPixel(1, 1).Alpha);
-    //}
-
-    //[StaFact]
-    //public void TestThatBitmapOperationsUtilityExecutesPenToolProperly()
-    //{
-    //    BitmapManager manager = new BitmapManager
-    //    {
-    //        ActiveDocument = new Document(10, 10),
-    //        PrimaryColor = SKColors.Black
-    //    };
-    //    manager.ActiveDocument.AddNewLayer("Test layer", 10, 10);
-
-    //    BitmapOperationsUtility util = new BitmapOperationsUtility(manager);
-
-    //    List<Coordinates> mouseMove = new List<Coordinates>(new[] { new Coordinates(0, 0) });
-
-    //    util.ExecuteTool(new Coordinates(0, 0), mouseMove, new MockedSinglePixelPenTool());
-    //    Assert.Equal(manager.ActiveLayer.GetPixel(0, 0), SKColors.Black);
-    //}
-}

+ 0 - 129
src/PixiEditorTests/ModelsTests/ControllersTests/ClipboardControllerTests.cs

@@ -1,129 +0,0 @@
-using System.IO;
-using System.Linq;
-using System.Windows;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class ClipboardControllerTests
-{
-    //private const string Text = "Text data";
-    //private readonly SKColor testColor = new SKColor(223, 20, 52);
-
-    //[StaFact]
-    //public void TestThatClipboardControllerIgnoresNonImageDataInClipboard()
-    //{
-    //    Clipboard.Clear();
-    //    Clipboard.SetText(Text);
-    //    Surface img = ClipboardController.GetImagesFromClipboard();
-    //    Assert.Null(img);
-    //}
-
-    //[StaFact]
-    //public void TestThatIsImageInClipboardWorksForDib()
-    //{
-    //    Clipboard.Clear();
-    //    Clipboard.SetImage(BitmapFactory.New(10, 10));
-    //    Assert.True(ClipboardController.IsImageInClipboard());
-    //}
-
-    //[StaFact]
-    //public void TestThatClipboardControllerSavesImageToClipboard()
-    //{
-    //    Layer testLayer = new Layer("test layer", 10, 10);
-    //    ClipboardController.CopyToClipboard(new[] { testLayer }, CoordinatesCalculator.RectangleToCoordinates(0, 0, 9, 9).ToArray(), 10, 10);
-    //    Assert.True(ClipboardController.IsImageInClipboard());
-    //}
-
-    //[StaFact]
-    //public void TestThatCopyToClipboardWithSelectionSavesCorrectBitmap()
-    //{
-    //    Clipboard.Clear();
-
-    //    Layer testLayer = new Layer("test layer", 10, 10);
-    //    Layer testLayer2 = new Layer("test layer", 10, 10);
-    //    testLayer.SetPixel(new Coordinates(4, 4), testColor);
-    //    testLayer2.SetPixel(new Coordinates(5, 5), testColor);
-
-    //    ClipboardController.CopyToClipboard(
-    //        new[] { testLayer, testLayer2 },
-    //        new[] { new Coordinates(4, 4), new Coordinates(5, 5) },
-    //        10,
-    //        10);
-
-    //    BitmapSource img = Clipboard.GetImage(); // Using default Clipboard get image to avoid false positives from faulty ClipboardController GetImage
-
-    //    Assert.True(ClipboardController.IsImageInClipboard());
-    //    Assert.NotNull(img);
-    //    Assert.Equal(2, img.Width);
-    //    Assert.Equal(2, img.Height);
-
-    //    using Surface bmp = new Surface(new WriteableBitmap(img));
-    //    Assert.Equal(testColor, bmp.GetSRGBPixel(0, 0));
-    //    Assert.Equal(testColor, bmp.GetSRGBPixel(1, 1));
-    //}
-
-    //[StaFact]
-    //public void TestThatClipboardControllerGetsCorrectImageInDibFormatFromClipboard()
-    //{
-    //    Clipboard.Clear();
-    //    using Surface bmp = new Surface(10, 10);
-    //    bmp.SetSRGBPixel(4, 4, testColor);
-    //    Clipboard.SetImage(bmp.ToWriteableBitmap());
-
-    //    Surface img = ClipboardController.GetImagesFromClipboard();
-    //    Assert.NotNull(img);
-    //    Assert.Equal(10, img.Width);
-    //    Assert.Equal(10, img.Height);
-    //    Assert.Equal(testColor, bmp.GetSRGBPixel(4, 4));
-    //}
-
-    //[StaFact]
-    //public void TestThatClipboardControllerGetsCorrectImageInPngFormatFromClipboard()
-    //{
-    //    Clipboard.Clear();
-    //    using Surface bmp = new Surface(10, 10);
-    //    bmp.SetSRGBPixel(4, 4, testColor);
-    //    using (MemoryStream pngStream = new MemoryStream())
-    //    {
-    //        DataObject data = new DataObject();
-
-    //        PngBitmapEncoder encoder = new PngBitmapEncoder();
-    //        encoder.Frames.Add(BitmapFrame.Create(bmp.ToWriteableBitmap()));
-    //        encoder.Save(pngStream);
-    //        data.SetData("PNG", pngStream, false); // PNG, supports transparency
-    //        Clipboard.SetDataObject(data, true);
-    //    }
-
-    //    Surface img = ClipboardController.GetImagesFromClipboard();
-    //    Assert.NotNull(img);
-    //    Assert.Equal(10, img.Width);
-    //    Assert.Equal(10, img.Height);
-    //    Assert.Equal(testColor, bmp.GetSRGBPixel(4, 4));
-    //}
-
-    //[StaFact]
-    //public void TestThatClipboardControllerGetsCorrectImageInBitmapFormatFromClipboard()
-    //{
-    //    Clipboard.Clear();
-    //    using Surface bmp = new Surface(10, 10);
-    //    bmp.SetSRGBPixel(4, 4, testColor);
-
-    //    DataObject data = new DataObject();
-    //    data.SetData(DataFormats.Bitmap, bmp, false); // PNG, supports transparency
-    //    Clipboard.SetDataObject(data, true);
-
-    //    Surface img = ClipboardController.GetImagesFromClipboard();
-    //    Assert.NotNull(img);
-    //    Assert.Equal(10, img.Width);
-    //    Assert.Equal(10, img.Height);
-    //    Assert.Equal(testColor, bmp.GetSRGBPixel(4, 4));
-    //}
-}

+ 0 - 21
src/PixiEditorTests/ModelsTests/ControllersTests/MockedSinglePixelPenTool.cs

@@ -1,21 +0,0 @@
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools;
-using SkiaSharp;
-using System;
-using System.Collections.Generic;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class MockedSinglePixelPenTool : BitmapOperationTool
-{
-    public override string Tooltip => "";
-
-    public override void Use(Layer activeLayer, Layer previewLayer, IEnumerable<Layer> allLayers, IReadOnlyList<Coordinates> recordedMouseMovement,
-        SKColor color)
-    {
-        if (recordedMouseMovement == null || activeLayer == null)
-            throw new ArgumentException("Parameter is null");
-        activeLayer.LayerBitmap.SkiaSurface.Canvas.DrawPoint(recordedMouseMovement[0].ToSKPoint(), color);
-    }
-}

+ 0 - 76
src/PixiEditorTests/ModelsTests/ControllersTests/MouseMovementControllerTests.cs

@@ -1,76 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Position;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class MouseMovementControllerTests
-{
-    /*[Fact]
-    public void TestThatStartRecordingMouseMovChangesStartsRecordingAndInvokesEvent()
-    {
-        bool eventInvoked = false;
-        ToolSessionController controller = new ToolSessionController();
-        controller.StartedRecordingChanges += (sender, e) => eventInvoked = true;
-
-        controller.StartRecordingMouseMovementChanges(false);
-
-        Assert.True(controller.IsRecordingChanges);
-        Assert.True(eventInvoked);
-        Assert.False(controller.ClickedOnCanvas);
-    }
-
-    [Fact]
-    public void TestThatRecordMouseMovementChangeRecordsMouseMovementChange()
-    {
-        ToolSessionController controller = new ToolSessionController();
-        controller.StartRecordingMouseMovementChanges(false);
-        controller.RecordMouseMovementChange(new Coordinates(5, 5));
-
-        Assert.NotEmpty(controller.LastMouseMoveCoordinates);
-        Assert.Equal(new Coordinates(5, 5), controller.LastMouseMoveCoordinates[0]);
-        Assert.True(controller.IsRecordingChanges);
-    }
-
-    [Fact]
-    public void TestThatMouseMovedRaisesEvent()
-    {
-        bool eventRaised = false;
-        Coordinates position = new Coordinates(5, 5);
-        MouseMovementEventArgs args = new MouseMovementEventArgs(default(Coordinates));
-
-        ToolSessionController controller = new ToolSessionController();
-        controller.PreciseMousePositionChanged += (s, e) =>
-        {
-            eventRaised = true;
-            args = e;
-        };
-
-        controller.OnMouseMove(position);
-
-        Assert.True(eventRaised);
-        Assert.Equal(position, args.NewPosition);
-    }
-
-    [Fact]
-    public void TestStopRecordingChangesStopsRecording()
-    {
-        ToolSessionController controller = new ToolSessionController();
-
-        controller.StartRecordingMouseMovementChanges(true);
-        controller.StopRecordingMouseMovementChanges();
-
-        Assert.False(controller.IsRecordingChanges);
-        Assert.False(controller.ClickedOnCanvas);
-    }
-
-    [Fact]
-    public void TestThatRecordChangesNotRecords()
-    {
-        ToolSessionController controller = new ToolSessionController();
-        controller.RecordMouseMovementChange(new Coordinates(5, 10));
-
-        Assert.False(controller.IsRecordingChanges);
-        Assert.Empty(controller.LastMouseMoveCoordinates);
-    }*/
-}

+ 0 - 70
src/PixiEditorTests/ModelsTests/ControllersTests/PixelChangesControllerTests.cs

@@ -1,70 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class PixelChangesControllerTests
-{
-    [Fact]
-    public void TestThatPopChangesPopsChanges()
-    {
-        //PixelChangesController controller = CreateBasicController().Item2;
-
-        //System.Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
-        //Assert.NotEmpty(changes);
-        //Assert.Null(controller.PopChanges());
-    }
-
-    [Fact]
-    public void TestThatAddChangesAddsAsNewChange()
-    {
-        //var data = CreateBasicController();
-        //PixelChangesController controller = data.Item2;
-        //Coordinates[] cords = { new Coordinates(5, 3), new Coordinates(7, 2) };
-        //Guid guid = Guid.NewGuid();
-
-        //controller.AddChanges(
-        //    new LayerChange(
-        //        BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black), guid),
-        //    new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Transparent), guid));
-
-        //System.Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
-        //Assert.Equal(2, changes.Length);
-    }
-
-    [Fact]
-    public void TestThatAddChangesAddsToExistingChange()
-    {
-        //Coordinates[] cords2 = { new Coordinates(2, 2), new Coordinates(5, 5) };
-        //var data = CreateBasicController();
-        //PixelChangesController controller = data.Item2;
-
-        //controller.AddChanges(
-        //    new LayerChange(
-        //        BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Black), data.Item1),
-        //    new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Transparent), data.Item1));
-
-        //Tuple<LayerChange, LayerChange>[] changes = controller.PopChanges();
-        //Assert.Single(changes);
-        //Assert.Equal(4, changes[0].Item1.PixelChanges.ChangedPixels.Count);
-        //Assert.Equal(4, changes[0].Item2.PixelChanges.ChangedPixels.Count);
-    }
-
-    //private static Tuple<Guid, PixelChangesController> CreateBasicController()
-    //{
-    //    Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
-    //    PixelChangesController controller = new PixelChangesController();
-
-    //    Guid guid = Guid.NewGuid();
-
-    //    controller.AddChanges(
-    //        new LayerChange(
-    //            BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Black), guid),
-    //        new LayerChange(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Transparent), guid));
-    //    return new Tuple<Guid, PixelChangesController>(guid, controller);
-    //}
-}

+ 0 - 19
src/PixiEditorTests/ModelsTests/ControllersTests/ReadonlyUtilityTests.cs

@@ -1,19 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Position;
-using System.Collections.Generic;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class ReadonlyUtilityTests
-{
-    /*[Fact]
-    public void TestThatExecuteToolExecutesTool()
-    {
-        bool toolUsed = false;
-
-        ReadonlyToolUtility util = new ReadonlyToolUtility();
-        util.ExecuteTool(new List<Coordinates> { new Coordinates(0, 0) }, new TestReadonlyTool(() => toolUsed = true));
-        Assert.True(toolUsed);
-    }*/
-}

+ 0 - 81
src/PixiEditorTests/ModelsTests/ControllersTests/ShortcutControllerTests.cs

@@ -1,81 +0,0 @@
-using System.Windows.Input;
-using PixiEditor.Helpers;
-using PixiEditor.Models.Controllers.Shortcuts;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class ShortcutControllerTests
-{
-    [StaTheory]
-    [InlineData(Key.A, ModifierKeys.None, Key.A, ModifierKeys.None)]
-    [InlineData(Key.A, ModifierKeys.Alt, Key.A, ModifierKeys.Alt)]
-    [InlineData(Key.B, ModifierKeys.Alt | ModifierKeys.Control, Key.B, ModifierKeys.Alt | ModifierKeys.Control)]
-    public void TestThatShortcutControllerExecutesShortcut(Key shortcutKey, ModifierKeys shortcutModifiers, Key clickedKey, ModifierKeys clickedModifiers)
-    {
-        int result = -1;
-        RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
-        ShortcutController controller = GenerateStandardShortcutController(shortcutKey, shortcutModifiers, shortcutCommand);
-
-        controller.KeyPressed(clickedKey, clickedModifiers);
-        Assert.Equal(0, result);
-    }
-
-    [StaTheory]
-    [InlineData(Key.B, ModifierKeys.None, Key.A, ModifierKeys.None)]
-    [InlineData(Key.A, ModifierKeys.Alt, Key.A, ModifierKeys.None)]
-    [InlineData(Key.C, ModifierKeys.Alt | ModifierKeys.Control, Key.C, ModifierKeys.Alt | ModifierKeys.Windows)]
-    public void TestThatShortcutControllerNotExecutesShortcut(Key shortcutKey, ModifierKeys shortcutModifiers, Key clickedKey, ModifierKeys clickedModifiers)
-    {
-        int result = -1;
-        RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
-        ShortcutController controller = GenerateStandardShortcutController(shortcutKey, shortcutModifiers, shortcutCommand);
-
-        controller.KeyPressed(clickedKey, clickedModifiers);
-        Assert.Equal(-1, result);
-    }
-
-    [StaFact]
-    public void TestThatShortcutControllerIsBlocked()
-    {
-        int result = -1;
-        RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
-
-        ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, shortcutCommand);
-        ShortcutController.BlockShortcutExection("Test");
-
-        controller.KeyPressed(Key.A, ModifierKeys.None);
-        Assert.Equal(-1, result);
-    }
-
-    [StaFact]
-    public void TestThatShortcutControllerPicksCorrectShortcut()
-    {
-        int result = -1;
-        RelayCommand shortcutCommand = new RelayCommand(arg => { result = (int)arg; });
-
-        ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, shortcutCommand);
-        controller.ShortcutGroups.Add(new ShortcutGroup(string.Empty, new Shortcut(Key.A, shortcutCommand, 1, ModifierKeys.Control)));
-
-        controller.KeyPressed(Key.A, ModifierKeys.Control);
-        Assert.Equal(1, result);
-    }
-
-    [StaFact]
-    public void TestThatKeyPressedSetsLastShortcut()
-    {
-        ShortcutController controller = GenerateStandardShortcutController(Key.A, ModifierKeys.None, new RelayCommand(parameter => { }));
-
-        Assert.Null(controller.LastShortcut);
-        controller.KeyPressed(Key.A, ModifierKeys.None);
-        Assert.Equal(controller.ShortcutGroups[0].Shortcuts[0], controller.LastShortcut);
-    }
-
-    private static ShortcutController GenerateStandardShortcutController(Key shortcutKey, ModifierKeys modifiers, RelayCommand shortcutCommand)
-    {
-        ShortcutController controller = new ShortcutController();
-        controller.ShortcutGroups.Add(new ShortcutGroup(string.Empty, new Shortcut(shortcutKey, shortcutCommand, 0, modifiers)));
-        ShortcutController.UnblockShortcutExecutionAll();
-        return controller;
-    }
-}

+ 0 - 6
src/PixiEditorTests/ModelsTests/ControllersTests/TestPropertyClass.cs

@@ -1,6 +0,0 @@
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class TestPropertyClass
-{
-    public int IntProperty { get; set; }
-}

+ 0 - 23
src/PixiEditorTests/ModelsTests/ControllersTests/TestReadonlyTool.cs

@@ -1,23 +0,0 @@
-using System;
-using ChunkyImageLib.DataHolders;
-using PixiEditor.DrawingApi.Core.Numerics;
-using PixiEditor.Models.Tools;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class TestReadonlyTool : ReadonlyTool
-{
-    public override string Tooltip => "";
-
-    public TestReadonlyTool(Action toolAction)
-    {
-        ToolAction = toolAction;
-    }
-
-    public Action ToolAction { get; set; }
-
-    public override void Use(VecD pos)
-    {
-        ToolAction();
-    }
-}

+ 0 - 254
src/PixiEditorTests/ModelsTests/ControllersTests/UndoManagerTests.cs

@@ -1,254 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.Undo;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ControllersTests;
-
-public class UndoManagerTests
-{
-    public UndoManagerTests()
-    {
-        PrepareUndoManagerForTest();
-    }
-
-    public int ExampleProperty { get; set; } = 1;
-
-    public TestPropertyClass TestPropClass { get; set; } = new TestPropertyClass();
-
-    [Fact]
-    public void TestSetRoot()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-        Assert.Equal(this, undoManager.MainRoot);
-    }
-
-    [Fact]
-    public void TestAddToUndoStack()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("ExampleProperty", ExampleProperty, ExampleProperty);
-        undoManager.AddUndoChange(change);
-        Assert.True(undoManager.UndoStack.Count == 1);
-        Assert.True((int)undoManager.UndoStack.Peek().OldValue == ExampleProperty);
-    }
-
-    [Fact]
-    public void TestThatUndoAddsToRedoStack()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("ExampleProperty", ExampleProperty, ExampleProperty);
-        undoManager.AddUndoChange(change);
-        undoManager.Undo();
-        Assert.True(undoManager.RedoStack.Count == 1);
-    }
-
-    [Fact]
-    public void TestUndo()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("ExampleProperty", ExampleProperty, 55);
-        undoManager.AddUndoChange(change);
-        ExampleProperty = 55;
-        undoManager.Undo();
-        Assert.True((int)undoManager.RedoStack.Peek().OldValue == ExampleProperty);
-    }
-
-    [Fact]
-    public void TestThatRedoAddsToUndoStack()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("ExampleProperty", ExampleProperty, ExampleProperty);
-        undoManager.AddUndoChange(change);
-        undoManager.Undo();
-        undoManager.Redo();
-        Assert.True(undoManager.UndoStack.Count == 1);
-    }
-
-    [Fact]
-    public void TestRedo()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        ExampleProperty = 55;
-        using var change = new Change("ExampleProperty", 1, ExampleProperty);
-        undoManager.AddUndoChange(change);
-        undoManager.Undo();
-        undoManager.Redo();
-        Assert.True((int)undoManager.UndoStack.Peek().NewValue == ExampleProperty);
-    }
-
-    [Fact]
-    public void TestThatUndoManagerUndoAndRedoWithCustomRootCorrectly()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        TestPropertyClass testProp = new TestPropertyClass();
-        int newVal = 5;
-        testProp.IntProperty = newVal;
-        using var change = new Change("IntProperty", 0, newVal, root: testProp);
-        undoManager.AddUndoChange(change);
-        Assert.Equal(newVal, testProp.IntProperty);
-
-        undoManager.Undo();
-
-        Assert.Equal(0, testProp.IntProperty);
-
-        undoManager.Redo();
-
-        Assert.Equal(newVal, testProp.IntProperty);
-    }
-
-    [Fact]
-    public void TestThatMixedProcessOfUndoAndRedoWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        int newVal = 5;
-        using var change = new Change(
-            "ExampleProperty",
-            ReverseProcess,
-            new object[] { ExampleProperty },
-            newVal);
-        undoManager.AddUndoChange(change);
-
-        ExampleProperty = newVal;
-
-        Assert.Equal(newVal, ExampleProperty);
-
-        undoManager.Undo();
-
-        Assert.Equal(1, ExampleProperty);
-
-        undoManager.Redo();
-
-        Assert.Equal(newVal, ExampleProperty);
-    }
-
-    [Fact]
-    public void TestThatProcessBasedUndoAndRedoWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        int newVal = 5;
-        using var change = new Change(
-            ReverseProcess,
-            new object[] { ExampleProperty },
-            ReverseProcess,
-            new object[] { newVal });
-        undoManager.AddUndoChange(change);
-
-        ExampleProperty = newVal;
-
-        Assert.Equal(newVal, ExampleProperty);
-
-        undoManager.Undo();
-
-        Assert.Equal(1, ExampleProperty);
-
-        undoManager.Redo();
-
-        Assert.Equal(newVal, ExampleProperty);
-    }
-
-    [Fact]
-    public void TestThatNestedPropertyUndoWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        int newVal = 5;
-        using var change = new Change("TestPropClass.IntProperty", TestPropClass.IntProperty, newVal);
-        undoManager.AddUndoChange(change);
-
-        TestPropClass.IntProperty = newVal;
-
-        Assert.Equal(newVal, TestPropClass.IntProperty);
-
-        undoManager.Undo();
-
-        Assert.Equal(0, TestPropClass.IntProperty);
-
-        undoManager.Redo();
-
-        Assert.Equal(newVal, TestPropClass.IntProperty);
-    }
-
-    [Fact]
-    public void TestThatFindRootProcessWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change1 = new Change("IntProperty", 0, 5, FindRootProcess, null);
-        undoManager.AddUndoChange(change1);
-
-        Change change = undoManager.UndoStack.Peek();
-
-        Assert.Equal(TestPropClass, change.FindRootProcess(change.FindRootProcessArgs));
-    }
-
-    [Fact]
-    public void TestThatUndoForFindRootProcessWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("IntProperty", 0, 5, FindRootProcess, null);
-        undoManager.AddUndoChange(change);
-
-        TestPropClass.IntProperty = 5;
-
-        undoManager.Undo();
-
-        Assert.Equal(0, TestPropClass.IntProperty);
-    }
-
-    [Fact]
-    public void TestThatUndoAndRedoForFindRootProcessWorks()
-    {
-        PrepareUndoManagerForTest();
-        using UndoManager undoManager = new UndoManager(this);
-
-        using var change = new Change("IntProperty", 0, 5, FindRootProcess, null);
-        undoManager.AddUndoChange(change);
-
-        TestPropClass.IntProperty = 5;
-
-        undoManager.Undo();
-
-        Assert.Equal(0, TestPropClass.IntProperty);
-
-        undoManager.Redo();
-
-        Assert.Equal(5, TestPropClass.IntProperty);
-    }
-
-    private object FindRootProcess(object[] args)
-    {
-        return TestPropClass;
-    }
-
-    private void ReverseProcess(object[] args)
-    {
-        ExampleProperty = (int)args[0];
-    }
-
-    private void PrepareUndoManagerForTest()
-    {
-        ExampleProperty = 1;
-        TestPropClass = new TestPropertyClass { IntProperty = 0 };
-    }
-}

+ 0 - 34
src/PixiEditorTests/ModelsTests/DataHoldersTests/BitmapPixelChangesTests.cs

@@ -1,34 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-public class BitmapPixelChangesTests
-{
-    [Fact]
-    public void TestThatFromSingleColoredArrayCreatesCorrectArray()
-    {
-        Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 0), new Coordinates(3, 2) };
-        BitmapPixelChanges bmpChanges = BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Lime);
-
-        Assert.All(bmpChanges.ChangedPixels.Values, changeColor => Assert.Equal(SKColors.Lime, changeColor));
-        Assert.True(bmpChanges.WasBuiltAsSingleColored);
-    }
-
-    [Fact]
-    public void TestThatCombineCombineOverrideCombinesValues()
-    {
-        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) };
-        BitmapPixelChanges changes = BitmapPixelChanges.FromSingleColoredArray(cords1, SKColors.Lime);
-        BitmapPixelChanges changes2 = BitmapPixelChanges.FromSingleColoredArray(cords2, SKColors.Red);
-
-        BitmapPixelChanges output = BitmapPixelChanges.CombineOverride(new[] { changes, changes2 });
-        Assert.Equal(4, output.ChangedPixels.Count);
-        Assert.Equal(SKColors.Red, output.ChangedPixels[new Coordinates(3, 2)]);
-        Assert.Equal(SKColors.Red, output.ChangedPixels[new Coordinates(0, 0)]);
-        Assert.Equal(SKColors.Lime, output.ChangedPixels[new Coordinates(1, 0)]);
-    }
-}

+ 0 - 152
src/PixiEditorTests/ModelsTests/DataHoldersTests/DocumentLayersTests.cs

@@ -1,152 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-[Collection("Application collection")]
-public class DocumentLayersTests
-{
-    [Fact]
-    public void TestThatToggleLayerDoesNotToggleLastLayer()
-    {
-        using Document doc = new(5, 5);
-        doc.AddNewLayer("layer");
-        bool isActive = doc.Layers[^1].IsActive;
-        doc.ToggleLayer(0);
-        Assert.False(doc.Layers[^1].IsActive != isActive);
-    }
-
-    [Fact]
-    public void TestThatToggleLayerTogglesLayer()
-    {
-        using Document doc = new(5, 5);
-        doc.AddNewLayer("layer");
-        doc.AddNewLayer("layer 1");
-        doc.Layers[0].IsActive = true;
-        doc.Layers[^1].IsActive = true;
-
-        doc.ToggleLayer(0);
-        Assert.False(doc.Layers[0].IsActive);
-        Assert.True(doc.Layers[1].IsActive);
-    }
-
-    [Fact]
-    public void TestThatToggleLayerDoesNothingOnNonExistingIndex()
-    {
-        using Document document = new Document(5, 5);
-        document.AddNewLayer("test");
-        document.ToggleLayer(1);
-        document.ToggleLayer(-1);
-        Assert.True(true);
-    }
-
-    [Theory]
-    [InlineData(0, 2)]
-    [InlineData(2, 0)]
-    [InlineData(1, 1)]
-    public void TestThatSelectLayersRangeSelectsRange(int startIndex, int endIndex)
-    {
-        using Document document = new Document(5, 5);
-
-        document.AddNewLayer("1");
-        document.AddNewLayer("2");
-        document.AddNewLayer("3");
-
-        document.SetMainActiveLayer(startIndex);
-
-        document.SelectLayersRange(endIndex);
-
-        for (int i = 0; i < document.Layers.Count; i++)
-        {
-            Assert.Equal(
-                i >= Math.Min(startIndex, endIndex)
-                && i <= Math.Max(startIndex, endIndex),
-                document.Layers[i].IsActive);
-        }
-    }
-
-    [Theory]
-    [InlineData(0)]
-    [InlineData(1)]
-    [InlineData(2)]
-    public void TestThatDeselectAllExceptDeselectsAllExceptLayer(int index)
-    {
-        using Document document = new Document(5, 5);
-
-        document.AddNewLayer("1");
-        document.AddNewLayer("2");
-        document.AddNewLayer("3");
-
-        document.SetMainActiveLayer(0);
-        document.Layers[1].IsActive = true;
-        document.Layers[2].IsActive = true;
-
-        document.DeselectAllExcept(document.Layers[index]);
-
-        foreach (var layer in document.Layers)
-        {
-            Assert.Equal(layer == document.Layers[index], layer.IsActive);
-        }
-    }
-
-    [Fact]
-    public void TestThatUpdateLayersColorMakesOnlyOneLayerMainColorAndOtherSecondary()
-    {
-        using Document document = new Document(1, 1);
-
-        document.AddNewLayer("1");
-        document.AddNewLayer("2");
-        document.AddNewLayer("3");
-
-        document.SetMainActiveLayer(0);
-        document.Layers[1].IsActive = true; // This makes layer selected, but not main
-        document.Layers[2].IsActive = true;
-
-        document.UpdateLayersColor();
-
-        Assert.Equal(Document.MainSelectedLayerColor, document.Layers[0].LayerHighlightColor);
-        Assert.Equal(Document.SecondarySelectedLayerColor, document.Layers[1].LayerHighlightColor);
-        Assert.Equal(Document.SecondarySelectedLayerColor, document.Layers[2].LayerHighlightColor);
-    }
-
-    [Fact]
-    public void TestThatUpdateLayersColorMakesLayerMainColorAndRestNonActiveReturnsTransparent()
-    {
-        using Document document = new Document(1, 1);
-
-        document.AddNewLayer("1");
-        document.AddNewLayer("2");
-        document.AddNewLayer("3");
-
-        document.SetMainActiveLayer(1);
-
-        document.UpdateLayersColor();
-
-        string transparentHex = "#00000000";
-
-        Assert.Equal(transparentHex, document.Layers[0].LayerHighlightColor);
-        Assert.Equal(Document.MainSelectedLayerColor, document.Layers[1].LayerHighlightColor);
-        Assert.Equal(transparentHex, document.Layers[2].LayerHighlightColor);
-    }
-
-    [Fact]
-    public void TestThatSetNextSelectedLayerAsActiveSelectsFirstAvailableLayer()
-    {
-        using Document document = new Document(1, 1);
-
-        document.AddNewLayer("1");
-        document.AddNewLayer("2");
-        document.AddNewLayer("3");
-        document.AddNewLayer("4");
-
-        foreach (var layer in document.Layers)
-        {
-            layer.IsActive = true;
-        }
-
-        document.SetNextSelectedLayerAsActive(document.Layers[1].GuidValue);
-
-        Assert.Equal(document.Layers[0].GuidValue, document.ActiveLayerGuid);
-    }
-}

+ 0 - 354
src/PixiEditorTests/ModelsTests/DataHoldersTests/DocumentTests.cs

@@ -1,354 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Enums;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using PixiEditor.ViewModels;
-using PixiEditorTests.HelpersTests;
-using SkiaSharp;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-[Collection("Application collection")]
-public class DocumentTests
-{
-    //[Theory]
-    //[InlineData(10, 10, 20, 20)]
-    //[InlineData(1, 2, 5, 8)]
-    //[InlineData(20, 20, 10, 10)] // TODO Anchor
-    //public void TestResizeCanvasResizesProperly(int oldWidth, int oldHeight, int newWidth, int newHeight)
-    //{
-    //    Document document = new Document(oldWidth, oldHeight);
-
-    //    document.ResizeCanvas(newWidth, newHeight, AnchorPoint.Top | AnchorPoint.Left);
-    //    Assert.Equal(newHeight, document.Height);
-    //    Assert.Equal(newWidth, document.Width);
-    //}
-
-    //[Theory]
-    //[InlineData(10, 10, 20, 20)]
-    //[InlineData(5, 8, 10, 16)]
-    //public void TestResizeWorks(int oldWidth, int oldHeight, int newWidth, int newHeight)
-    //{
-    //    Document document = new Document(oldWidth, oldHeight);
-
-    //    document.Resize(newWidth, newHeight);
-
-    //    Assert.Equal(newHeight, document.Height);
-    //    Assert.Equal(newWidth, document.Width);
-    //}
-
-    //[Theory]
-    //[InlineData(10, 10, 0, 0)]
-    //[InlineData(50, 50, 10, 49)]
-    //public void TestThatClipCanvasWorksForSingleLayer(int initialWidth, int initialHeight, int additionalPixelX, int additionalPixelY)
-    //{
-    //    Document document = new Document(initialWidth, initialHeight);
-    //    BitmapManager manager = new BitmapManager
-    //    {
-    //        ActiveDocument = document
-    //    };
-    //    manager.ActiveDocument.AddNewLayer("test");
-    //    manager.ActiveLayer.SetPixel(
-    //        new Coordinates(
-    //        (int)Math.Ceiling(initialWidth / 2f),
-    //        (int)Math.Ceiling(initialHeight / 2f)), SKColors.Black);
-
-    //    manager.ActiveLayer.SetPixel(new Coordinates(additionalPixelX, additionalPixelY), SKColors.Black);
-
-    //    document.ClipCanvas();
-
-    //    Assert.Equal(manager.ActiveLayer.Width, document.Width);
-    //    Assert.Equal(manager.ActiveLayer.Height, document.Height);
-    //}
-
-    //[Theory]
-    //[InlineData(10, 10, 0, 0)]
-    //[InlineData(50, 50, 15, 23)]
-    //[InlineData(3, 3, 1, 1)]
-    //[InlineData(1, 1, 0, 0)]
-    //public void TestThatClipCanvasWorksForMultipleLayers(int initialWidth, int initialHeight, int secondLayerPixelX, int secondLayerPixelY)
-    //{
-    //    Document document = new Document(initialWidth, initialHeight);
-    //    BitmapManager manager = new BitmapManager
-    //    {
-    //        ActiveDocument = document
-    //    };
-    //    manager.ActiveDocument.AddNewLayer("test");
-    //    manager.ActiveLayer.SetPixel(
-    //        new Coordinates(
-    //        (int)Math.Ceiling(initialWidth / 2f),
-    //        (int)Math.Ceiling(initialHeight / 2f)), SKColors.Black); // Set pixel in center
-
-    //    manager.ActiveDocument.AddNewLayer("test2");
-
-    //    manager.ActiveLayer.SetPixel(new Coordinates(secondLayerPixelX, secondLayerPixelY), SKColors.Black);
-
-    //    document.ClipCanvas();
-
-    //    int totalWidth = Math.Abs(manager.ActiveDocument.Layers[1].OffsetX +
-    //        manager.ActiveDocument.Layers[1].Width - (manager.ActiveDocument.Layers[0].OffsetX +
-    //                                                  manager.ActiveDocument.Layers[0].Width)) + 1;
-
-    //    int totalHeight = Math.Abs(manager.ActiveDocument.Layers[1].OffsetY +
-    //        manager.ActiveDocument.Layers[1].Height - (manager.ActiveDocument.Layers[0].OffsetY +
-    //                                                   manager.ActiveDocument.Layers[0].Height)) + 1;
-
-    //    Assert.Equal(totalWidth, document.Width);
-    //    Assert.Equal(totalHeight, document.Height);
-    //}
-
-    //[Theory]
-    //[InlineData(10, 10)]
-    //[InlineData(11, 11)]
-    //[InlineData(25, 17)]
-    //public void TestThatCenterContentCentersContentForSingleLayer(int docWidth, int docHeight)
-    //{
-    //    Document doc = new Document(docWidth, docHeight);
-    //    BitmapManager manager = new BitmapManager
-    //    {
-    //        ActiveDocument = doc
-    //    };
-    //    manager.ActiveDocument.AddNewLayer("test");
-
-    //    manager.ActiveLayer.SetPixel(new Coordinates(0, 0), SKColors.Lime);
-
-    //    doc.CenterContent();
-
-    //    Assert.Equal(Math.Floor(docWidth / 2f), manager.ActiveLayer.OffsetX);
-    //    Assert.Equal(Math.Floor(docHeight / 2f), manager.ActiveLayer.OffsetY);
-    //}
-
-    //[Theory]
-    //[InlineData(10, 10)]
-    //[InlineData(11, 11)]
-    //[InlineData(25, 17)]
-    //public void TestThatCenterContentCentersContentForMultipleLayers(int docWidth, int docHeight)
-    //{
-    //    Document doc = new Document(docWidth, docHeight);
-    //    BitmapManager manager = new BitmapManager
-    //    {
-    //        ActiveDocument = doc
-    //    };
-    //    manager.ActiveDocument.AddNewLayer("test");
-    //    manager.ActiveLayer.SetPixel(new Coordinates(0, 0), SKColors.Lime);
-
-    //    manager.ActiveDocument.AddNewLayer("test2");
-    //    manager.ActiveLayer.SetPixel(new Coordinates(1, 1), SKColors.Lime);
-
-    //    foreach (var layer in manager.ActiveDocument.Layers)
-    //    {
-    //        layer.IsActive = true;
-    //    }
-
-    //    doc.CenterContent();
-
-    //    int midWidth = (int)Math.Floor(docWidth / 2f);
-    //    int midHeight = (int)Math.Floor(docHeight / 2f);
-
-    //    Assert.Equal(midWidth - 1, manager.ActiveDocument.Layers[0].OffsetX);
-    //    Assert.Equal(midHeight - 1, manager.ActiveDocument.Layers[0].OffsetY);
-
-    //    Assert.Equal(midWidth, manager.ActiveDocument.Layers[1].OffsetX);
-    //    Assert.Equal(midHeight, manager.ActiveDocument.Layers[1].OffsetY);
-    //}
-
-    //[Fact]
-    //public void TestThatSetNextActiveLayerSetsLayerBelow()
-    //{
-    //    Document doc = new Document(10, 10);
-    //    doc.Layers.Add(new PixiEditor.Models.Layers.Layer("Test"));
-    //    doc.Layers.Add(new PixiEditor.Models.Layers.Layer("Test 2"));
-
-    //    doc.SetMainActiveLayer(1);
-
-    //    doc.SetNextLayerAsActive(1);
-
-    //    Assert.False(doc.Layers[1].IsActive);
-    //    Assert.True(doc.Layers[0].IsActive);
-    //}
-
-    //[Fact]
-    //public void TestThatAddNewLayerAddsUndoChange()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    Assert.Single(document.UndoManager.UndoStack);
-    //}
-
-    //[Fact]
-    //public void TestThatAddNewLayerUndoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    document.UndoManager.Undo();
-
-    //    Assert.Single(document.Layers);
-    //}
-
-    //[Fact]
-    //public void TestThatAddNewLayerRedoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    document.UndoManager.Undo();
-    //    document.UndoManager.Redo();
-
-    //    Assert.Equal(2, document.Layers.Count);
-    //}
-
-    //[Fact]
-    //public void TestThatRemoveLayerUndoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    document.RemoveLayer(1);
-
-    //    document.UndoManager.Undo();
-
-    //    Assert.Equal(2, document.Layers.Count);
-    //}
-
-    //[Fact]
-    //public void TestThatRemoveLayerRedoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    document.RemoveLayer(1);
-
-    //    document.UndoManager.Undo();
-    //    document.UndoManager.Redo();
-
-    //    Assert.Single(document.Layers);
-    //}
-
-    //[Theory]
-    //[InlineData(2, 0, 1)]
-    //[InlineData(2, 1, -1)]
-    //[InlineData(3, 1, 1)]
-    //[InlineData(3, 2, -2)]
-    //[InlineData(10, 9, -5)]
-    //public void TestThatMoveLayerInStructureWorks(int layersAmount, int index, int amount)
-    //{
-    //    Document document = new Document(10, 10);
-    //    for (int i = 0; i < layersAmount; i++)
-    //    {
-    //        document.AddNewLayer("Layer " + i);
-    //    }
-
-    //    Guid oldGuid = document.Layers[index].LayerGuid;
-    //    Guid referenceGuid = document.Layers[index + amount].LayerGuid;
-    //    document.MoveLayerInStructure(oldGuid, referenceGuid, amount > 0);
-
-    //    Assert.Equal(oldGuid, document.Layers[index + amount].LayerGuid);
-    //}
-
-    //[Fact]
-    //public void TestThatMoveLayerInStructureUndoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    Guid oldGuid = document.Layers[0].LayerGuid;
-    //    Guid referenceGuid = document.Layers[1].LayerGuid;
-
-    //    document.MoveLayerInStructure(oldGuid, referenceGuid);
-
-    //    document.UndoManager.Undo();
-
-    //    Assert.Equal("Test2", document.Layers[1].Name);
-    //    Assert.Equal("Test", document.Layers[0].Name);
-    //}
-
-    //[Fact]
-    //public void TestThatMoveLayerInStructureRedoProcessWorks()
-    //{
-    //    Document document = new Document(10, 10);
-
-    //    document.AddNewLayer("Test");
-    //    document.AddNewLayer("Test2");
-
-    //    Guid oldGuid = document.Layers[0].LayerGuid;
-    //    Guid referenceGuid = document.Layers[1].LayerGuid;
-
-    //    document.MoveLayerInStructure(oldGuid, referenceGuid, true);
-
-    //    document.UndoManager.Undo();
-    //    document.UndoManager.Redo();
-
-    //    Assert.Equal("Test", document.Layers[1].Name);
-    //    Assert.Equal("Test2", document.Layers[0].Name);
-    //}
-
-    //[StaFact]
-    //public void TestThatDocumentGetsAddedToRecentlyOpenedList()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    Document document = new Document(1, 1)
-    //    {
-    //        XamlAccesibleViewModel = viewModel
-    //    };
-
-    //    string testFilePath = @"C:\idk\somewhere\homework";
-
-    //    document.DocumentFilePath = testFilePath;
-
-    //    Assert.Contains(viewModel.FileSubViewModel.RecentlyOpened, x => x.FilePath == testFilePath);
-    //}
-
-    //[Fact]
-    //public void TestThatDupliacteLayerWorks()
-    //{
-    //    const string layerName = "New Layer";
-
-    //    Document document = new(10, 10);
-
-    //    document.AddNewLayer(layerName);
-    //    Layer duplicate = document.DuplicateLayer(0);
-
-    //    Assert.Equal(document.Layers[1], duplicate);
-    //    Assert.Equal(layerName + " (1)", duplicate.Name);
-    //    Assert.True(duplicate.IsActive);
-    //}
-
-    //[Fact]
-    //public void TestThatCorrectLayerSuffixIsSet()
-    //{
-    //    const string layerName = "New Layer";
-
-    //    Document document = new(10, 10);
-
-    //    document.AddNewLayer(layerName);
-    //    document.AddNewLayer(layerName);
-    //    document.AddNewLayer(layerName);
-
-    //    Assert.Equal(layerName, document.Layers[0].Name);
-    //    Assert.Equal(layerName + " (1)", document.Layers[1].Name);
-    //    Assert.Equal(layerName + " (2)", document.Layers[2].Name);
-
-    //    document.Layers.Add(new Layer(layerName + " (15)"));
-    //    document.AddNewLayer(layerName);
-
-    //    Assert.Equal(layerName + " (16)", document.Layers[4].Name);
-    //}
-}

+ 0 - 243
src/PixiEditorTests/ModelsTests/DataHoldersTests/LayerStructureTests.cs

@@ -1,243 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Layers;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-public class LayerStructureTests
-{
-    [Fact]
-    public void TestThatAddNewGroupAddsNewGroup()
-    {
-        using Document doc = new Document(1, 1);
-        doc.Layers.Add(new("_testLayer", 1, 1));
-        var testLayer = doc.Layers[^1];
-        doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);
-
-        Assert.Single(doc.LayerStructure.Groups);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].StartLayerGuid);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].EndLayerGuid);
-    }
-
-    [Fact]
-    public void TestThatAddNewGroupAddsNewGroupAsASubgroup()
-    {
-        using Document doc = new Document(1, 1);
-        doc.Layers.Add(new("_testLayer", 1, 1));
-        var testLayer = doc.Layers[^1];
-        doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);
-        doc.LayerStructure.AddNewGroup("test1", testLayer.GuidValue);
-
-        Assert.Single(doc.LayerStructure.Groups);
-        Assert.Single(doc.LayerStructure.Groups[0].Subgroups);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].StartLayerGuid);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].EndLayerGuid);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].Subgroups[0].StartLayerGuid);
-        Assert.Equal(testLayer.GuidValue, doc.LayerStructure.Groups[0].Subgroups[0].EndLayerGuid);
-    }
-
-    [Fact]
-    public void TestThatMoveGroupMovesSwapsLayerPlacesWithOtherGroup()
-    {
-        using Document doc = new Document(1, 1);
-        doc.Layers.Add(new Layer("_testLayer", 1, 1));
-        doc.Layers.Add(new Layer("_testLayer1", 1, 1));
-        var testLayer = doc.Layers[0];
-        var testLayer1 = doc.Layers[^1];
-        doc.LayerStructure.AddNewGroup("test", testLayer.GuidValue);
-        doc.LayerStructure.AddNewGroup("test1", testLayer1.GuidValue);
-
-        Assert.Equal(0, doc.Layers.IndexOf(testLayer));
-        Assert.Equal(1, doc.Layers.IndexOf(testLayer1));
-
-        doc.LayerStructure.MoveGroup(doc.LayerStructure.Groups[0].GroupGuid, 1);
-
-        Assert.Equal(1, doc.Layers.IndexOf(testLayer));
-        Assert.Equal(0, doc.Layers.IndexOf(testLayer1));
-    }
-
-    [Fact]
-    public void TestThatIsChildOfDetectsNestedGroupCorrectly()
-    {
-        using var doc = new Document(1, 1);
-        LayerStructure ls = new LayerStructure(doc);
-        Layer testLayer = new Layer("tst", 1, 1);
-        ls.Groups.Add(new GuidStructureItem("group 1", testLayer.GuidValue));
-        ls.Groups[0].Subgroups.Add(new GuidStructureItem("group 1 nested", testLayer.GuidValue));
-
-        Assert.True(ls.IsChildOf(ls.Groups[0].Subgroups[0], ls.Groups[0]));
-        Assert.False(ls.IsChildOf(ls.Groups[0], ls.Groups[0].Subgroups[0]));
-    }
-
-    [Fact]
-    public void TestThatIsChildOfDetectsNestedLayersCorrectly()
-    {
-        using var doc = new Document(1, 1);
-        doc.Layers.Add(new Layer("tst", 1, 1));
-        Guid testLayerGuid = doc.Layers[0].GuidValue;
-        LayerStructure ls = new LayerStructure(doc);
-        ls.AddNewGroup("Test group", testLayerGuid);
-        ls.AddNewGroup("Test group nested", testLayerGuid);
-
-        Assert.True(ls.IsChildOf(testLayerGuid, ls.Groups[0]));
-        Assert.True(ls.IsChildOf(testLayerGuid, ls.Groups[0].Subgroups[0]));
-    }
-
-    [Fact]
-    public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerCorrectly()
-    {
-        using var doc = new Document(1, 1);
-        doc.Layers.Add(new Layer("layer", 1, 1));
-        var guid = doc.Layers[0].GuidValue;
-        doc.LayerStructure.AddNewGroup("layer group", guid);
-        Assert.True(LayerStructure.GroupContainsOnlyLayer(guid, doc.LayerStructure.Groups[0]));
-    }
-
-    [Fact]
-    public void TestThatGroupContainsOnlyLayerDetectsOnlySingleLayerThatIsNested()
-    {
-        using var doc = new Document(1, 1);
-        doc.Layers.Add(new Layer("layer", 1, 1));
-        var guid = doc.Layers[0].GuidValue;
-        doc.LayerStructure.AddNewGroup("layer group", guid);
-        doc.LayerStructure.AddNewGroup("layer group nested", guid);
-        Assert.False(LayerStructure.GroupContainsOnlyLayer(guid, doc.LayerStructure.Groups[0]));
-        Assert.True(LayerStructure.GroupContainsOnlyLayer(guid, doc.LayerStructure.Groups[0].Subgroups[0]));
-    }
-
-    [Fact]
-    public void TestThatCloneReturnsSameLayerStructure()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new("Test", 1, 1));
-        doc.Layers.Add(new("Test2", 1, 1));
-        LayerStructure structure = new(doc);
-        structure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-
-        var clone = structure.CloneGroups();
-
-        Assert.Equal(structure.Groups.Count, clone.Count);
-        Assert.Single(clone);
-        Assert.Equal(structure.Groups[0].GroupGuid, clone[0].GroupGuid);
-    }
-
-    [Fact]
-    public void TestThatGetGroupByGuidReturnsNullForNonExistingGroup()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new("Test", 1, 1));
-
-        Assert.Null(doc.LayerStructure.GetGroupByGuid(null));
-        Assert.Null(doc.LayerStructure.GetGroupByGuid(Guid.NewGuid()));
-    }
-
-    [Fact]
-    public void TestThatGetGroupByGuidReturnsGroupCorrectly()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new("Test", 1, 1));
-        var group = doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-
-        Assert.Equal(group.GroupGuid, doc.LayerStructure.GetGroupByGuid(group.GroupGuid).GroupGuid);
-    }
-
-    [Fact]
-    public void TestThatPreMoveReassignBoundsMakesNestedGroupEmptyAndRemovesItAndParent()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new("Test", 1, 1));
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-        var group1 = doc.LayerStructure.AddNewGroup("Test group nested", doc.Layers[0].GuidValue);
-
-        doc.LayerStructure.Unassign(new GroupData(group1.GroupGuid), doc.Layers[0].GuidValue);
-
-        Assert.Empty(doc.LayerStructure.Groups);
-    }
-
-    [Fact]
-    public void TestThatPostMoveReassignBoundsAssignsNewLayerToGroup()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new("Test", 1, 1));
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-        var group1 = doc.LayerStructure.AddNewGroup("Test group nested", doc.Layers[0].GuidValue);
-
-        doc.Layers.Add(new("Test 1", 1, 1));
-
-        var firstLayer = doc.Layers[0];
-        var layer = doc.Layers[^1];
-
-        doc.LayerStructure.Assign(new GroupData(group1.GroupGuid), layer.GuidValue);
-
-        Assert.Single(doc.LayerStructure.Groups);
-        Assert.Single(doc.LayerStructure.Groups[0].Subgroups);
-        Assert.Equal(layer.GuidValue, doc.LayerStructure.Groups[0].Subgroups[0].EndLayerGuid);
-        Assert.Equal(firstLayer.GuidValue, doc.LayerStructure.Groups[0].Subgroups[0].StartLayerGuid);
-        Assert.Equal(layer.GuidValue, doc.LayerStructure.Groups[0].EndLayerGuid);
-        Assert.Equal(firstLayer.GuidValue, doc.LayerStructure.Groups[0].StartLayerGuid);
-    }
-
-    [Fact]
-    public void TestThatAssignParentAssignsParent()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new Layer("Test", 1, 1));
-
-        var firstLayer = doc.Layers[0];
-
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-
-        doc.Layers.Add(new Layer("Test 1", 1, 1));
-
-        var layer = doc.Layers[^1];
-
-        doc.LayerStructure.AssignParent(doc.Layers[^1].GuidValue, doc.LayerStructure.Groups[0].GroupGuid);
-
-        Assert.Equal(layer.GuidValue, doc.LayerStructure.Groups[0].EndLayerGuid);
-        Assert.Equal(firstLayer.GuidValue, doc.LayerStructure.Groups[0].StartLayerGuid);
-    }
-
-    [Fact]
-    public void TestThatAssignParentDeAssignsParentOnNull()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new Layer("Test", 1, 1));
-
-        var firstLayer = doc.Layers[0];
-
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-
-        doc.Layers.Add(new Layer("Test 1", 1, 1));
-
-        var layer = doc.Layers[^1];
-
-        doc.LayerStructure.AssignParent(layer.GuidValue, doc.LayerStructure.Groups[0].GroupGuid);
-        doc.LayerStructure.AssignParent(layer.GuidValue, null);
-
-        Assert.Equal(firstLayer.GuidValue, doc.LayerStructure.Groups[0].EndLayerGuid);
-        Assert.Equal(firstLayer.GuidValue, doc.LayerStructure.Groups[0].StartLayerGuid);
-    }
-
-    [Fact]
-    public void TestThatGetGroupLayersReturnsAllLayersInGroup()
-    {
-        using Document doc = new(1, 1);
-        doc.Layers.Add(new Layer("Test", 1, 1));
-        doc.Layers.Add(new Layer("Test 1", 1, 1));
-        doc.Layers.Add(new Layer("Test 2", 1, 1));
-        doc.Layers.Add(new Layer("Test 3", 1, 1));
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[0].GuidValue);
-
-        doc.LayerStructure.AssignParent(doc.Layers[1].GuidValue, doc.LayerStructure.Groups[0].GroupGuid);
-        doc.LayerStructure.AssignParent(doc.Layers[2].GuidValue, doc.LayerStructure.Groups[0].GroupGuid);
-        doc.LayerStructure.AddNewGroup("Test group", doc.Layers[2].GuidValue);
-
-        var layersInGroup = doc.LayerStructure.GetGroupLayers(doc.LayerStructure.Groups[0]);
-
-        Assert.Equal(3, layersInGroup.Count);
-        Assert.Contains(doc.Layers[0], layersInGroup);
-        Assert.Contains(doc.Layers[1], layersInGroup);
-        Assert.Contains(doc.Layers[2], layersInGroup);
-    }
-}

+ 0 - 71
src/PixiEditorTests/ModelsTests/DataHoldersTests/RecentlyOpenedDocumentTests.cs

@@ -1,71 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Parser;
-using System;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-[Collection("Application collection")]
-public class RecentlyOpenedDocumentTests
-{
-    [Fact]
-    public void TestThatForBigPixiFilesPreviewImageIsResizedToMaxSize()
-    {
-        string bigFilePath = $@"{Environment.CurrentDirectory}\..\..\..\ModelsTests\IO\BigPixiFile.pixi";
-        RecentlyOpenedDocument recentlyOpenedDocument = new RecentlyOpenedDocument(bigFilePath);
-
-        var bigPixiFilePreviewImage = recentlyOpenedDocument.PreviewBitmap;
-
-        const int MaxWidthInPixels = 1080;
-        Assert.True(bigPixiFilePreviewImage.PixelWidth <= MaxWidthInPixels);
-
-        const int MaxHeightInPixels = 1080;
-        Assert.True(bigPixiFilePreviewImage.PixelHeight <= MaxHeightInPixels);
-
-        // This is a workaround for checking the Pixi file layers.
-        Assert.True(PixiParser.Deserialize(bigFilePath).Layers.Count <= 5);
-    }
-
-    [Fact]
-    public void TestThatForSmallEnoughPixiFilesPreviewImageIsLoaded()
-    {
-        string smallEnoughFilePath = $@"{Environment.CurrentDirectory}\..\..\..\ModelsTests\IO\SmallEnoughPixiFile.pixi";
-        RecentlyOpenedDocument recentlyOpenedDocument = new RecentlyOpenedDocument(smallEnoughFilePath);
-
-        var smallEnoughFilePreviewImage = recentlyOpenedDocument.PreviewBitmap;
-
-        Assert.NotNull(smallEnoughFilePreviewImage);
-    }
-
-    [Theory]
-    [InlineData("png")]
-    [InlineData("jpg")]
-    [InlineData("jpeg")]
-    public void TestThatForBigImageFilesPreviewImageIsResizedToMaxSize(string imageFormat)
-    {
-        string bigImageFilePath = $@"{Environment.CurrentDirectory}\..\..\..\ModelsTests\IO\BigImage.{imageFormat}";
-        RecentlyOpenedDocument recentlyOpenedDocument = new RecentlyOpenedDocument(bigImageFilePath);
-
-        var bigImagePreviewImage = recentlyOpenedDocument.PreviewBitmap;
-
-        const int MaxWidthInPixels = 2048;
-        Assert.True(bigImagePreviewImage.PixelWidth <= MaxWidthInPixels);
-
-        const int MaxHeightInPixels = 2048;
-        Assert.True(bigImagePreviewImage.PixelHeight <= MaxHeightInPixels);
-    }
-
-    [Theory]
-    [InlineData("png")]
-    [InlineData("jpg")]
-    [InlineData("jpeg")]
-    public void TestThatForSmallEnoughImageFilesPreviewImageIsLoaded(string imageFormat)
-    {
-        string smallEnoughImageFilePath = $@"{Environment.CurrentDirectory}\..\..\..\ModelsTests\IO\SmallEnoughImage.{imageFormat}";
-        RecentlyOpenedDocument recentlyOpenedDocument = new RecentlyOpenedDocument(smallEnoughImageFilePath);
-
-        var smallEnoughImagePreviewImage = recentlyOpenedDocument.PreviewBitmap;
-
-        Assert.NotNull(smallEnoughImagePreviewImage);
-    }
-}

+ 0 - 79
src/PixiEditorTests/ModelsTests/DataHoldersTests/SelectionTests.cs

@@ -1,79 +0,0 @@
-using PixiEditor.Helpers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Enums;
-using PixiEditor.Models.Position;
-using System;
-using System.Collections.Generic;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-
-public class SelectionTests
-{
-    [Fact]
-    public void TestThatSetSelectionNewSetsCorrectSelection()
-    {
-        Selection selection = new Selection(Array.Empty<Coordinates>(), new(10, 10));
-        Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };
-
-        selection.SetSelection(points, SelectionType.New);
-        selection.SetSelection(points, SelectionType.New); // Doing it twice, to check if it sets every time properly
-
-        Assert.Equal(points.Length, selection.SelectedPoints.Count);
-    }
-
-    [Fact]
-    public void TestThatSetSelectionAddSetsCorrectSelection()
-    {
-        Selection selection = new Selection(Array.Empty<Coordinates>(), new PixelSize(10, 10));
-        Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };
-        Coordinates[] points2 = { new Coordinates(2, 4), new Coordinates(5, 7) };
-
-        selection.SetSelection(points, SelectionType.Add);
-        selection.SetSelection(points2, SelectionType.Add); // Doing it twice, to check if it sets every time properly
-
-        Assert.Equal(points.Length + points2.Length, selection.SelectedPoints.Count);
-    }
-
-    [Fact]
-    public void TestThatSetSelectionSubtractSetsCorrectSelection()
-    {
-        Selection selection = new Selection(Array.Empty<Coordinates>(), new PixelSize(10, 10));
-        Coordinates[] points = { new Coordinates(0, 0), new Coordinates(1, 1) };
-        Coordinates[] points2 = { new Coordinates(1, 1) };
-
-        selection.SetSelection(points, SelectionType.Add);
-        selection.SetSelection(points2, SelectionType.Subtract); // Doing it twice, to check if it sets every time properly
-
-        Assert.Single(selection.SelectedPoints);
-    }
-
-    [Fact]
-    public void TestClearWorks()
-    {
-        Selection selection = new Selection(new[] { new Coordinates(0, 0), new Coordinates(5, 7) }, new PixelSize(10, 10));
-        selection.Clear();
-
-        Assert.Empty(selection.SelectedPoints);
-        Assert.Equal(1, selection.SelectionLayer.Width);
-        Assert.Equal(1, selection.SelectionLayer.Height);
-    }
-
-    [Fact]
-    public void TestThatUndoWorks()
-    {
-        using Document document = new Document(10, 10);
-
-        IEnumerable<Coordinates> oldSelection = new List<Coordinates>(document.ActiveSelection.SelectedPoints);
-
-        document.ActiveSelection.SetSelection(new[] { new Coordinates(0, 0), new Coordinates(5, 7) }, SelectionType.Add);
-
-        Assert.NotEqual(oldSelection, document.ActiveSelection.SelectedPoints);
-
-        SelectionHelpers.AddSelectionUndoStep(document, oldSelection, SelectionType.Add);
-
-        document.UndoManager.Undo();
-
-        Assert.Equal(oldSelection, document.ActiveSelection.SelectedPoints);
-    }
-}

+ 0 - 108
src/PixiEditorTests/ModelsTests/DataHoldersTests/SurfaceTests.cs

@@ -1,108 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.DataHoldersTests;
-#pragma warning disable CA1001 // Types that own disposable fields should be disposable
-public class SurfaceTests
-#pragma warning restore CA1001 // Types that own disposable fields should be disposable
-{
-    SKColor redColor = new SKColor(254, 2, 3);
-    SKColor greenColor = new SKColor(6, 224, 3);
-    SKPaint redPaint;
-    SKPaint greenPaint;
-
-    public SurfaceTests()
-    {
-        redPaint = new SKPaint()
-        {
-            Color = redColor,
-        };
-        greenPaint = new SKPaint()
-        {
-            Color = greenColor,
-        };
-    }
-
-    [Fact]
-    public void TestSurfaceSRGBPixelManipulation()
-    {
-        using Surface surface = new Surface(128, 200);
-        surface.SkiaSurface.Canvas.Clear(SKColors.Red);
-        surface.SkiaSurface.Canvas.DrawRect(new SKRect(10, 10, 70, 70), redPaint);
-        surface.SetSRGBPixel(73, 21, greenColor);
-        Assert.Equal(redColor, surface.GetSRGBPixel(14, 14));
-        Assert.Equal(greenColor, surface.GetSRGBPixel(73, 21));
-    }
-
-    [Fact]
-    public void TestSurfacePbgraBytes()
-    {
-        byte[] bytes = new byte[]
-        {
-            123, 121, 141, 255,  014, 010, 007, 255,
-            042, 022, 055, 128,  024, 020, 021, 128,
-            040, 010, 055, 064,  042, 022, 005, 064,
-            005, 009, 001, 032,  001, 011, 016, 032,
-        };
-        using Surface surface = new Surface(2, 4, bytes);
-        Assert.Equal(new SKColor(141, 121, 123, 255), surface.GetSRGBPixel(0, 0));
-        Assert.Equal(new SKColor(110, 44, 84, 128), surface.GetSRGBPixel(0, 1));
-        var newBytes = surface.ToByteArray();
-        Assert.Equal(bytes, newBytes);
-    }
-
-    [Fact]
-    public void TestCloneSurface()
-    {
-        using Surface original = new Surface(30, 40);
-        original.SkiaSurface.Canvas.Clear(redColor);
-        original.SkiaSurface.Canvas.DrawRect(5, 5, 10, 10, greenPaint);
-        using Surface clone = new Surface(original);
-        Assert.NotSame(original.SkiaSurface, clone.SkiaSurface);
-        Assert.NotSame(original.SkiaSurface.Canvas, clone.SkiaSurface.Canvas);
-        Assert.Equal(redColor, clone.GetSRGBPixel(3, 3));
-        Assert.Equal(greenColor, clone.GetSRGBPixel(6, 6));
-    }
-
-    [Fact]
-    public void TestSurfaceNearestNeighborResize()
-    {
-        using Surface original = new Surface(30, 40);
-        original.SkiaSurface.Canvas.Clear(redColor);
-        original.SkiaSurface.Canvas.DrawRect(5, 5, 20, 20, greenPaint);
-        using Surface resized = original.ResizeNearestNeighbor(10, 10);
-        Assert.Equal(10, resized.Width);
-        Assert.Equal(10, resized.Height);
-        Assert.Equal(redColor, resized.GetSRGBPixel(0, 0));
-        Assert.Equal(redColor, resized.GetSRGBPixel(9, 9));
-        Assert.Equal(greenColor, resized.GetSRGBPixel(5, 5));
-    }
-
-    [Fact]
-    public void TestSurfaceToWriteableBitmap()
-    {
-        using Surface original = new Surface(30, 40);
-        original.SkiaSurface.Canvas.Clear(redColor);
-        original.SkiaSurface.Canvas.DrawRect(5, 5, 20, 20, greenPaint);
-        var bitmap = original.ToWriteableBitmap();
-        byte[] pixels = new byte[30 * 40 * 4];
-        bitmap.CopyPixels(pixels, 30 * 4, 0);
-        Assert.Equal(redColor, new SKColor(pixels[2], pixels[1], pixels[0], pixels[3]));
-        int offset = (30 * 5 + 5) * 4;
-        Assert.Equal(greenColor, new SKColor(pixels[2 + offset], pixels[1 + offset], pixels[0 + offset], pixels[3 + offset]));
-    }
-
-    [Fact]
-    public void TestSurfaceFromWriteableBitmap()
-    {
-        using Surface original = new Surface(30, 30);
-        original.SkiaSurface.Canvas.Clear(SKColors.Transparent);
-        original.SkiaSurface.Canvas.DrawRect(5, 5, 20, 20, redPaint);
-        original.SkiaSurface.Canvas.DrawRect(10, 10, 20, 20, greenPaint);
-        using Surface fromWriteable = new Surface(original.ToWriteableBitmap());
-        Assert.Equal(original.GetSRGBPixel(0, 0), fromWriteable.GetSRGBPixel(0, 0));
-        Assert.Equal(original.GetSRGBPixel(6, 6), fromWriteable.GetSRGBPixel(6, 6));
-        Assert.Equal(original.GetSRGBPixel(15, 15), fromWriteable.GetSRGBPixel(15, 15));
-    }
-}

BIN
src/PixiEditorTests/ModelsTests/IO/BigImage.jpeg


BIN
src/PixiEditorTests/ModelsTests/IO/BigImage.jpg


BIN
src/PixiEditorTests/ModelsTests/IO/BigImage.png


BIN
src/PixiEditorTests/ModelsTests/IO/BigPixiFile.pixi


+ 0 - 0
src/PixiEditorTests/ModelsTests/IO/CorruptedJpg.jpg


+ 0 - 0
src/PixiEditorTests/ModelsTests/IO/CorruptedPNG.png


BIN
src/PixiEditorTests/ModelsTests/IO/CorruptedPNG2.png


BIN
src/PixiEditorTests/ModelsTests/IO/CorruptedPixiFile.pixi


+ 0 - 43
src/PixiEditorTests/ModelsTests/IO/ExporterTests.cs

@@ -1,43 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.IO;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using System.IO;
-using System.Windows.Media.Imaging;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.IO;
-
-public class ExporterTests
-{
-    //private const string FilePath = "test.file";
-
-    //[Fact]
-    //public void TestThatSaveAsPngSavesFile()
-    //{
-    //    Exporter.SaveAsPng(FilePath, 10, 10, BitmapFactory.New(10, 10));
-    //    Assert.True(File.Exists(FilePath));
-
-    //    File.Delete(FilePath);
-    //}
-
-    //[Fact]
-    //public void TestThatSaveAsEditableFileSavesPixiFile()
-    //{
-    //    Document document = new Document(2, 2);
-
-    //    string filePath = "testFile.pixi";
-
-    //    document.Layers.Add(new Layer("layer1"));
-    //    document.Layers[0].SetPixel(new Coordinates(1, 1), SKColors.White);
-
-    //    document.Swatches.Add(SKColors.White);
-
-    //    Exporter.SaveAsEditableFile(document, filePath);
-
-    //    Assert.True(File.Exists(filePath));
-
-    //    File.Delete(filePath);
-    //}
-}

+ 0 - 94
src/PixiEditorTests/ModelsTests/IO/ImporterTests.cs

@@ -1,94 +0,0 @@
-using PixiEditor.Exceptions;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.IO;
-using SkiaSharp;
-using System;
-using System.IO;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.IO;
-
-public class ImporterTests
-{
-    private readonly string testImagePath;
-    private readonly string testCorruptedPixiImagePath;
-
-    // I am not testing ImportDocument, because it's just a wrapper for BinarySerialization which is tested.
-    public ImporterTests()
-    {
-        testImagePath = $"{Environment.CurrentDirectory}\\..\\..\\..\\ModelsTests\\IO\\TestImage.png";
-        testCorruptedPixiImagePath = $"{Environment.CurrentDirectory}\\..\\..\\..\\ModelsTests\\IO\\CorruptedPixiFile.pixi";
-    }
-
-    [Theory]
-    [InlineData("wubba.png")]
-    [InlineData("lubba.pixi")]
-    [InlineData("dub.jpeg")]
-    [InlineData("-.JPEG")]
-    [InlineData("dub.jpg")]
-    [InlineData("dub.gif")]
-    [InlineData("dub.bmp")]
-    public void TestThatIsSupportedFile(string file)
-    {
-        Assert.True(Importer.IsSupportedFile(file));
-    }
-
-    [Fact]
-    public void TestThatImportImageImportsImage()
-    {
-        SKColor color = new SKColor(255, 0, 0, 255);
-        Surface image = Importer.ImportSurface(testImagePath);
-
-        Assert.NotNull(image);
-        Assert.Equal(5, image.Width);
-        Assert.Equal(5, image.Height);
-        Assert.Equal(color, image.GetSRGBPixel(0, 0)); // Top left
-        Assert.Equal(color, image.GetSRGBPixel(4, 4)); // Bottom right
-        Assert.Equal(color, image.GetSRGBPixel(0, 4)); // Bottom left
-        Assert.Equal(color, image.GetSRGBPixel(4, 0)); // Top right
-        Assert.Equal(color, image.GetSRGBPixel(2, 2)); // Middle center
-    }
-
-    [Fact]
-    public void TestThatImporterThrowsCorruptedFileExceptionOnWrongPixiFileWithSupportedExtension()
-    {
-        Assert.Throws<CorruptedFileException>(() => { Importer.ImportDocument(testCorruptedPixiImagePath); });
-    }
-
-    [Theory]
-    [InlineData("CorruptedPNG.png")]
-    [InlineData("CorruptedPNG2.png")]
-    [InlineData("CorruptedJpg.jpg")]
-    public void TestThatImporterThrowsCorruptedFileExceptionOnWrongImageFileWithSupportedExtension(string fileName)
-    {
-        string imagePath = $"{Environment.CurrentDirectory}\\..\\..\\..\\ModelsTests\\IO\\{fileName}";
-        Assert.Throws<CorruptedFileException>(() => { Importer.ImportSurface(imagePath); });
-    }
-
-    [Fact]
-    public void TestThatImportImageResizes()
-    {
-        Surface image = Importer.ImportImage(testImagePath, 10, 10);
-
-        Assert.Equal(10, image.Width);
-        Assert.Equal(10, image.Height);
-    }
-
-    [Fact]
-    public void TestSaveAndLoadGZippedBytes()
-    {
-        using Surface original = new Surface(123, 456);
-        original.SkiaSurface.Canvas.Clear(SKColors.Red);
-        using SKPaint paint = new SKPaint();
-        paint.BlendMode = SKBlendMode.Src;
-        paint.Color = new SKColor(128, 64, 32, 16);
-        original.SkiaSurface.Canvas.DrawRect(10, 10, 20, 20, paint);
-        Exporter.SaveAsGZippedBytes("pleasedontoverwritethings", original);
-        using var loaded = Importer.LoadFromGZippedBytes("pleasedontoverwritethings");
-        File.Delete("pleasedontoverwritethings");
-        Assert.Equal(original.Width, loaded.Width);
-        Assert.Equal(original.Height, loaded.Height);
-        Assert.Equal(original.GetSRGBPixel(0, 0), loaded.GetSRGBPixel(0, 0));
-        Assert.Equal(original.GetSRGBPixel(15, 15), loaded.GetSRGBPixel(15, 15));
-    }
-}

BIN
src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.jpeg


BIN
src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.jpg


BIN
src/PixiEditorTests/ModelsTests/IO/SmallEnoughImage.png


BIN
src/PixiEditorTests/ModelsTests/IO/SmallEnoughPixiFile.pixi


BIN
src/PixiEditorTests/ModelsTests/IO/TestImage.png


+ 0 - 78
src/PixiEditorTests/ModelsTests/ImageManipulationTests/BitmapUtilsTests.cs

@@ -1,78 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.ImageManipulation;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using SkiaSharp;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ImageManipulationTests;
-
-public class BitmapUtilsTests
-{
-
-    //[Fact]
-    //public void TestThatCombineLayersReturnsCorrectBitmap()
-    //{
-    //    Coordinates[] cords = { new Coordinates(0, 0), new Coordinates(1, 1) };
-    //    Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
-
-    //    layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, SKColors.Lime));
-
-    //    layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, SKColors.Red));
-
-    //    Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
-
-    //    Assert.Equal(SKColors.Lime, outputBitmap.GetSRGBPixel(0, 0));
-    //    Assert.Equal(SKColors.Red, outputBitmap.GetSRGBPixel(1, 1));
-    //}
-
-    //[Fact]
-    //public void TestThatCombineLayersReturnsCorrectBitmapWithSamePixels()
-    //{
-    //    Coordinates[] cords = { new Coordinates(0, 0) };
-    //    Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
-
-    //    layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Lime));
-
-    //    layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(cords, SKColors.Red));
-
-    //    Surface outputBitmap = BitmapUtils.CombineLayers(2, 2, layers);
-
-    //    Assert.Equal(SKColors.Red, outputBitmap.GetSRGBPixel(0, 0));
-    //}
-
-    //[Fact]
-    //public void TestThatGetPixelsForSelectionReturnsCorrectPixels()
-    //{
-    //    Coordinates[] cords =
-    //    {
-    //        new Coordinates(0, 0),
-    //        new Coordinates(1, 1), new Coordinates(0, 1), new Coordinates(1, 0)
-    //    };
-    //    Layer[] layers = { new Layer("test", 2, 2), new Layer("test2", 2, 2) };
-
-    //    layers[0].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[0] }, SKColors.Lime));
-    //    layers[1].SetPixels(BitmapPixelChanges.FromSingleColoredArray(new[] { cords[1] }, SKColors.Red));
-
-    //    Dictionary<Guid, SKColor[]> output = BitmapUtils.GetPixelsForSelection(layers, cords);
-
-    //    List<SKColor> colors = new List<SKColor>();
-
-    //    foreach (KeyValuePair<Guid, SKColor[]> layerColor in output.ToArray())
-    //    {
-    //        foreach (SKColor color in layerColor.Value)
-    //        {
-    //            colors.Add(color);
-    //        }
-    //    }
-
-    //    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
-    //}
-}

+ 0 - 130
src/PixiEditorTests/ModelsTests/LayersTests/LayerTests.cs

@@ -1,130 +0,0 @@
-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));
-    //}
-}

+ 0 - 25
src/PixiEditorTests/ModelsTests/LayersTests/LayersTestHelper.cs

@@ -1,25 +0,0 @@
-using PixiEditor.Models.Layers;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.LayersTests;
-
-public static class LayersTestHelper
-{
-    public static void LayersAreEqual(Layer expected, Layer actual)
-    {
-        Assert.NotNull(actual);
-        Assert.NotNull(expected);
-#pragma warning disable CA1062 // Validate arguments of public methods
-        Assert.Equal(expected.Name, actual.Name);
-        Assert.Equal(expected.Offset, actual.Offset);
-        Assert.Equal(expected.Width, actual.Width);
-        Assert.Equal(expected.Height, actual.Height);
-        Assert.Equal(expected.MaxHeight, actual.MaxHeight);
-        Assert.Equal(expected.MaxWidth, actual.MaxWidth);
-        Assert.Equal(expected.Opacity, actual.Opacity);
-        Assert.Equal(expected.IsVisible, actual.IsVisible);
-        Assert.Equal(expected.IsRenaming, actual.IsRenaming);
-        Assert.Equal(expected.ConvertBitmapToBytes(), actual.ConvertBitmapToBytes());
-#pragma warning restore CA1062 // Validate arguments of public methods
-    }
-}

+ 0 - 49
src/PixiEditorTests/ModelsTests/PositionTests/CoordinatesCalculatorTests.cs

@@ -1,49 +0,0 @@
-using PixiEditor.Models.Position;
-using System.Linq;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.PositionTests;
-
-public class CoordinatesCalculatorTests
-{
-    //[Theory]
-    //[InlineData(0, 0, 2, 2, 9)]
-    //[InlineData(0, 0, 10, 10, 121)]
-    //public void TestThatRectangleToCoordinatesReturnsSameAmount(int x1, int y1, int x2, int y2, int expectedResult)
-    //{
-    //    Assert.Equal(CoordinatesCalculator.RectangleToCoordinates(x1, y1, x2, y2).Count(), expectedResult);
-    //}
-
-    //[Fact]
-    //public void CalculateSquareEvenThicknessCenterTest()
-    //{
-    //    DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 4);
-
-    //    Assert.Equal(1, cords.Coords1.X);
-    //    Assert.Equal(1, cords.Coords1.Y);
-    //    Assert.Equal(4, cords.Coords2.X);
-    //    Assert.Equal(4, cords.Coords2.Y);
-    //}
-
-    //[Fact]
-    //public void CalculateSquareOddThicknessCenterTest()
-    //{
-    //    DoubleCords cords = CoordinatesCalculator.CalculateThicknessCenter(new Coordinates(3, 3), 3);
-
-    //    Assert.Equal(2, cords.Coords1.X);
-    //    Assert.Equal(2, cords.Coords1.Y);
-    //    Assert.Equal(4, cords.Coords2.X);
-    //    Assert.Equal(4, cords.Coords2.Y);
-    //}
-
-    //[Theory]
-    //[InlineData(0, 0, 3, 3, 1, 1)]
-    //[InlineData(0, 0, 2, 2, 1, 1)]
-    //[InlineData(5, 5, 7, 7, 6, 6)]
-    //[InlineData(5, 5, 9, 9, 7, 7)]
-    //public void TestGetCenter(int x1, int y1, int x2, int y2, int expectedX, int expectedY)
-    //{
-    //    Coordinates center = CoordinatesCalculator.GetCenterPoint(new Coordinates(x1, y1), new Coordinates(x2, y2));
-    //    Assert.Equal(new Coordinates(expectedX, expectedY), center);
-    //}
-}

+ 0 - 25
src/PixiEditorTests/ModelsTests/PositionTests/CoordinatesTests.cs

@@ -1,25 +0,0 @@
-using PixiEditor.Models.Position;
-using System.Globalization;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.PositionTests;
-
-public class CoordinatesTests
-{
-    [Fact]
-    public void TestThatToStringReturnsCorrectFormat()
-    {
-        Coordinates cords = new Coordinates(5, 5);
-
-        Assert.Equal("5, 5", cords.ToString(CultureInfo.InvariantCulture));
-    }
-
-    [Fact]
-    public void TestThatNotEqualOperatorWorks()
-    {
-        Coordinates cords = new Coordinates(5, 5);
-        Coordinates cords2 = new Coordinates(6, 4);
-
-        Assert.True(cords != cords2);
-    }
-}

+ 0 - 31
src/PixiEditorTests/ModelsTests/PositionTests/RectTests.cs

@@ -1,31 +0,0 @@
-using PixiEditor.Helpers.Extensions;
-using SkiaSharp;
-using System.Windows;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.PositionTests;
-
-public class RectTests
-{
-    [Fact]
-    public void TestThatInt32RectToSKRectIWorks()
-    {
-        Int32Rect rect = new Int32Rect(5, 2, 8, 10);
-        SKRectI converted = rect.ToSKRectI();
-        Assert.Equal(rect.X, converted.Left);
-        Assert.Equal(rect.Y, converted.Top);
-        Assert.Equal(rect.Width, converted.Width);
-        Assert.Equal(rect.Height, converted.Height);
-    }
-
-    [Fact]
-    public void TestThatSKRectIToInt32RectWorks()
-    {
-        SKRectI rect = new SKRectI(5, 2, 8, 10);
-        Int32Rect converted = rect.ToInt32Rect();
-        Assert.Equal(rect.Left, converted.X);
-        Assert.Equal(rect.Top, converted.Y);
-        Assert.Equal(rect.Width, converted.Width);
-        Assert.Equal(rect.Height, converted.Height);
-    }
-}

+ 0 - 31
src/PixiEditorTests/ModelsTests/ToolsTests/BrightnessToolTests.cs

@@ -1,31 +0,0 @@
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools.Tools;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ToolsTests;
-
-[Collection("Application collection")]
-public class BrightnessToolTests
-{
-    //[StaTheory]
-    //[InlineData(5, 12, 12, 12)]
-    //[InlineData(-5, 242, 242, 242)]
-
-    //// If correction factor is negative, testing color will be white, otherwise black
-    //public void TestThatBrightnessToolChangesPixelBrightness(float correctionFactor, byte expectedR, byte expectedG, byte expectedB)
-    //{
-    //    SKColor expectedColor = new SKColor(expectedR, expectedG, expectedB);
-
-    //    BrightnessTool tool = new BrightnessTool();
-
-    //    Layer layer = new Layer("test", 1, 1);
-    //    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);
-    //    layer.SetPixels(changes);
-
-    //    Assert.Equal(expectedColor, layer.GetPixel(0, 0));
-    //}
-}

+ 0 - 28
src/PixiEditorTests/ModelsTests/ToolsTests/LineToolTests.cs

@@ -1,28 +0,0 @@
-using System.Linq;
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools.Tools;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ToolsTests;
-
-[Collection("Application collection")]
-public class LineToolTests
-{
-    //[StaTheory]
-    //[InlineData(2)]
-    //[InlineData(10)]
-    //[InlineData(100)]
-    //public void TestThatCreateLineCreatesDiagonalLine(int length)
-    //{
-    //    LineTool lineTool = new LineTool();
-
-    //    System.Collections.Generic.IEnumerable<Coordinates> line = lineTool.CreateLine(new Coordinates(0, 0), new Coordinates(length - 1, length - 1), 1);
-
-    //    Assert.Equal(length, line.Count());
-
-    //    for (int i = 0; i < length; i++)
-    //    {
-    //        Assert.Contains(new Coordinates(i, i), line);
-    //    }
-    //}
-}

+ 0 - 28
src/PixiEditorTests/ModelsTests/ToolsTests/PenToolTests.cs

@@ -1,28 +0,0 @@
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools.Tools;
-using PixiEditorTests.HelpersTests;
-using SkiaSharp;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ToolsTests;
-
-[Collection("Application collection")]
-public class PenToolTests
-{
-    //[StaFact]
-    //public void TestThatPixelPerfectPenReturnsShapeWithoutLShapePixels()
-    //{
-    //    PenTool pen = ViewModelHelper.BuildMockedTool<PenTool>();
-
-    //    Coordinates start = new Coordinates(0, 0);
-    //    Coordinates end = new Coordinates(0, 0);
-    //    Coordinates end2 = new Coordinates(1, 0);
-    //    Coordinates start2 = new Coordinates(1, 1);
-
-    //    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);
-    //}
-}

+ 0 - 29
src/PixiEditorTests/ModelsTests/ToolsTests/RectangleToolTests.cs

@@ -1,29 +0,0 @@
-using System.Linq;
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools.Tools;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ToolsTests;
-
-[Collection("Application collection")]
-public class RectangleToolTests
-{
-    //[StaTheory]
-    //[InlineData(0, 0, 2, 2)]
-    //[InlineData(0, 0, 9, 9)]
-    //[InlineData(5, 5, 6, 6)]
-    //[InlineData(0, 0, 15, 15)]
-    //public void TestThatCreateRectangleCalculatesCorrectOutlineWithOneThickness(int startX, int startY, int endX, int endY)
-    //{
-    //    RectangleTool tool = new RectangleTool();
-
-    //    System.Collections.Generic.IEnumerable<Coordinates> outline = tool.CreateRectangle(
-    //        new Coordinates(startX, startY),
-    //        new Coordinates(endX, endY),
-    //        1);
-
-    //    int expectedBorderPoints = ((endX - startX) * 2) + ((endY - startX) * 2);
-
-    //    Assert.Equal(expectedBorderPoints, outline.Count());
-    //}
-}

+ 0 - 76
src/PixiEditorTests/ModelsTests/ToolsTests/ToolbarTests/ToolbarBaseTests.cs

@@ -1,76 +0,0 @@
-using PixiEditor.Models.Tools.ToolSettings.Settings;
-using PixiEditor.Models.Tools.ToolSettings.Toolbars;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.ToolsTests.ToolbarTests;
-
-[Collection("Application collection")]
-public class ToolbarBaseTests
-{
-    [StaFact]
-    public void TestThatGetSettingReturnsCorrectSetting()
-    {
-        BasicToolbar toolbar = new BasicToolbar();
-        string settingName = "ToolSize";
-
-        Setting setting = toolbar.GetSetting(settingName);
-
-        Assert.NotNull(setting);
-        Assert.Equal(settingName, setting.Name);
-    }
-
-    [StaFact]
-    public void TestThatGenericGetSettingReturnsSettingWithCorrectType()
-    {
-        const string settingName = "test";
-        const bool settingValue = true;
-        Setting<bool> expected = new BoolSetting(settingName, settingValue);
-
-        BasicToolbar toolbar = new BasicToolbar();
-        toolbar.Settings.Add(expected);
-
-        BoolSetting actual = toolbar.GetSetting<BoolSetting>(settingName);
-
-        Assert.Equal(expected.Value, actual.Value);
-    }
-
-    [StaFact]
-    public void TestThatGenericGetSettingReturnsNullWhenSettingIsNotFound()
-    {
-        BasicToolbar toolbar = new BasicToolbar();
-
-        BoolSetting actual = toolbar.GetSetting<BoolSetting>("invalid");
-
-        Assert.Null(actual);
-    }
-
-    [StaFact]
-    public void TestThatGenericGetSettingReturnsNullWhenSettingHasWrongType()
-    {
-        const string settingName = "test";
-        BasicToolbar toolbar = new BasicToolbar();
-        toolbar.Settings.Add(new BoolSetting(settingName));
-
-        SizeSetting actual = toolbar.GetSetting<SizeSetting>(settingName);
-
-        Assert.Null(actual);
-    }
-
-    [StaFact]
-    public void TestThatSaveToolbarSettingsSavesSettingAndLoadsItIntoNewToolbar()
-    {
-        BasicToolbar toolbar = new BasicToolbar();
-
-        toolbar.GetSetting<SizeSetting>("ToolSize").Value = 5;
-
-        toolbar.SaveToolbarSettings();
-
-        BasicShapeToolbar shapeToolbar = new BasicShapeToolbar();
-
-        Assert.NotEqual(5, shapeToolbar.GetSetting<SizeSetting>("ToolSize").Value);
-
-        shapeToolbar.LoadSharedSettings();
-
-        Assert.Equal(5, shapeToolbar.GetSetting<SizeSetting>("ToolSize").Value);
-    }
-}

+ 0 - 162
src/PixiEditorTests/ModelsTests/UndoTests/StorageBasedChangeTests.cs

@@ -1,162 +0,0 @@
-using PixiEditor.Models.Controllers;
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Layers;
-using PixiEditor.Models.Undo;
-using PixiEditorTests.ModelsTests.LayersTests;
-using SkiaSharp;
-using System;
-using System.IO;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.UndoTests;
-
-public class StorageBasedChangeTests
-{
-    private const string UndoStoreLocation = "undoStack";
-
-    public StorageBasedChangeTests()
-    {
-        if (!Directory.Exists(UndoStoreLocation))
-        {
-            Directory.CreateDirectory(UndoStoreLocation);
-        }
-    }
-
-    public static Document GenerateTestDocument()
-    {
-        using Document testDocument = new Document(10, 10);
-        using Surface testBitmap = new Surface(10, 10);
-        using Surface testBitmap2 = new Surface(5, 8);
-        testBitmap.SetSRGBPixel(0, 0, SKColors.Black);
-        testBitmap2.SetSRGBPixel(4, 4, SKColors.Blue);
-        Random random = new Random();
-        testDocument.Layers = new PixiEditor.Models.DataHolders.WpfObservableRangeCollection<Layer>()
-        {
-            new Layer("Test layer" + random.Next(int.MinValue, int.MaxValue), testBitmap, testDocument.Width, testDocument.Height),
-            new Layer("Test layer 2" + random.Next(int.MinValue, int.MaxValue), testBitmap2, testDocument.Width, testDocument.Height) { Offset = new System.Windows.Thickness(2, 3, 0, 0) }
-        };
-        return testDocument;
-    }
-
-    [Fact]
-    public void TestThatConstructorGeneratesUndoLayersProperly()
-    {
-        using Document testDocument = GenerateTestDocument();
-
-        using StorageBasedChange change = new StorageBasedChange(testDocument, testDocument.Layers, UndoStoreLocation);
-
-        Assert.Equal(testDocument.Layers.Count, change.StoredLayers.Length);
-
-        for (int i = 0; i < change.StoredLayers.Length; i++)
-        {
-            Layer testLayer = testDocument.Layers[i];
-            UndoLayer layer = change.StoredLayers[i];
-
-            Assert.Equal(testLayer.Name, layer.Name);
-            Assert.Equal(testLayer.Width, layer.Width);
-            Assert.Equal(testLayer.Height, layer.Height);
-            Assert.Equal(testLayer.IsActive, layer.IsActive);
-            Assert.Equal(testLayer.IsVisible, layer.IsVisible);
-            Assert.Equal(testLayer.OffsetX, layer.OffsetX);
-            Assert.Equal(testLayer.OffsetY, layer.OffsetY);
-            Assert.Equal(testLayer.MaxWidth, layer.MaxWidth);
-            Assert.Equal(testLayer.MaxHeight, layer.MaxHeight);
-            Assert.Equal(testLayer.Opacity, layer.Opacity);
-        }
-    }
-
-    [Fact]
-    public void TestThatSaveLayersOnDeviceSavesLayers()
-    {
-        using Document document = GenerateTestDocument();
-
-        using StorageBasedChange change = new StorageBasedChange(document, document.Layers, UndoStoreLocation);
-
-        foreach (var layer in change.StoredLayers)
-        {
-            Assert.True(File.Exists(layer.StoredPngLayerName));
-            File.Delete(layer.StoredPngLayerName);
-        }
-    }
-
-    [Fact]
-    public void TestThatLoadLayersFromDeviceLoadsLayers()
-    {
-        using Document document = GenerateTestDocument();
-
-        using StorageBasedChange change = new StorageBasedChange(document, document.Layers, UndoStoreLocation);
-
-        Layer[] layers = change.LoadLayersFromDevice();
-
-        Assert.Equal(document.Layers.Count, layers.Length);
-        for (int i = 0; i < document.Layers.Count; i++)
-        {
-            Layer expected = document.Layers[i];
-            Layer actual = layers[i];
-            LayersTestHelper.LayersAreEqual(expected, actual);
-        }
-    }
-
-    [Fact]
-    public void TestThatUndoInvokesLoadFromDeviceAndExecutesProcess()
-    {
-        using Document document = GenerateTestDocument();
-
-        using StorageBasedChange change = new StorageBasedChange(document, document.Layers, UndoStoreLocation);
-        bool undoInvoked = false;
-
-        Action<Layer[], UndoLayer[]> testUndoProcess = (layers, data) =>
-        {
-            undoInvoked = true;
-            Assert.Equal(document.Layers.Count, layers.Length);
-            Assert.Equal(document.Layers.Count, data.Length);
-            foreach (var undoLayer in data)
-            {
-                Assert.False(File.Exists(undoLayer.StoredPngLayerName));
-            }
-        };
-
-        Action<object[]> testRedoProcess = parameters => { };
-
-        Change undoChange = change.ToChange(testUndoProcess, testRedoProcess, null);
-        using UndoManager manager = new UndoManager(this);
-
-        manager.AddUndoChange(undoChange);
-        manager.Undo();
-
-        Assert.True(undoInvoked);
-    }
-
-    [Fact]
-    public void TestThatRedoInvokesSaveToDeviceAndExecutesProcess()
-    {
-        using Document document = GenerateTestDocument();
-
-        using StorageBasedChange change = new StorageBasedChange(document, document.Layers, UndoStoreLocation);
-        bool redoInvoked = false;
-
-        Action<Layer[], UndoLayer[]> testUndoProcess = (layers, data) => { };
-
-        Action<object[]> testRedoProcess = parameters =>
-        {
-            redoInvoked = true;
-            foreach (var undoLayer in change.StoredLayers)
-            {
-                Assert.True(File.Exists(undoLayer.StoredPngLayerName));
-                Assert.NotNull(parameters);
-                Assert.Single(parameters);
-                Assert.IsType<int>(parameters[0]);
-                Assert.Equal(2, parameters[0]);
-            }
-        };
-
-        Change undoChange = change.ToChange(testUndoProcess, testRedoProcess, new object[] { 2 });
-        using UndoManager manager = new UndoManager(this);
-
-        manager.AddUndoChange(undoChange);
-        manager.Undo();
-        manager.Redo();
-
-        Assert.True(redoInvoked);
-    }
-}

+ 0 - 108
src/PixiEditorTests/ModelsTests/UserPreferencesTests/PreferencesSettingsTests.cs

@@ -1,108 +0,0 @@
-using System.Collections.Generic;
-using System.IO;
-using Newtonsoft.Json;
-using PixiEditor.Models.UserPreferences;
-using Xunit;
-
-namespace PixiEditorTests.ModelsTests.UserPreferencesTests;
-
-public class PreferencesSettingsTests
-{
-    public static string PathToPreferencesFile { get; } = Path.Join("PixiEditor", "test_preferences.json");
-
-    public static string PathToLocalPreferencesFile { get; } = Path.Join("PixiEditor", "local_test_preferences.json");
-
-    public static readonly PreferencesSettings PreferencesSettings = new PreferencesSettings();
-
-    public PreferencesSettingsTests()
-    {
-        PreferencesSettings.Init(PathToPreferencesFile, PathToLocalPreferencesFile);
-    }
-
-    [Fact]
-    public void TestThatPreferencesSettingsIsLoaded()
-    {
-        Assert.True(PreferencesSettings.IsLoaded);
-    }
-
-    [Fact]
-    public void TestThatInitCreatesUserPreferencesJson()
-    {
-        Assert.True(File.Exists(PathToPreferencesFile));
-        Assert.True(File.Exists(PathToLocalPreferencesFile));
-    }
-
-    [Theory]
-    [InlineData(-2)]
-    [InlineData(false)]
-    [InlineData("string")]
-    [InlineData(null)]
-    public void TestThatGetPreferenceOnNonExistingKeyReturnsFallbackValue<T>(T value)
-    {
-        T fallbackValue = value;
-        T preferenceValue = PreferencesSettings.GetPreference<T>("NonExistingPreference", fallbackValue);
-        Assert.Equal(fallbackValue, preferenceValue);
-    }
-
-    [Theory]
-    [InlineData("IntPreference", 1)]
-    [InlineData("BoolPreference", true)]
-    public void TestThatUpdatePreferenceUpdatesDictionary<T>(string name, T value)
-    {
-        PreferencesSettings.UpdatePreference(name, value);
-        Assert.Equal(value, PreferencesSettings.GetPreference<T>(name));
-    }
-
-    [Theory]
-    [InlineData("LongPreference", 1L)]
-    public void TestThatSaveUpdatesFile<T>(string name, T value)
-    {
-        PreferencesSettings.Preferences[name] = value;
-        PreferencesSettings.Save();
-        using (var fs = new FileStream(PathToPreferencesFile, FileMode.Open, FileAccess.Read, FileShare.Read))
-        {
-            using StreamReader sr = new StreamReader(fs);
-            string json = sr.ReadToEnd();
-            var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
-            Assert.True(dict.ContainsKey(name));
-            Assert.Equal(value, dict[name]);
-        }
-    }
-
-    [Theory]
-    [InlineData(-2)]
-    [InlineData(false)]
-    [InlineData("string")]
-    [InlineData(null)]
-    public void TestThatGetPreferenceOnNonExistingKeyReturnsFallbackValueLocal<T>(T value)
-    {
-        T fallbackValue = value;
-        T preferenceValue = PreferencesSettings.GetLocalPreference<T>("NonExistingPreference", fallbackValue);
-        Assert.Equal(fallbackValue, preferenceValue);
-    }
-
-    [Theory]
-    [InlineData("IntPreference", 1)]
-    [InlineData("BoolPreference", true)]
-    public void TestThatUpdatePreferenceUpdatesDictionaryLocal<T>(string name, T value)
-    {
-        PreferencesSettings.UpdateLocalPreference(name, value);
-        Assert.Equal(value, PreferencesSettings.GetLocalPreference<T>(name));
-    }
-
-    [Theory]
-    [InlineData("LongPreference", 1L)]
-    public void TestThatSaveUpdatesFileLocal<T>(string name, T value)
-    {
-        PreferencesSettings.LocalPreferences[name] = value;
-        PreferencesSettings.Save();
-        using (var fs = new FileStream(PathToPreferencesFile, FileMode.Open, FileAccess.Read, FileShare.Read))
-        {
-            using StreamReader sr = new StreamReader(fs);
-            string json = sr.ReadToEnd();
-            var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
-            Assert.True(dict.ContainsKey(name));
-            Assert.Equal(value, dict[name]);
-        }
-    }
-}

+ 2 - 8
src/PixiEditorTests/PixiEditorTests.csproj

@@ -35,8 +35,8 @@
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
-    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
+    <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
     <PackageReference Include="Moq" Version="4.17.2" />
     <PackageReference Include="OpenCover" Version="4.7.1221" />
@@ -48,12 +48,6 @@
     <PackageReference Include="Xunit.StaFact" Version="1.1.11" />
   </ItemGroup>
 
-  <ItemGroup>
-    <Page Include="ModelsTests\IO\CorruptedFile.xaml">
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
-  </ItemGroup>
-
   <ItemGroup>
     <ProjectReference Include="..\PixiEditor.UpdateModule\PixiEditor.UpdateModule.csproj" />
     <ProjectReference Include="..\PixiEditor\PixiEditor.csproj" />

+ 0 - 44
src/PixiEditorTests/UpdateModuleTests/UpdateCheckerTests.cs

@@ -1,44 +0,0 @@
-using Moq;
-using PixiEditor.UpdateModule;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace PixiEditorTests.UpdateModuleTests;
-
-public class UpdateCheckerTests
-{
-    //[Theory]
-    //[InlineData("0.1.2", "0.1.2", false)]
-    //[InlineData("0.5", "0.1.2", false)]
-    //[InlineData("0.1.3", "0.1.2", false)]
-    //[InlineData("0.1.2", "0.1.3", true)]
-    //[InlineData("0.2.1", "0.1.3", false)]
-    //public void TestThatCheckUpdateAvailableChecksCorrectly(string currentVersion, string newVersion, bool expectedValue)
-    //{
-    //    UpdateChecker checker = new UpdateChecker(currentVersion);
-    //    bool result = checker.CheckUpdateAvailable(new ReleaseInfo(true) { TagName = newVersion });
-    //    Assert.True(result == expectedValue);
-    //}
-
-    //[Theory]
-    //[InlineData("0.1.2", "0.1.2", false)]
-    //[InlineData("0.5", "0.1.2", false)]
-    //[InlineData("0.1.3", "0.1.2", false)]
-    //[InlineData("0.1.2", "0.1.3", true)]
-    //[InlineData("0.2.1", "0.1.3", false)]
-    //public void CheckThatVersionBiggerComparesCorrectly(string currentVersion, string newVersion, bool expectedValue)
-    //{
-    //    Assert.True(UpdateChecker.VersionBigger(currentVersion, newVersion) == expectedValue);
-    //}
-
-    //[Theory]
-    //[InlineData("0.1.3.5", new string[] { "" }, true)]
-    //[InlineData("0.1.3.5", new string[] { "0.1.3.5" }, false)]
-    //[InlineData("0.1.0.0", new string[] { "0.1.3.5", "0.4.2.1" }, true)]
-    //[InlineData("0.1.2.2", new string[] { " 0.1.2.2 " }, false)]
-    //public void TestThatIsUpdateCompatibleChecksVersionCorrectly(string version, string[] incompatibleVersions, bool expectedResult)
-    //{
-    //    UpdateChecker checker = new UpdateChecker(version);
-    //    Assert.Equal(expectedResult, checker.IsUpdateCompatible(incompatibleVersions));
-    //}
-}

+ 0 - 172
src/PixiEditorTests/ViewModelsTests/ViewModelMainTests.cs

@@ -1,172 +0,0 @@
-using PixiEditor.Models.DataHolders;
-using PixiEditor.Models.Position;
-using PixiEditor.Models.Tools.Tools;
-using PixiEditor.ViewModels;
-using PixiEditorTests.HelpersTests;
-using SkiaSharp;
-using System.IO;
-using System.Windows.Input;
-using Xunit;
-
-namespace PixiEditorTests.ViewModelsTests;
-
-[Collection("Application collection")]
-public class ViewModelMainTests
-{
-    //[StaFact]
-    //public void TestThatConstructorSetsUpControllersCorrectly()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    Assert.NotNull(viewModel.ChangesController);
-    //    Assert.NotNull(viewModel.ShortcutController);
-    //    Assert.NotEmpty(viewModel.ShortcutController.ShortcutGroups);
-    //    Assert.NotNull(viewModel.BitmapManager);
-    //    Assert.Equal(viewModel, ViewModelMain.Current);
-    //}
-
-    //[StaFact]
-    //public void TestThatSwapColorsCommandSwapsColors()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.ColorsSubViewModel.PrimaryColor = SKColors.Black;
-    //    viewModel.ColorsSubViewModel.SecondaryColor = SKColors.White;
-
-    //    viewModel.ColorsSubViewModel.SwapColorsCommand.Execute(null);
-
-    //    Assert.Equal(SKColors.White, viewModel.ColorsSubViewModel.PrimaryColor);
-    //    Assert.Equal(SKColors.Black, viewModel.ColorsSubViewModel.SecondaryColor);
-    //}
-
-    //[StaFact]
-    //public void TestThatNewDocumentCreatesNewDocumentWithBaseLayer()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.FileSubViewModel.NewDocument(5, 5);
-
-    //    Assert.NotNull(viewModel.BitmapManager.ActiveDocument);
-    //    Assert.Single(viewModel.BitmapManager.ActiveDocument.Layers);
-    //}
-
-    //[StaFact]
-    //public void TestThatMouseMoveCommandUpdatesCurrentCoordinates()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-    //    viewModel.BitmapManager.ActiveDocument = new Document(10, 10);
-
-    //    Assert.Equal(new Coordinates(0, 0), MousePositionConverter.CurrentCoordinates);
-
-    //    viewModel.BitmapManager.ActiveDocument.MouseXOnCanvas = 5;
-    //    viewModel.BitmapManager.ActiveDocument.MouseYOnCanvas = 5;
-
-    //    viewModel.IoSubViewModel.MouseMoveCommand.Execute(null);
-
-    //    Assert.Equal(new Coordinates(5, 5), MousePositionConverter.CurrentCoordinates);
-    //}
-
-    //[StaFact]
-    //public void TestThatSelectToolCommandSelectsNewTool()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    Assert.Equal(typeof(MoveViewportTool), viewModel.BitmapManager.SelectedTool.GetType());
-
-    //    viewModel.ToolsSubViewModel.SelectToolCommand.Execute(new LineTool());
-
-    //    Assert.Equal(typeof(LineTool), viewModel.BitmapManager.SelectedTool.GetType());
-    //}
-
-    //[StaFact]
-    //public void TestThatMouseUpCommandStopsRecordingMouseMovements()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.BitmapManager.MouseController.StartRecordingMouseMovementChanges(true);
-
-    //    Assert.True(viewModel.BitmapManager.MouseController.IsRecordingChanges);
-
-    //    viewModel.IoSubViewModel.MouseHook_OnMouseUp(default, default, MouseButton.Left);
-
-    //    Assert.False(viewModel.BitmapManager.MouseController.IsRecordingChanges);
-    //}
-
-    //[StaFact]
-    //public void TestThatNewLayerCommandCreatesNewLayer()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.BitmapManager.ActiveDocument = new Document(1, 1);
-
-    //    Assert.Empty(viewModel.BitmapManager.ActiveDocument.Layers);
-
-    //    viewModel.LayersSubViewModel.NewLayerCommand.Execute(null);
-
-    //    Assert.Single(viewModel.BitmapManager.ActiveDocument.Layers);
-    //}
-
-    //[StaFact]
-    //public void TestThatSaveDocumentCommandSavesFile()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-    //    string fileName = "testFile.pixi";
-
-    //    viewModel.BitmapManager.ActiveDocument = new Document(1, 1)
-    //    {
-    //        DocumentFilePath = fileName
-    //    };
-
-    //    viewModel.FileSubViewModel.SaveDocumentCommand.Execute(null);
-
-    //    Assert.True(File.Exists(fileName));
-
-    //    File.Delete(fileName);
-    //}
-
-    //[StaFact]
-    //public void TestThatAddSwatchAddsNonDuplicateSwatch()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-    //    viewModel.BitmapManager.ActiveDocument = new Document(1, 1);
-
-    //    viewModel.ColorsSubViewModel.AddSwatch(SKColors.Lime);
-    //    viewModel.ColorsSubViewModel.AddSwatch(SKColors.Lime);
-
-    //    Assert.Single(viewModel.BitmapManager.ActiveDocument.Swatches);
-    //    Assert.Equal(SKColors.Lime, viewModel.BitmapManager.ActiveDocument.Swatches[0]);
-    //}
-
-    //[StaTheory]
-    //[InlineData(5, 7)]
-    //[InlineData(1, 1)]
-    //[InlineData(1, 2)]
-    //[InlineData(2, 1)]
-    //[InlineData(16, 16)]
-    //[InlineData(50, 28)]
-    //[InlineData(120, 150)]
-    //public void TestThatSelectAllCommandSelectsWholeDocument(int docWidth, int docHeight)
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.BitmapManager.ActiveDocument = new Document(docWidth, docHeight);
-
-    //    viewModel.BitmapManager.ActiveDocument.AddNewLayer("layer");
-
-    //    viewModel.SelectionSubViewModel.SelectAllCommand.Execute(null);
-
-    //    Assert.Equal(
-    //        viewModel.BitmapManager.ActiveDocument.Width * viewModel.BitmapManager.ActiveDocument.Height,
-    //        viewModel.BitmapManager.ActiveDocument.ActiveSelection.SelectedPoints.Count);
-    //}
-
-    //[StaFact]
-    //public void TestThatDocumentIsNotNullReturnsTrue()
-    //{
-    //    ViewModelMain viewModel = ViewModelHelper.MockedViewModelMain();
-
-    //    viewModel.BitmapManager.ActiveDocument = new Document(1, 1);
-
-    //    Assert.True(viewModel.DocumentIsNotNull(null));
-    //}
-}