forked from AvaloniaUI/Avalonia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use own Pen (if set) in GeometryDrawing.GetBounds : Add unit tests
- Loading branch information
Patrick Tellier
committed
Jun 3, 2022
1 parent
1f7cf04
commit f733c0f
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Avalonia.Media; | ||
using Xunit; | ||
|
||
#if AVALONIA_SKIA | ||
namespace Avalonia.Skia.RenderTests | ||
#else | ||
|
||
using Avalonia.Direct2D1.RenderTests; | ||
|
||
namespace Avalonia.Direct2D1.RenderTests.Media | ||
#endif | ||
{ | ||
public class GeometryDrawingTests : TestBase | ||
{ | ||
public GeometryDrawingTests() | ||
: base(@"Media\GeometryDrawing") | ||
{ | ||
} | ||
|
||
private GeometryDrawing CreateGeometryDrawing() | ||
{ | ||
GeometryDrawing geometryDrawing = new GeometryDrawing(); | ||
EllipseGeometry ellipse = new EllipseGeometry(); | ||
ellipse.RadiusX = 100; | ||
ellipse.RadiusY = 100; | ||
geometryDrawing.Geometry = ellipse; | ||
return geometryDrawing; | ||
} | ||
|
||
[Fact] | ||
public void DrawingGeometry_WithPen() | ||
{ | ||
GeometryDrawing geometryDrawing = CreateGeometryDrawing(); | ||
geometryDrawing.Pen = new Pen(new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)), 10); | ||
|
||
Assert.Equal(210, geometryDrawing.GetBounds().Height); | ||
Assert.Equal(210, geometryDrawing.GetBounds().Width); | ||
|
||
} | ||
|
||
[Fact] | ||
public void DrawingGeometry_WithoutPen() | ||
{ | ||
GeometryDrawing geometryDrawing = CreateGeometryDrawing(); | ||
|
||
Assert.Equal(200, geometryDrawing.GetBounds().Height); | ||
Assert.Equal(200, geometryDrawing.GetBounds().Width); | ||
} | ||
|
||
|
||
} | ||
} |