PenToolTests.cs 952 B

1234567891011121314151617181920212223242526272829
  1. using PixiEditor.Models.Position;
  2. using PixiEditor.Models.Tools.Tools;
  3. using PixiEditorTests.HelpersTests;
  4. using SkiaSharp;
  5. using Xunit;
  6. namespace PixiEditorTests.ModelsTests.ToolsTests
  7. {
  8. [Collection("Application collection")]
  9. public class PenToolTests
  10. {
  11. [StaFact]
  12. public void TestThatPixelPerfectPenReturnsShapeWithoutLShapePixels()
  13. {
  14. PenTool pen = ViewModelHelper.BuildMockedTool<PenTool>();
  15. Coordinates start = new Coordinates(0, 0);
  16. Coordinates end = new Coordinates(0, 0);
  17. Coordinates end2 = new Coordinates(1, 0);
  18. Coordinates start2 = new Coordinates(1, 1);
  19. pen.Draw(start, end, SKColors.Black, 1, true);
  20. pen.Draw(end, end2, SKColors.Black, 1, true);
  21. var points = pen.Draw(end2, start2, SKColors.Black, 1, true);
  22. Assert.Contains(points.ChangedPixels, x => x.Value.Alpha == 0);
  23. }
  24. }
  25. }