diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderColorAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderColorAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..8574032a9efe Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderColorAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..272556490705 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCharacterSpacingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCharacterSpacingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..313e20bc2d59 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCharacterSpacingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png new file mode 100644 index 000000000000..da775724a128 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png new file mode 100644 index 000000000000..7818bf52a912 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..c6cefa784d4a Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..7713f7dd8d59 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..bc026b9034d6 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeWordWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeWordWrap_VerifyVisualState.png new file mode 100644 index 000000000000..58048bd6fbd0 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_SetLineBreakModeWordWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndFontFamily_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndFontFamily_VerifyVisualState.png new file mode 100644 index 000000000000..6aa7212e5bbc Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndFontFamily_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..bc6229cdd98f Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndText_VerifyVisualState.png new file mode 100644 index 000000000000..a03e0d5a03e5 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontAttributesAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..440d10c62b2b Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndText_VerifyVisualState.png new file mode 100644 index 000000000000..db55fa48f121 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontFamilyAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..b513a913ee2a Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..c9463efcbd96 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..65b39a88f225 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setFontSizeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setLineBreakModeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setLineBreakModeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..9059b4c0dfa6 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setLineBreakModeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setPaddingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setPaddingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..0728be8d78c3 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setPaddingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setShadowAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setShadowAndText_VerifyVisualState.png new file mode 100644 index 000000000000..7fd0b7882561 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setShadowAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setTextAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setTextAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..e0e7e154f003 Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/Button_setTextAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs index 014b57176c54..33c113d01a32 100644 --- a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs +++ b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs @@ -48,6 +48,7 @@ public override string ToString() // Elements new GalleryPageFactory(() => new ActivityIndicatorCoreGalleryPage(), "ActivityIndicator Gallery"), new GalleryPageFactory(() => new BoxViewCoreGalleryPage(), "Box Gallery"), + new GalleryPageFactory(() => new ButtonControlPage(), "Button Feature Matrix"), new GalleryPageFactory(() => new ButtonCoreGalleryPage(), "Button Gallery"), new GalleryPageFactory(() => new CarouselViewCoreGalleryPage(), "CarouselView Gallery"), new GalleryPageFactory(() => new CheckBoxCoreGalleryPage(), "CheckBox Gallery"), diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml new file mode 100644 index 000000000000..e2ee55b2a38e --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml @@ -0,0 +1,78 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml.cs new file mode 100644 index 000000000000..2a537a15497b --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonControlPage.xaml.cs @@ -0,0 +1,55 @@ +namespace Maui.Controls.Sample; + +public class ButtonControlPage : NavigationPage +{ + public ButtonControlPage() + { + PushAsync(new ButtonControlMainPage()); + } +} + +public partial class ButtonControlMainPage : ContentPage +{ + public ButtonViewModal _viewModel; + public ButtonControlMainPage() + { + InitializeComponent(); + BindingContext = _viewModel = new ButtonViewModal(); + } + + public async void NavigateToOptionsPage_Clicked(object sender, EventArgs e) + { + BindingContext = _viewModel = new ButtonViewModal(); + ClickedEventLabel.Text = string.Empty; + PressedEventLabel.Text = string.Empty; + ReleasedEventLabel.Text = string.Empty; + await Navigation.PushAsync(new ButtonOptionsPage(_viewModel)); + } + + public void OnButtonClicked(object sender, EventArgs e) + { + var button = sender as Button; + if (button != null) + { + ClickedEventLabel.Text = "Clicked Event Executed"; + } + } + + public void OnButtonPressed(object sender, EventArgs e) + { + var button = sender as Button; + if (button != null) + { + PressedEventLabel.Text = "Pressed Event Executed"; + } + } + + public void OnButtonReleased(object sender, EventArgs e) + { + var button = sender as Button; + if (button != null) + { + ReleasedEventLabel.Text = "Released Event Executed"; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml new file mode 100644 index 000000000000..dba6f7dcb1ac --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml @@ -0,0 +1,291 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml.cs new file mode 100644 index 000000000000..7e3070f0d0e6 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonOptionsPage.xaml.cs @@ -0,0 +1,134 @@ +namespace Maui.Controls.Sample; + +public partial class ButtonOptionsPage : ContentPage +{ + private ButtonViewModal _viewModel; + public ButtonOptionsPage(ButtonViewModal viewModel) + { + InitializeComponent(); + BindingContext = viewModel; + _viewModel = viewModel; + } + + protected override void OnAppearing() + { + base.OnAppearing(); + } + + private async void ApplyButton_Clicked(object sender, EventArgs e) + { + await Navigation.PopAsync(); + } + + private void OnBorderColorRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.BorderColor = radioButton.Content.ToString() == "Red" ? Colors.Red : Colors.Green; + } + } + + private void OnFlowDirectionChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton != null && radioButton.IsChecked) + { + _viewModel.FlowDirection = radioButton.Content.ToString() == "Left to Right" ? FlowDirection.LeftToRight : FlowDirection.RightToLeft; + } + } + + private void OnFontAttributesRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.FontAttributes = radioButton.Content.ToString() == "Italic" ? FontAttributes.Italic : radioButton.Content.ToString() == "Bold" ? FontAttributes.Bold : FontAttributes.None; + } + } + + private void OnFontFamilyRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.FontFamily = radioButton.Content.ToString() == "Dokdo" ? "Dokdo" : "MontserratBold"; + } + } + + private void OnIsEnabledRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton != null && radioButton.IsChecked) + { + _viewModel.IsEnabled = radioButton.Content.ToString() == "True"; + } + } + + private void OnIsVisibleRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton != null && radioButton.IsChecked) + { + _viewModel.IsVisible = radioButton.Content.ToString() == "True"; + } + } + + private void OnLineBreakModeRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + switch (radioButton.Content.ToString()) + { + case "CharacterWrap": + _viewModel.LineBreakMode = LineBreakMode.CharacterWrap; + break; + case "HeadTruncation": + _viewModel.LineBreakMode = LineBreakMode.HeadTruncation; + break; + case "MiddleTruncation": + _viewModel.LineBreakMode = LineBreakMode.MiddleTruncation; + break; + case "TailTruncation": + _viewModel.LineBreakMode = LineBreakMode.TailTruncation; + break; + case "WordWrap": + _viewModel.LineBreakMode = LineBreakMode.WordWrap; + break; + default: + _viewModel.LineBreakMode = LineBreakMode.NoWrap; + break; + } + } + } + + private void OnShadowRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.ShadowOpacity = radioButton.Value.ToString() == "1" ? 1f : 0f; + } + } + + private void OnTextColorRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.TextColor = radioButton.Content.ToString() == "Red" ? Colors.Red : Colors.Green; + } + } + + private void OnTextTransformRadioButtonCheckedChanged(object sender, CheckedChangedEventArgs e) + { + var radioButton = sender as RadioButton; + if (radioButton.IsChecked) + { + _viewModel.TextTransform = radioButton.Content.ToString() == "Lowercase" + ? TextTransform.Lowercase + : TextTransform.Uppercase; + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonViewModal.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonViewModal.cs new file mode 100644 index 000000000000..929e6112af85 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/Button/ButtonViewModal.cs @@ -0,0 +1,271 @@ +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows.Input; + +namespace Maui.Controls.Sample; + +public class ButtonViewModal : INotifyPropertyChanged +{ + private Color _borderColor = Colors.White; + private double _borderWidth = 0d; + private double _characterSpacing = 0.0d; + private ICommand _command = null; + private int _cornerRadius = 0; + private FlowDirection _flowDirection = FlowDirection.MatchParent; + private FontAttributes _fontAttributes = FontAttributes.None; + private string _fontFamily = null; + private double _fontSize = 0d; + private bool _isEnabled = true; + private bool _isVisible = true; + private LineBreakMode _lineBreakMode = LineBreakMode.NoWrap; + private double _padding = 0d; + private string _text = null; + private Color _textColor = Colors.Black; + private float _shadowOpacity = 0f; + private TextTransform _textTransform = TextTransform.Default; + + public Color BorderColor + { + get => _borderColor; + set + { + if (_borderColor != value) + { + _borderColor = value; + OnPropertyChanged(); + } + } + } + + public double BorderWidth + { + get => _borderWidth; + set + { + if (_borderWidth != value) + { + _borderWidth = value; + OnPropertyChanged(); + } + } + } + + public double CharacterSpacing + { + get => _characterSpacing; + set + { + if (_characterSpacing != value) + { + _characterSpacing = value; + OnPropertyChanged(); + } + } + } + + public ICommand Command + { + get => _command; + set + { + if (_command != value) + { + _command = value; + OnPropertyChanged(); + } + } + } + + public int CornerRadius + { + get => _cornerRadius; + set + { + if (_cornerRadius != value) + { + _cornerRadius = value; + OnPropertyChanged(); + } + } + } + + public FlowDirection FlowDirection + { + get => _flowDirection; + set + { + if (_flowDirection != value) + { + _flowDirection = value; + OnPropertyChanged(); + } + } + } + + public FontAttributes FontAttributes + { + get => _fontAttributes; + set + { + if (_fontAttributes != value) + { + _fontAttributes = value; + OnPropertyChanged(); + } + } + } + + public string FontFamily + { + get => _fontFamily; + set + { + if (_fontFamily != value) + { + _fontFamily = value; + OnPropertyChanged(); + } + } + } + + public double FontSize + { + get => _fontSize; + set + { + if (_fontSize != value) + { + _fontSize = value; + OnPropertyChanged(); + } + } + } + + public bool IsEnabled + { + get => _isEnabled; + set + { + if (_isEnabled != value) + { + _isEnabled = value; + OnPropertyChanged(); + } + } + } + + public bool IsVisible + { + get => _isVisible; + set + { + if (_isVisible != value) + { + _isVisible = value; + OnPropertyChanged(); + } + } + } + + public LineBreakMode LineBreakMode + { + get => _lineBreakMode; + set + { + if (_lineBreakMode != value) + { + _lineBreakMode = value; + OnPropertyChanged(); + } + } + } + + public double Padding + { + get => _padding; + set + { + if (_padding != value) + { + _padding = value; + OnPropertyChanged(); + } + } + } + + public float ShadowOpacity + { + get => _shadowOpacity; + set + { + if (_shadowOpacity != value) + { + _shadowOpacity = value; + OnPropertyChanged(); + } + } + } + + public string Text + { + get => _text; + set + { + if (_text != value) + { + _text = value; + OnPropertyChanged(); + } + } + } + + public Color TextColor + { + get => _textColor; + set + { + if (_textColor != value) + { + _textColor = value; + OnPropertyChanged(); + } + } + } + + public TextTransform TextTransform + { + get => _textTransform; + set + { + if (_textTransform != value) + { + _textTransform = value; + OnPropertyChanged(); + } + } + } + + public ButtonViewModal() + { + Command = new Command( + execute: (buttonText) => + { + if (buttonText == "Command with Parameter") + { + Text = "Command Executed with Parameter"; + } + else + { + Text = "Command Executed"; + } + } + ); + } + + public event PropertyChangedEventHandler PropertyChanged; + protected void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } +} diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderColorAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderColorAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..58a84b523647 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderColorAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..0ee16fa8c6bd Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png new file mode 100644 index 000000000000..35bdb0c96db6 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png new file mode 100644 index 000000000000..6be8765bc924 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..8b55a0f6ad4e Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..c1382adb89c1 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..d485a322e54b Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeWordWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeWordWrap_VerifyVisualState.png new file mode 100644 index 000000000000..78b6b8877b32 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_SetLineBreakModeWordWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndFontFamily_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndFontFamily_VerifyVisualState.png new file mode 100644 index 000000000000..b90c81f93d50 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndFontFamily_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..4d3ec0b9d942 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndText_VerifyVisualState.png new file mode 100644 index 000000000000..9434d032b739 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontAttributesAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..555e533fb6f6 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndText_VerifyVisualState.png new file mode 100644 index 000000000000..e2c15de0cf08 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontFamilyAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..acb6e4d06479 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..3e1619d02ada Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..4349f4cb7e6c Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setFontSizeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setPaddingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setPaddingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..68246af3494c Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setPaddingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setShadowAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setShadowAndText_VerifyVisualState.png new file mode 100644 index 000000000000..79972f32dc91 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setShadowAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setTextAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setTextAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..6b7428c412d7 Binary files /dev/null and b/src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/Button_setTextAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonFeatureTests.cs new file mode 100644 index 000000000000..9e6fe1c3475a --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ButtonFeatureTests.cs @@ -0,0 +1,457 @@ +using System; +using Microsoft.Maui.Platform; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests; + +public class ButtonFeatureTests : UITest +{ + public const string ButtonFeatureMatrix = "Button Feature Matrix"; + public ButtonFeatureTests(TestDevice testDevice) : base(testDevice) + { + } + + protected override void FixtureSetup() + { + base.FixtureSetup(); + App.NavigateToGallery(ButtonFeatureMatrix); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetBorderColorAndTextColor_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState() + { + 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(); + } + +#if TEST_FAILS_ON_IOS && TEST_FAILS_ON_CATALYST //CharacterSpacingEntry property not working on iOS and Catalyst, Issue: https://github.com/dotnet/maui/issues/21488 + [Test] + [Category(UITestCategories.Button)] + public void Button_SetCharacterSpacingAndText_VerifyVisualState() + { + 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"); + VerifyScreenshot(); + } +#endif + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetCommandAndCommandParameter() + { + App.WaitForElement("ButtonControl"); + App.Tap("ButtonControl"); + Assert.That(App.FindElement("ButtonControl").GetText(), Is.EqualTo("Command Executed")); + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("TextEntry"); + App.ClearText("TextEntry"); + App.EnterText("TextEntry", "Command with Parameter"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + App.Tap("ButtonControl"); + Assert.That(App.FindElement("ButtonControl").GetText(), Is.EqualTo("Command Executed with Parameter")); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetCornerRadiusAndBorderWidth_VerifyVisualState() + { + 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"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_VerifiesAllEventHandlersExecute() + { + App.WaitForElement("ButtonControl"); + App.Tap("ButtonControl"); + Assert.That(App.FindElement("ClickedEventLabel").GetText(), Is.EqualTo("Clicked Event Executed")); + Assert.That(App.FindElement("PressedEventLabel").GetText(), Is.EqualTo("Pressed Event Executed")); + Assert.That(App.FindElement("ReleasedEventLabel").GetText(), Is.EqualTo("Released Event Executed")); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontAttributesAndFontFamily_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontAttributesAndText_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontAttributesAndTextTransform_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontFamilyAndText_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontFamilyAndTextTransform_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontSizeAndLineBreakMode_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontSizeAndText_VerifyVisualState() + { + 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"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setFontSizeAndTextTransform_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetIsEnabledFalse_VerifyButtonState() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("IsEnabledFalseButton"); + App.Tap("IsEnabledFalseButton"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + App.WaitForElement("ButtonControl"); + App.Tap("ButtonControl"); + Assert.That(App.FindElement("ClickedEventLabel").GetText(), Is.EqualTo(string.Empty)); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetIsVisibleFalse_VerifyButtonState() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("IsVisibleFalseButton"); + App.Tap("IsVisibleFalseButton"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForNoElement("ButtonControl"); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetLineBreakModeCharacterWrap_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetLineBreakModeHeadTruncation_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetLineBreakModeMiddleTruncation_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetLineBreakModeTailTruncation_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_SetLineBreakModeWordWrap_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setPaddingAndText_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setShadowAndText_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setTextAndTextColor_VerifyVisualState() + { + 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(); + } + + [Test] + [Category(UITestCategories.Button)] + public void Button_setTextAndTextTransform_VerifyVisualState() + { + App.WaitForElement("Options"); + App.Tap("Options"); + App.WaitForElement("TextEntry"); + App.EnterText("TextEntry", "ButtonText"); + App.WaitForElement("TextTransformUppercaseButton"); + App.Tap("TextTransformUppercaseButton"); + App.WaitForElement("Apply"); + App.Tap("Apply"); + App.WaitForElementTillPageNavigationSettled("ButtonControl"); + Assert.That(App.FindElement("ButtonControl").GetText(), Is.EqualTo("BUTTONTEXT")); + } +} diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderColorAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderColorAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..c7267895427b Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderColorAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..93ae09610ffc Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCharacterSpacingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCharacterSpacingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..b73e7eeb30b1 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCharacterSpacingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png new file mode 100644 index 000000000000..191e927e8e5c Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png new file mode 100644 index 000000000000..4ac24a80dd19 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..882977a68c2d Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..aeb5cca2a68d Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..a915f142a4b9 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeWordWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeWordWrap_VerifyVisualState.png new file mode 100644 index 000000000000..8f3e4f634015 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_SetLineBreakModeWordWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndFontFamily_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndFontFamily_VerifyVisualState.png new file mode 100644 index 000000000000..24eedde6f87a Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndFontFamily_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..087efe2de990 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndText_VerifyVisualState.png new file mode 100644 index 000000000000..7c1bc7774928 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontAttributesAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..d3b8dbd64b1e Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndText_VerifyVisualState.png new file mode 100644 index 000000000000..31613baea038 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontFamilyAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..541ca7e3a1c2 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..d96348ddff2f Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..d4406e854846 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setFontSizeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setPaddingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setPaddingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..ee86cfa58f34 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setPaddingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setShadowAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setShadowAndText_VerifyVisualState.png new file mode 100644 index 000000000000..91cc946f84a7 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setShadowAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setTextAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setTextAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..c4a457a5d080 Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/Button_setTextAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderColorAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderColorAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..8967698bb133 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderColorAndTextColor_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..4bc29581bf1f Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetBorderWidthEntryAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png new file mode 100644 index 000000000000..d1343bf29cad Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetCornerRadiusAndBorderWidth_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png new file mode 100644 index 000000000000..0ffbfb4bf4cc Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeCharacterWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..c55f220b08d7 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeHeadTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..1d65509d0a24 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeMiddleTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png new file mode 100644 index 000000000000..232f25968950 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeTailTruncation_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeWordWrap_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeWordWrap_VerifyVisualState.png new file mode 100644 index 000000000000..ff65aefbe1a1 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_SetLineBreakModeWordWrap_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndFontFamily_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndFontFamily_VerifyVisualState.png new file mode 100644 index 000000000000..f0865b3aea4d Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndFontFamily_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..5b87f01b08e4 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndText_VerifyVisualState.png new file mode 100644 index 000000000000..d28dec74d06a Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontAttributesAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..0de5d8de4152 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndText_VerifyVisualState.png new file mode 100644 index 000000000000..50e3460a2ec8 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontFamilyAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png new file mode 100644 index 000000000000..5c3075048a1d Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndLineBreakMode_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndTextTransform_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndTextTransform_VerifyVisualState.png new file mode 100644 index 000000000000..3bab55223597 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndTextTransform_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..89ef02f06909 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setFontSizeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setLineBreakModeAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setLineBreakModeAndText_VerifyVisualState.png new file mode 100644 index 000000000000..5a1f02af958a Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setLineBreakModeAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setPaddingAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setPaddingAndText_VerifyVisualState.png new file mode 100644 index 000000000000..b89e61a55096 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setPaddingAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setShadowAndText_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setShadowAndText_VerifyVisualState.png new file mode 100644 index 000000000000..36fa52620a38 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setShadowAndText_VerifyVisualState.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setTextAndTextColor_VerifyVisualState.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setTextAndTextColor_VerifyVisualState.png new file mode 100644 index 000000000000..76c426d60f58 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/Button_setTextAndTextColor_VerifyVisualState.png differ