Skip to content

Commit

Permalink
Align Shapes Fill property behavior with Xamarin.Forms (#10328)
Browse files Browse the repository at this point in the history
* Align Shapes Fill property behavior with Xamarin.Forms

* Added device tests
  • Loading branch information
jsuarezruiz authored Nov 23, 2022
1 parent 4ac9f5b commit e6c779d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/Core/src/Graphics/ShapeDrawable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,7 @@ void DrawFillPath(ICanvas canvas, RectF dirtyRect, PathF path)
{
if (ShapeView == null || ShapeView.Shape == null)
return;

if (!path.Closed)
return;


canvas.SaveState();

canvas.FillColor = Colors.Transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,26 @@ public async Task PolygonInitializesCorrectly()

await ValidateNativeFill(polygon, Colors.Lime);
}

[Theory(DisplayName = "Polyline Background Initializes Correctly")]
[InlineData(0xFF0000)]
[InlineData(0x00FF00)]
[InlineData(0x0000FF)]
public async Task PolylineBackgroundInitializesCorrectly(uint color)
{
var expected = Color.FromUint(color);

var polyline = new ShapeViewStub()
{
Shape = new PolylineShapeStub { Points = new PointCollectionStub() { new Point(10, 10), new Point(100, 50), new Point(50, 90) } },
Stroke = new SolidPaintStub(Colors.Green),
Background = new SolidPaintStub(expected),
StrokeThickness = 4,
Height = 50,
Width = 100
};

await ValidateHasColor(polyline, expected);
}
}
}

0 comments on commit e6c779d

Please sign in to comment.