LineTests.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright (c) The Avalonia Project. All rights reserved.
  2. // Licensed under the MIT license. See licence.md file in the project root for full license information.
  3. using System.Threading.Tasks;
  4. using Avalonia.Controls;
  5. using Avalonia.Controls.Shapes;
  6. using Avalonia.Media;
  7. using Xunit;
  8. #if AVALONIA_SKIA
  9. namespace Avalonia.Skia.RenderTests
  10. #else
  11. namespace Avalonia.Direct2D1.RenderTests.Shapes
  12. #endif
  13. {
  14. public class LineTests : TestBase
  15. {
  16. public LineTests()
  17. : base(@"Shapes\Line")
  18. {
  19. }
  20. [Fact]
  21. public async Task Line_1px_Stroke()
  22. {
  23. Decorator target = new Decorator
  24. {
  25. Width = 200,
  26. Height = 200,
  27. Child = new Line
  28. {
  29. Stroke = Brushes.Black,
  30. StrokeThickness = 1,
  31. StartPoint = new Point(0, 0),
  32. EndPoint = new Point(200, 200)
  33. }
  34. };
  35. await RenderToFile(target);
  36. CompareImages();
  37. }
  38. [Fact]
  39. public async Task Line_1px_Stroke_Reversed()
  40. {
  41. Decorator target = new Decorator
  42. {
  43. Width = 200,
  44. Height = 200,
  45. Child = new Line
  46. {
  47. Stroke = Brushes.Black,
  48. StrokeThickness = 1,
  49. StartPoint = new Point(200, 0),
  50. EndPoint = new Point(0, 200)
  51. }
  52. };
  53. await RenderToFile(target);
  54. CompareImages();
  55. }
  56. [Fact]
  57. public async Task Line_1px_Stroke_Vertical()
  58. {
  59. Decorator target = new Decorator
  60. {
  61. Width = 200,
  62. Height = 200,
  63. Child = new Line
  64. {
  65. Stroke = Brushes.Black,
  66. StrokeThickness = 1,
  67. StartPoint = new Point(100, 200),
  68. EndPoint = new Point(100, 0)
  69. }
  70. };
  71. await RenderToFile(target);
  72. CompareImages();
  73. }
  74. }
  75. }