Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Align dash effect between Border and Shapes #12693

Merged
merged 2 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Core/src/Graphics/MauiDrawable.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void SetBorderWidth(double strokeWidth)

public void SetBorderDash(float[]? strokeDashArray, double strokeDashOffset)
{
if (strokeDashArray == null || strokeDashArray.Length == 0 || strokeDashOffset <= 0)
if (strokeDashArray is null || strokeDashArray.Length == 0)
_borderPathEffect = null;
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,29 @@ public async Task StrokeInitializesCorrectly(uint color)
await ValidateHasColor(border, expected);
}

[Theory(DisplayName = "Dashed Stroke Initializes Correctly")]
[InlineData(0xFFFF0000)]
[InlineData(0xFF00FF00)]
[InlineData(0xFF0000FF)]
public async Task DashedStrokeInitializesCorrectly(uint color)
{
var expected = Color.FromUint(color);

var border = new BorderStub()
{
Content = new LabelStub { Text = "Stroke", TextColor = Colors.Black },
Shape = new RectangleShapeStub(),
Background = new SolidPaintStub(Colors.White),
Stroke = new SolidPaintStub(expected),
StrokeDashPattern = new float[2] { 1, 1 },
StrokeThickness = 6,
Height = 100,
Width = 300
};

await ValidateHasColor(border, expected);
jsuarezruiz marked this conversation as resolved.
Show resolved Hide resolved
}

[Theory(DisplayName = "StrokeShape Initializes Correctly")]
[InlineData("Rectangle")]
[InlineData("RoundRectangle")]
Expand Down