Skip to content
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 49 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue20596.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 20596, "[Android] Button with corner radius shadow broken on Android device", PlatformAffected.Android | PlatformAffected.UWP)]
public class Issue20596 : ContentPage
{
public Issue20596()
{
var button = new Button
{
TextColor = Colors.Black,
HeightRequest = 200,
WidthRequest = 200,
BackgroundColor = Colors.Green,
CornerRadius = 20,
Shadow = new Shadow { Radius = 10 }
};

var imageButton = new ImageButton
{
HeightRequest = 200,
WidthRequest = 200,
BackgroundColor = Colors.Red,
CornerRadius = 20,
Shadow = new Shadow { Radius = 10 }
};

var updateButton = new Button
{
Text = "Update corner radius",
HeightRequest = 50,
AutomationId = "UpdateCornerRadiusButton"
};
updateButton.Clicked += (sender, e) =>
{
button.CornerRadius = 100;
imageButton.CornerRadius = 100;
};

Content = new VerticalStackLayout
{
Children =
{
button,
imageButton,
updateButton
}
};
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue20596 : _IssuesUITest
{
public Issue20596(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "[Android] Button with corner radius shadow broken on Android device";

[Test]
[Category(UITestCategories.Button)]
public void ShadowShouldUpdateOnCornerRadiusChange()
{
App.WaitForElement("UpdateCornerRadiusButton");
App.Click("UpdateCornerRadiusButton");
VerifyScreenshot();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending snapshots already available in the latest build.
image

Could you commit the images?

}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions src/Core/src/Handlers/Button/ButtonHandler.Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ public static void MapStrokeThickness(IButtonHandler handler, IButton button)
public static void MapCornerRadius(IButtonHandler handler, IButton button)
{
handler.PlatformView?.UpdateCornerRadius(button);

if (button.Shadow is not null)
{
handler.UpdateValue(nameof(IButton.Shadow));
}
}

public static void MapText(IButtonHandler handler, IText button)
Expand Down
5 changes: 5 additions & 0 deletions src/Core/src/Handlers/Button/ButtonHandler.Windows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public static void MapStrokeThickness(IButtonHandler handler, IButtonStroke butt
public static void MapCornerRadius(IButtonHandler handler, IButtonStroke buttonStroke)
{
handler.PlatformView?.UpdateCornerRadius(buttonStroke);

if (handler.VirtualView.Shadow is not null)
{
handler.UpdateValue(nameof(IButton.Shadow));
}
}

public static void MapText(IButtonHandler handler, IText button)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public static void MapCornerRadius(IImageButtonHandler handler, IButtonStroke bu
{
handler.PlatformView?.UpdateCornerRadius(buttonStroke);
handler.UpdateValue(nameof(IImageButton.Padding));

if (handler.VirtualView.Shadow is not null)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verifying if the Shadow is not null, will not invalidate it when setting to null (for example, to dynamically remove a shadow).

Copy link
Copy Markdown
Contributor Author

@kubaflo kubaflo May 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RIght, but we only need to invalidate it when it is visible when it comes to radius

{
handler.UpdateValue(nameof(IImageButton.Shadow));
}
}

public static void MapPadding(IImageButtonHandler handler, IImageButton imageButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public static void MapCornerRadius(IImageButtonHandler handler, IButtonStroke bu
{
(handler.PlatformView as Button)?.UpdateCornerRadius(buttonStroke);
handler.UpdateValue(nameof(IImageButton.Padding));

if (handler.VirtualView.Shadow is not null)
{
handler.UpdateValue(nameof(IImageButton.Shadow));
}
}

public static void MapBackground(IImageButtonHandler handler, IImageButton imageButton)
Expand Down
Loading