|
@@ -2,6 +2,7 @@
|
|
using ChunkyImageLib;
|
|
using ChunkyImageLib;
|
|
using ChunkyImageLib.DataHolders;
|
|
using ChunkyImageLib.DataHolders;
|
|
using ChunkyImageLib.Operations;
|
|
using ChunkyImageLib.Operations;
|
|
|
|
+using PixiEditor.DrawingApi.Core.ColorsImpl;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using PixiEditor.DrawingApi.Core.Numerics;
|
|
using SkiaSharp;
|
|
using SkiaSharp;
|
|
using Xunit;
|
|
using Xunit;
|
|
@@ -17,7 +18,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_SmallStrokeOnly_FindsCorrectChunks()
|
|
public void FindAffectedChunks_SmallStrokeOnly_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (chunkSize / 2, chunkSize / 2, chunkSize, chunkSize);
|
|
var (x, y, w, h) = (chunkSize / 2, chunkSize / 2, chunkSize, chunkSize);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, SKColors.Black, SKColors.Transparent));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, Colors.Black, Colors.Transparent));
|
|
|
|
|
|
HashSet<VecI> expected = new() { new(0, 0) };
|
|
HashSet<VecI> expected = new() { new(0, 0) };
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|
|
@@ -29,7 +30,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_2by2StrokeOnly_FindsCorrectChunks()
|
|
public void FindAffectedChunks_2by2StrokeOnly_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (0, 0, chunkSize * 2, chunkSize * 2);
|
|
var (x, y, w, h) = (0, 0, chunkSize * 2, chunkSize * 2);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, SKColors.Black, SKColors.Transparent));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, Colors.Black, Colors.Transparent));
|
|
|
|
|
|
HashSet<VecI> expected = new() { new(-1, -1), new(0, -1), new(-1, 0), new(0, 0) };
|
|
HashSet<VecI> expected = new() { new(-1, -1), new(0, -1), new(-1, 0), new(0, 0) };
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|
|
@@ -41,7 +42,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_3x3PositiveStrokeOnly_FindsCorrectChunks()
|
|
public void FindAffectedChunks_3x3PositiveStrokeOnly_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, SKColors.Black, SKColors.Transparent));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, Colors.Black, Colors.Transparent));
|
|
|
|
|
|
HashSet<VecI> expected = new()
|
|
HashSet<VecI> expected = new()
|
|
{
|
|
{
|
|
@@ -58,7 +59,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_3x3NegativeStrokeOnly_FindsCorrectChunks()
|
|
public void FindAffectedChunks_3x3NegativeStrokeOnly_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (-chunkSize * 2 - chunkSize / 2, -chunkSize * 2 - chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
var (x, y, w, h) = (-chunkSize * 2 - chunkSize / 2, -chunkSize * 2 - chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, SKColors.Black, SKColors.Transparent));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, Colors.Black, Colors.Transparent));
|
|
|
|
|
|
HashSet<VecI> expected = new()
|
|
HashSet<VecI> expected = new()
|
|
{
|
|
{
|
|
@@ -75,7 +76,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_3x3PositiveFilled_FindsCorrectChunks()
|
|
public void FindAffectedChunks_3x3PositiveFilled_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 2, chunkSize * 2);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, SKColors.Black, SKColors.White));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, 1, Colors.Black, Colors.White));
|
|
|
|
|
|
HashSet<VecI> expected = new()
|
|
HashSet<VecI> expected = new()
|
|
{
|
|
{
|
|
@@ -92,7 +93,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_ThickPositiveStroke_FindsCorrectChunks()
|
|
public void FindAffectedChunks_ThickPositiveStroke_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 4, chunkSize * 4);
|
|
var (x, y, w, h) = (2 * chunkSize + chunkSize / 2, 2 * chunkSize + chunkSize / 2, chunkSize * 4, chunkSize * 4);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, SKColors.Black, SKColors.Transparent));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, Colors.Black, Colors.Transparent));
|
|
|
|
|
|
HashSet<VecI> expected = new()
|
|
HashSet<VecI> expected = new()
|
|
{
|
|
{
|
|
@@ -111,7 +112,7 @@ public class RectangleOperationTests
|
|
public void FindAffectedChunks_SmallButThick_FindsCorrectChunks()
|
|
public void FindAffectedChunks_SmallButThick_FindsCorrectChunks()
|
|
{
|
|
{
|
|
var (x, y, w, h) = (chunkSize / 2f - 0.5, chunkSize / 2f - 0.5, 1, 1);
|
|
var (x, y, w, h) = (chunkSize / 2f - 0.5, chunkSize / 2f - 0.5, 1, 1);
|
|
- RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, SKColors.Black, SKColors.White));
|
|
|
|
|
|
+ RectangleOperation operation = new(new(new(x, y), new(w, h), 0, chunkSize, Colors.Black, Colors.White));
|
|
|
|
|
|
HashSet<VecI> expected = new() { new(0, 0) };
|
|
HashSet<VecI> expected = new() { new(0, 0) };
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|
|
var actual = operation.FindAffectedChunks(new(chunkSize));
|