From b540a3aa516d9b21200d3e8e7a0665864e27ebec Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sun, 25 Sep 2022 17:56:36 +0200 Subject: [PATCH] test: Add test for CornerRadius --- .../BorderTests/Border_Tests.cs | 25 +++++++++++++++++++ .../BorderTests/Border_CornerRadius.xaml | 8 ++++++ 2 files changed, 33 insertions(+) diff --git a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/BorderTests/Border_Tests.cs b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/BorderTests/Border_Tests.cs index 4a569321aabd..2ddc9148ce20 100644 --- a/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/BorderTests/Border_Tests.cs +++ b/src/SamplesApp/SamplesApp.UITests/Windows_UI_Xaml_Controls/BorderTests/Border_Tests.cs @@ -55,6 +55,31 @@ public void Check_CornerRadius_Border_Basic() ExpectedPixels.At(sample.Right - eighth, sample.Bottom - eighth).Named("bottom right corner").Pixel(white), ExpectedPixels.At(sample.X + eighth, sample.Bottom - eighth).Named("bottom left corner").Pixel(white) ); + +#if __WASM__ + // See https://github.com/unoplatform/uno/issues/5440 for the scenario being tested. + var sample2 = _app.GetPhysicalRect("Sample2"); + + var top = sample2.Y + 1; + ImageAssert.HasColorAt(result, sample2.CenterX, top, Color.Red, tolerance: 20); + ImageAssert.HasColorAt(result, sample2.CenterX + 25, top, Color.White); + ImageAssert.HasColorAt(result, sample2.CenterX - 25, top, Color.White); + + var bottom = sample2.Bottom - 1; + ImageAssert.HasColorAt(result, sample2.CenterX, bottom, Color.Red, tolerance: 20); + ImageAssert.HasColorAt(result, sample2.CenterX + 20, bottom, Color.White); + ImageAssert.HasColorAt(result, sample2.CenterX - 20, bottom, Color.White); + + var right = sample2.Right - 1; + ImageAssert.HasColorAt(result, right, sample2.CenterY, Color.Red, tolerance: 20); + ImageAssert.HasColorAt(result, right, sample2.CenterY - 10, Color.White); + ImageAssert.HasColorAt(result, right, sample2.CenterY + 10, Color.White); + + var left = sample2.X + 2; + ImageAssert.HasColorAt(result, left, sample2.CenterY, Color.Red, tolerance: 20); + ImageAssert.HasColorAt(result, left, sample2.CenterY - 10, Color.White); + ImageAssert.HasColorAt(result, left, sample2.CenterY + 10, Color.White); +#endif } [Test] diff --git a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/BorderTests/Border_CornerRadius.xaml b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/BorderTests/Border_CornerRadius.xaml index 740b43035606..355b2c7d4105 100644 --- a/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/BorderTests/Border_CornerRadius.xaml +++ b/src/SamplesApp/UITests.Shared/Windows_UI_Xaml_Controls/BorderTests/Border_CornerRadius.xaml @@ -18,6 +18,14 @@ Height="100" CornerRadius="50" /> + + + +