Browse Source

Delete more stuff

Equbuxu 3 years ago
parent
commit
38ab1bb578

+ 0 - 19
PixiEditor/Exceptions/ArrayLengthMismatchException.cs

@@ -1,19 +0,0 @@
-using System;
-
-namespace PixiEditor.Exceptions
-{
-    public class ArrayLengthMismatchException : Exception
-    {
-        public const string DefaultMessage = "First array length doesn't match second array length";
-
-        public ArrayLengthMismatchException()
-            : base(DefaultMessage)
-        {
-        }
-
-        public ArrayLengthMismatchException(string message)
-            : base(message)
-        {
-        }
-    }
-}

+ 1 - 23
PixiEditor/Models/DataHolders/BitmapPixelChanges.cs

@@ -1,5 +1,4 @@
-using PixiEditor.Exceptions;
-using PixiEditor.Helpers.Extensions;
+using PixiEditor.Helpers.Extensions;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using SkiaSharp;
 using SkiaSharp;
 using System;
 using System;
@@ -69,27 +68,6 @@ namespace PixiEditor.Models.DataHolders
             return CombineOverride(new[] { changes1, changes2 });
             return CombineOverride(new[] { changes1, changes2 });
         }
         }
 
 
-        /// <summary>
-        ///     Builds BitmapPixelChanges using 2 same-length enumerables of coordinates and colors.
-        /// </summary>
-        public static BitmapPixelChanges FromArrays(IEnumerable<Coordinates> coordinates, IEnumerable<SKColor> color)
-        {
-            Coordinates[] coordinateArray = coordinates.ToArray();
-            SKColor[] colorArray = color.ToArray();
-            if (coordinateArray.Length != colorArray.Length)
-            {
-                throw new ArrayLengthMismatchException();
-            }
-
-            Dictionary<Coordinates, SKColor> dict = new Dictionary<Coordinates, SKColor>();
-            for (int i = 0; i < coordinateArray.Length; i++)
-            {
-                dict.Add(coordinateArray[i], colorArray[i]);
-            }
-
-            return new BitmapPixelChanges(dict);
-        }
-
         public BitmapPixelChanges WithoutTransparentPixels()
         public BitmapPixelChanges WithoutTransparentPixels()
         {
         {
             return new BitmapPixelChanges(ChangedPixels.Where(x => x.Value.Alpha > 0).ToDictionary(y => y.Key, y => y.Value));
             return new BitmapPixelChanges(ChangedPixels.Where(x => x.Value.Alpha > 0).ToDictionary(y => y.Key, y => y.Value));

+ 1 - 24
PixiEditorTests/ModelsTests/DataHoldersTests/BitmapPixelChangesTests.cs

@@ -1,5 +1,4 @@
-using PixiEditor.Exceptions;
-using PixiEditor.Models.DataHolders;
+using PixiEditor.Models.DataHolders;
 using PixiEditor.Models.Position;
 using PixiEditor.Models.Position;
 using SkiaSharp;
 using SkiaSharp;
 using Xunit;
 using Xunit;
@@ -32,27 +31,5 @@ namespace PixiEditorTests.ModelsTests.DataHoldersTests
             Assert.Equal(SKColors.Red, output.ChangedPixels[new Coordinates(0, 0)]);
             Assert.Equal(SKColors.Red, output.ChangedPixels[new Coordinates(0, 0)]);
             Assert.Equal(SKColors.Lime, output.ChangedPixels[new Coordinates(1, 0)]);
             Assert.Equal(SKColors.Lime, output.ChangedPixels[new Coordinates(1, 0)]);
         }
         }
-
-        [Fact]
-        public void TestThatFromArraysThrowsError()
-        {
-            Assert.Throws<ArrayLengthMismatchException>(
-                () => BitmapPixelChanges.FromArrays(new[] { new Coordinates(0, 0) }, new[] { SKColors.Red, SKColors.Lime }));
-        }
-
-        [Fact]
-        public void TestThatFormArraysWorks()
-        {
-            Coordinates[] coordinatesArray = { new Coordinates(0, 0), new Coordinates(2, 3), new Coordinates(5, 5) };
-            SKColor[] colorsArray = { SKColors.Red, SKColors.Lime, SKColors.Blue };
-            BitmapPixelChanges result = BitmapPixelChanges.FromArrays(coordinatesArray, colorsArray);
-            for (int i = 0; i < coordinatesArray.Length; i++)
-            {
-                Coordinates cords = coordinatesArray[i];
-                Assert.Equal(colorsArray[i], result.ChangedPixels[cords]);
-            }
-
-            Assert.False(result.WasBuiltAsSingleColored);
-        }
     }
     }
 }
 }