Skip to content

Commit

Permalink
test: Add test for CornerRadius
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 committed Sep 25, 2022
1 parent 5c2458c commit b540a3a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
Height="100"
CornerRadius="50" />

<!-- Sample for https://github.com/unoplatform/uno/issues/5440 -->
<Border Height="30" />
<Border x:Name="Sample2"
Width="128"
Height="64"
Background="Red"
CornerRadius="128" />

<Border Height="30" />
<Border Width="100"
Height="50"
Expand Down

0 comments on commit b540a3a

Please sign in to comment.