From 33bd33e38c3c601dd02cb7c6a9c459e737128b55 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 24 May 2016 22:18:29 -0400 Subject: [PATCH] Added render tests for geometry clipping. --- .../Avalonia.RenderTests.projitems | 5 +- .../GeometryClippingTests.cs | 51 ++++++++++++++++++ .../Geometry_Clip_Clips_Path.expected.png | Bin 0 -> 373 bytes .../Geometry_Clip_Clips_Path.expected.png | Bin 0 -> 373 bytes .../Geometry_Clip_Clips_Path.expected.png | Bin 0 -> 373 bytes 5 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 tests/Avalonia.RenderTests/GeometryClippingTests.cs create mode 100644 tests/TestFiles/Cairo/GeometryClipping/Geometry_Clip_Clips_Path.expected.png create mode 100644 tests/TestFiles/Direct2D1/GeometryClipping/Geometry_Clip_Clips_Path.expected.png create mode 100644 tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png diff --git a/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems b/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems index 52f6a93b11..79ceddf3bb 100644 --- a/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems +++ b/tests/Avalonia.RenderTests/Avalonia.RenderTests.projitems @@ -8,7 +8,7 @@ Avalonia.RenderTests - + @@ -22,5 +22,6 @@ + - + \ No newline at end of file diff --git a/tests/Avalonia.RenderTests/GeometryClippingTests.cs b/tests/Avalonia.RenderTests/GeometryClippingTests.cs new file mode 100644 index 0000000000..355606bb43 --- /dev/null +++ b/tests/Avalonia.RenderTests/GeometryClippingTests.cs @@ -0,0 +1,51 @@ +using Avalonia.Controls; +using Avalonia.Controls.Shapes; +using Avalonia.Media; +using System; +using System.Collections.Generic; +using System.Text; +using Xunit; + +#if AVALONIA_CAIRO +namespace Avalonia.Cairo.RenderTests +#elif AVALONIA_SKIA +namespace Avalonia.Skia.RenderTests +#else +namespace Avalonia.Direct2D1.RenderTests +#endif +{ + public class GeometryClippingTests : TestBase + { + public GeometryClippingTests() + :base("GeometryClipping") + { + } + + [Fact] + public void Geometry_Clip_Clips_Path() + { + var target = new Canvas + { + Clip = StreamGeometry.Parse("F1 M 0,0 H 76 V 76 Z"), + Width = 76, + Height = 76, + Children = new Avalonia.Controls.Controls + { + new Path + { + Width = 32, + Height = 40, + [Canvas.LeftProperty] = 23, + [Canvas.TopProperty] = 18, + Stretch = Stretch.Fill, + Fill = Brushes.Black, + Data = StreamGeometry.Parse("F1 M 27,18L 23,26L 33,30L 24,38L 33,46L 23,50L 27,58L 45,58L 55,38L 45,18L 27,18 Z") + } + } + }; + + RenderToFile(target); + CompareImages(); + } + } +} diff --git a/tests/TestFiles/Cairo/GeometryClipping/Geometry_Clip_Clips_Path.expected.png b/tests/TestFiles/Cairo/GeometryClipping/Geometry_Clip_Clips_Path.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..892899507b7d71439ee220baf272495473ad7394 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^J|N7&1|*M957Y)yjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4P2fsjv*CsZ?7KYWisS(xv1MXNu%}L0%48D zpcf2poR?&n>PQRo-T3eMze^;$0b~pad}!~xRvh#%@@1^<*B>7LB3GV`3D^F5DsA2B zsb#7ABf_OjWJ@N08)OB+01hCjPAggtUuaeVlk|&6$oM#C}o8B1w=Odoc5IU^YPcwGhT#F2MKt(`njxg HN@xNA&3~GM literal 0 HcmV?d00001 diff --git a/tests/TestFiles/Direct2D1/GeometryClipping/Geometry_Clip_Clips_Path.expected.png b/tests/TestFiles/Direct2D1/GeometryClipping/Geometry_Clip_Clips_Path.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..892899507b7d71439ee220baf272495473ad7394 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^J|N7&1|*M957Y)yjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4P2fsjv*CsZ?7KYWisS(xv1MXNu%}L0%48D zpcf2poR?&n>PQRo-T3eMze^;$0b~pad}!~xRvh#%@@1^<*B>7LB3GV`3D^F5DsA2B zsb#7ABf_OjWJ@N08)OB+01hCjPAggtUuaeVlk|&6$oM#C}o8B1w=Odoc5IU^YPcwGhT#F2MKt(`njxg HN@xNA&3~GM literal 0 HcmV?d00001 diff --git a/tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png b/tests/TestFiles/Skia/GeometryClipping/Geometry_Clip_Clips_Path.expected.png new file mode 100644 index 0000000000000000000000000000000000000000..892899507b7d71439ee220baf272495473ad7394 GIT binary patch literal 373 zcmeAS@N?(olHy`uVBq!ia0vp^J|N7&1|*M957Y)yjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1quc4P2fsjv*CsZ?7KYWisS(xv1MXNu%}L0%48D zpcf2poR?&n>PQRo-T3eMze^;$0b~pad}!~xRvh#%@@1^<*B>7LB3GV`3D^F5DsA2B zsb#7ABf_OjWJ@N08)OB+01hCjPAggtUuaeVlk|&6$oM#C}o8B1w=Odoc5IU^YPcwGhT#F2MKt(`njxg HN@xNA&3~GM literal 0 HcmV?d00001