diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderColorAndTextColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderColorAndTextColor.png new file mode 100644 index 000000000000..4dcb365ec300 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderColorAndTextColor.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderWidthAndLineBreakMode.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderWidthAndLineBreakMode.png new file mode 100644 index 000000000000..81fa9a1899d0 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetBorderWidthAndLineBreakMode.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCharacterSpacingAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCharacterSpacingAndText.png new file mode 100644 index 000000000000..c789e0cb44c9 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCharacterSpacingAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCornerRadiusAndBorderWidth.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCornerRadiusAndBorderWidth.png new file mode 100644 index 000000000000..b4a861da77df Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetCornerRadiusAndBorderWidth.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndFontFamily.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndFontFamily.png new file mode 100644 index 000000000000..b8d243e4946f Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndFontFamily.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndText.png new file mode 100644 index 000000000000..f9c19da822c9 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndTextTransform.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndTextTransform.png new file mode 100644 index 000000000000..00a7185e2d1d Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontAttributesAndTextTransform.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndText.png new file mode 100644 index 000000000000..b28033bdad5a Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndTextTransform.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndTextTransform.png new file mode 100644 index 000000000000..c046ffb5e792 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontFamilyAndTextTransform.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndLineBreakMode.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndLineBreakMode.png new file mode 100644 index 000000000000..a5f55b854bfa Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndLineBreakMode.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndText.png new file mode 100644 index 000000000000..50f5d1e90961 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndTextTransform.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndTextTransform.png new file mode 100644 index 000000000000..50a4d0728190 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetFontSizeAndTextTransform.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeCharacterWrap.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeCharacterWrap.png new file mode 100644 index 000000000000..1491e82e1e10 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeCharacterWrap.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeHeadTruncation.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeHeadTruncation.png new file mode 100644 index 000000000000..d820f01da909 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeHeadTruncation.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeMiddleTruncation.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeMiddleTruncation.png new file mode 100644 index 000000000000..8da6f7f8fba4 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeMiddleTruncation.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeTailTruncation.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeTailTruncation.png new file mode 100644 index 000000000000..ff25e6bf9b87 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeTailTruncation.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeWordWrap.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeWordWrap.png new file mode 100644 index 000000000000..515346838526 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetLineBreakModeWordWrap.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetPaddingAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetPaddingAndText.png new file mode 100644 index 000000000000..5bc03769977a Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetPaddingAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetShadowAndText.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetShadowAndText.png new file mode 100644 index 000000000000..d17131ea24bc Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetShadowAndText.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetTextAndTextColor.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetTextAndTextColor.png new file mode 100644 index 000000000000..8b9c307d8c2b Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android-notch-36/VerifyMaterial3Button_SetTextAndTextColor.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonMaterial3FeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonMaterial3FeatureTests.cs new file mode 100644 index 000000000000..ba5a635971b3 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonMaterial3FeatureTests.cs @@ -0,0 +1,381 @@ +#if ANDROID +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests; + +public class ButtonMaterial3FeatureTests : _GalleryUITest +{ + public override string GalleryPageName => "Button Feature Matrix"; + + public ButtonMaterial3FeatureTests(TestDevice testDevice) : base(testDevice) + { + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetBorderColorAndTextColor() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("BorderColorRedButton"); + App.Tap("BorderColorRedButton"); + App.WaitForElement("BorderWidthEntry"); + App.ClearText("BorderWidthEntry"); + App.EnterText("BorderWidthEntry", "5"); + App.WaitForElement("TextColorGreenButton"); + App.Tap("TextColorGreenButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetBorderWidthAndLineBreakMode() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("BorderWidthEntry"); + App.ClearText("BorderWidthEntry"); + App.EnterText("BorderWidthEntry", "5"); + App.WaitForElement("LineBreakModeCharacterWrapButton"); + App.Tap("LineBreakModeCharacterWrapButton"); + App.WaitForElement("TextEntry"); + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetCharacterSpacingAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("CharacterSpacingEntry"); + App.ClearText("CharacterSpacingEntry"); + App.EnterText("CharacterSpacingEntry", "5"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "ButtonText"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + App.WaitForElement("ClickedEventLabel"); + App.Tap("ClickedEventLabel"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetCornerRadiusAndBorderWidth() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("CornerRadiusEntry"); + App.ClearText("CornerRadiusEntry"); + App.EnterText("CornerRadiusEntry", "20"); + App.WaitForElement("BorderWidthEntry"); + App.ClearText("BorderWidthEntry"); + App.EnterText("BorderWidthEntry", "5"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + App.WaitForElement("ClickedEventLabel"); + App.Tap("ClickedEventLabel"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontAttributesAndFontFamily() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontAttributesBoldButton"); + App.Tap("FontAttributesBoldButton"); + App.WaitForElement("FontFamilyMontserratBoldButton"); + App.Tap("FontFamilyMontserratBoldButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontAttributesAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontAttributesBoldButton"); + App.Tap("FontAttributesBoldButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontAttributesAndTextTransform() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontAttributesBoldButton"); + App.Tap("FontAttributesBoldButton"); + App.WaitForElement("TextTransformUppercaseButton"); + App.Tap("TextTransformUppercaseButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontFamilyAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontFamilyDokdoButton"); + App.Tap("FontFamilyDokdoButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontFamilyAndTextTransform() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontFamilyDokdoButton"); + App.Tap("FontFamilyDokdoButton"); + App.WaitForElement("TextTransformUppercaseButton"); + App.Tap("TextTransformUppercaseButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontSizeAndLineBreakMode() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontSizeEntry"); + App.ClearText("FontSizeEntry"); + App.EnterText("FontSizeEntry", "20"); + App.WaitForElement("LineBreakModeCharacterWrapButton"); + App.Tap("LineBreakModeCharacterWrapButton"); + App.WaitForElement("TextEntry"); + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontSizeAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontSizeEntry"); + App.ClearText("FontSizeEntry"); + App.EnterText("FontSizeEntry", "20"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + App.WaitForElement("ClickedEventLabel"); + App.Tap("ClickedEventLabel"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetFontSizeAndTextTransform() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("FontSizeEntry"); + App.ClearText("FontSizeEntry"); + App.EnterText("FontSizeEntry", "20"); + App.WaitForElement("TextTransformUppercaseButton"); + App.Tap("TextTransformUppercaseButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetLineBreakModeCharacterWrap() + { + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("LineBreakModeCharacterWrapButton"); + App.Tap("LineBreakModeCharacterWrapButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetLineBreakModeHeadTruncation() + { + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("LineBreakModeHeadTruncationButton"); + App.Tap("LineBreakModeHeadTruncationButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetLineBreakModeMiddleTruncation() + { + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("LineBreakModeMiddleTruncationButton"); + App.Tap("LineBreakModeMiddleTruncationButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetLineBreakModeTailTruncation() + { + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("LineBreakModeTailTruncationButton"); + App.Tap("LineBreakModeTailTruncationButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetLineBreakModeWordWrap() + { + string longText = "This is a very long text that should wrap correctly based on the LineBreakMode settings applied to the Button"; + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("LineBreakModeWordWrapButton"); + App.Tap("LineBreakModeWordWrapButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", longText); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetPaddingAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("PaddingEntry"); + App.ClearText("PaddingEntry"); + App.EnterText("PaddingEntry", "5"); + App.WaitForElement("BorderWidthEntry"); + App.ClearText("BorderWidthEntry"); + App.EnterText("BorderWidthEntry", "5"); + App.WaitForElement("BorderColorGreenButton"); + App.Tap("BorderColorGreenButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetShadowAndText() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("ShadowTrueButton"); + App.Tap("ShadowTrueButton"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Shadow Text"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } + + [Test] + [Category(UITestCategories.Material3)] + public void VerifyMaterial3Button_SetTextAndTextColor() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "Button Text"); + App.WaitForElement("TextColorGreenButton"); + App.Tap("TextColorGreenButton"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + VerifyScreenshot(tolerance: 0.5, retryTimeout: TimeSpan.FromSeconds(2)); + } +} +#endif diff --git a/src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs b/src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs index 3b0270fa7a14..21851c2a6aa7 100644 --- a/src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs +++ b/src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs @@ -14,8 +14,11 @@ static class MauiRippleDrawableExtensions const int MauiBackgroundDrawableId = 1001; const int MauiStrokeDrawableId = 1002; - // Default obtained by running on Android 34 and inspecting the default drawable - const int DefaultCornerRadius = 4; + // Default corner radius for Material Design 2 + const int DefaultCornerRadiusMaterial2 = 4; + + // Default corner radius for Material Design 3 + const int DefaultCornerRadiusMaterial3 = 20; const int DefaultStrokeThicknessWithColor = 1; const int DefaultStrokeThicknessNoColor = 0; static readonly Color DefaultStrokeColor = Colors.Black; @@ -173,9 +176,14 @@ internal static (int Thickness, ColorStateList Color, int Radius) GetStrokePrope : DefaultStrokeThicknessNoColor; var strokeWidthPixels = (int)context.ToPixels(strokeWidth); + // Get default corner radius based on Material Design version + var defaultCornerRadius = RuntimeFeature.IsMaterial3Enabled + ? DefaultCornerRadiusMaterial3 + : DefaultCornerRadiusMaterial2; + var cornerRadius = button.CornerRadius >= 0 ? button.CornerRadius - : DefaultCornerRadius; + : defaultCornerRadius; var cornerRadiusPixels = (int)context.ToPixels(cornerRadius); if (!defaultButtonLogic) diff --git a/src/Core/src/Platform/Android/Resources/values/styles-material3.xml b/src/Core/src/Platform/Android/Resources/values/styles-material3.xml index 454bfe1ecd4e..c5e6cfecd56a 100644 --- a/src/Core/src/Platform/Android/Resources/values/styles-material3.xml +++ b/src/Core/src/Platform/Android/Resources/values/styles-material3.xml @@ -5,6 +5,7 @@ true false + @style/MauiMaterialButton @@ -22,4 +23,22 @@ ?attr/colorSurface ?attr/actionBarSize + + \ No newline at end of file