PenToolTests.cs 987 B

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