From 7df5c40615d26164df3c6e351682091d13ed8a0a Mon Sep 17 00:00:00 2001 From: NafeelaNazhir Date: Wed, 11 Jun 2025 18:15:33 +0530 Subject: [PATCH 1/6] Added ImageButton Feature tests --- .../CoreViews/CorePageView.cs | 1 + .../ImageButton/ImageButtonControlPage.xaml | 62 +++ .../ImageButtonControlPage.xaml.cs | 51 ++ .../ImageButton/ImageButtonOptionsPage.xaml | 201 +++++++ .../ImageButtonOptionsPage.xaml.cs | 198 +++++++ .../ImageButton/ImageButtonViewModel.cs | 154 ++++++ .../FeatureMatrix/ImageButtonFeatureTests.cs | 508 ++++++++++++++++++ 7 files changed, 1175 insertions(+) create mode 100644 src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml.cs create mode 100644 src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml.cs create mode 100644 src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonViewModel.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ImageButtonFeatureTests.cs diff --git a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs index f4b860e23b1a..8c72beaa3c9e 100644 --- a/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs +++ b/src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs @@ -82,6 +82,7 @@ public override string ToString() new GalleryPageFactory(() => new CollectionViewFeaturePage(), "CollectionView Feature Matrix"), new GalleryPageFactory(() => new LabelControlPage(), "Label Feature Matrix"), new GalleryPageFactory(() => new CarouselViewFeaturePage(), "CarouselView Feature Matrix"), + new GalleryPageFactory(() => new ImageButtonControlPage(), "ImageButton Feature Matrix"), }; public CorePageView(Page rootPage) diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml new file mode 100644 index 000000000000..f12610b2182c --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml @@ -0,0 +1,62 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml.cs new file mode 100644 index 000000000000..b9e4c2f097a2 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.Maui.Controls; + +namespace Maui.Controls.Sample; + +public class ImageButtonControlPage : NavigationPage +{ + private ImageButtonViewModel _viewModel; + + public ImageButtonControlPage() + { + _viewModel = new ImageButtonViewModel(); + PushAsync(new ImageButtonControlMainPage(_viewModel)); + } +} + +public partial class ImageButtonControlMainPage : ContentPage +{ + private ImageButtonViewModel _viewModel; + + public ImageButtonControlMainPage(ImageButtonViewModel viewModel) + { + InitializeComponent(); + _viewModel = viewModel; + BindingContext = _viewModel; + } + + private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e) + { + BindingContext = _viewModel = new ImageButtonViewModel(); + await Navigation.PushAsync(new ImageButtonOptionsPage(_viewModel)); + } + + private void OnImageButtonClicked(object sender, EventArgs e) + { + _viewModel.ClickTotal++; + _viewModel.IsButtonClicked = true; + } + + private void OnImageButtonPressed(object sender, EventArgs e) + { + _viewModel.PressedTotal++; + _viewModel.IsButtonClicked = true; + } + + private void OnImageButtonReleased(object sender, EventArgs e) + { + _viewModel.ReleasedTotal++; + _viewModel.IsButtonClicked = true; + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml new file mode 100644 index 000000000000..bf8bebf5455a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml.cs new file mode 100644 index 000000000000..138127e820e9 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonOptionsPage.xaml.cs @@ -0,0 +1,198 @@ +namespace Maui.Controls.Sample; + +public partial class ImageButtonOptionsPage : ContentPage +{ + private readonly ImageButtonViewModel _viewModel; + public static string Base64EncodedImage = "iVBORw0KGgoAAAANSUhEUgAAA+gAAAPoCAYAAABNo9TkAAAYuUlEQVR4Xu3aQU7qUACF4cNLdwMDouxDwgpk4jYq23ACKyC4DzUdwHr6TEdOTaSFe78vuSvA9PS3d9b3faYFAAAA/Eu1AAAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQAQAAQKADAAAAAh0AAAAEOgAAACDQ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dmzvu8zLjaLyzrJMmUC6L7H/JS7AfYcwJ4LdAAAAMAVdwAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAABDoAAAAgEAHAAAAgQ4AAAAIdAAAAOA/QHZ2FC6ZI88AAAAASUVORK5CYII="; + + public ImageButtonOptionsPage(ImageButtonViewModel viewModel) + { + InitializeComponent(); + _viewModel = viewModel; + BindingContext = _viewModel; + } + + private async void ApplyButton_Clicked(object sender, EventArgs e) + { + if (Navigation.NavigationStack.Count > 1) + { + await Navigation.PopAsync(); + } + } + private void AspectRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton rb) || !rb.IsChecked) + return; + switch (rb.Content?.ToString()) + { + case "AspectFit": + _viewModel.Aspect = Aspect.AspectFit; + break; + case "AspectFill": + _viewModel.Aspect = Aspect.AspectFill; + break; + case "Fill": + _viewModel.Aspect = Aspect.Fill; + break; + case "Center": + _viewModel.Aspect = Aspect.Center; + break; + } + } + + private void OpaqueRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton rb) || !rb.IsChecked) + return; + _viewModel.IsOpaque = rb.Content?.ToString() == "True"; + } + + private void SourceTypeRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (sender is RadioButton rb && rb.IsChecked) + { + string type = rb.Content?.ToString() ?? ""; + switch (type) + { + case "File": + _viewModel.Source = new FileImageSource + { + File = "dotnet_bot.png" + }; + break; + case "Uri": + _viewModel.Source = new UriImageSource + { + Uri = new Uri("https://aka.ms/campus.jpg"), + CachingEnabled = true, + CacheValidity = TimeSpan.MaxValue // Effectively infinite cache + }; + break; + + case "Stream": + var imageBytes = Convert.FromBase64String(Base64EncodedImage); + _viewModel.Source = Microsoft.Maui.Controls.ImageSource.FromStream(() => new MemoryStream(imageBytes)); + break; + case "FontImage": + _viewModel.Source = new FontImageSource + { + FontFamily = "Ion", + Glyph = "\uf30c", + Color = Colors.Red, + Size = 250 + }; + break; + } + } + } + + private void BorderColorRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton rb) || !rb.IsChecked) + return; + switch (rb.Content?.ToString()) + { + case "Red": + _viewModel.BorderColor = Colors.Red; + break; + case "Green": + _viewModel.BorderColor = Colors.Green; + break; + } + } + + private void BorderWidthEntry_TextChanged(object sender, TextChangedEventArgs e) + { + if (double.TryParse(e.NewTextValue, out double width)) + _viewModel.BorderWidth = width; + } + + + private void IsEnabledRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton rb) || !rb.IsChecked) + return; + _viewModel.IsEnabled = rb.Content?.ToString() == "True"; + } + + private void PaddingSlider_ValueChanged(object sender, ValueChangedEventArgs e) + { + _viewModel.Padding = new Thickness(e.NewValue); + } + + private void PaddingEntry_TextChanged(object sender, TextChangedEventArgs e) + { + if (double.TryParse(e.NewTextValue, out double padding)) + _viewModel.Padding = new Thickness(padding); + } + + private void OnPaddingChanged(object sender, TextChangedEventArgs e) + { + if (string.IsNullOrWhiteSpace(PaddingEntry?.Text)) + return; + try + { + string[] parts = PaddingEntry.Text.Split(','); + if (parts.Length == 4 && + double.TryParse(parts[0], out double left) && + double.TryParse(parts[1], out double top) && + double.TryParse(parts[2], out double right) && + double.TryParse(parts[3], out double bottom)) + { + _viewModel.Padding = new Thickness(left, top, right, bottom); + } + } + catch { } + } + + private void IsVisibleRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (!(sender is RadioButton rb) || !rb.IsChecked) + return; + _viewModel.IsVisible = rb.Content?.ToString() == "True"; + } + + private void ShadowRadio_CheckedChanged(object sender, CheckedChangedEventArgs e) + { + if (e.Value && BindingContext is ImageButtonViewModel vm) + { + var rb = sender as RadioButton; + if (rb?.Content?.ToString() == "True") + { + vm.Shadow = new Shadow { Brush = Brush.Black, Offset = new Point(5, 5), Radius = 5, Opacity = 0.5f }; + } + else if (rb?.Content?.ToString() == "False") + { + vm.Shadow = null!; + } + } + } + + private void OnFlowDirectionChanged(object sender, EventArgs e) + { + _viewModel.FlowDirection = FlowDirectionLTR.IsChecked ? FlowDirection.LeftToRight : FlowDirection.RightToLeft; + } + + private void OnCornerRadiusChanged(object sender, TextChangedEventArgs e) + { + if (string.IsNullOrWhiteSpace(CornerRadiusEntry?.Text)) + return; + try + { + string[] parts = CornerRadiusEntry.Text.Split(','); + if (parts.Length == 4 && + int.TryParse(parts[0], out int topLeft) && + int.TryParse(parts[1], out int topRight) && + int.TryParse(parts[2], out int bottomLeft) && + int.TryParse(parts[3], out int bottomRight)) + { + _viewModel.CornerRadius = topLeft; + } + else if (parts.Length == 1 && int.TryParse(parts[0], out int uniform)) + { + _viewModel.CornerRadius = uniform; + } + } + catch { } + } +} diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonViewModel.cs b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonViewModel.cs new file mode 100644 index 000000000000..1229b9dafd49 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonViewModel.cs @@ -0,0 +1,154 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Microsoft.Maui.Graphics; +using Microsoft.Maui.Controls; +using System.Windows.Input; + +namespace Maui.Controls.Sample; + +public class ImageButtonViewModel : INotifyPropertyChanged +{ + private Aspect _aspect = Aspect.AspectFit; + private bool _isOpaque = false; + private ImageSource _source = ImageSource.FromFile("dotnet_bot.png"); + private Color _borderColor = Colors.Black; + private double _borderWidth = 1; + private int _cornerRadius; + private bool _isEnabled = true; + private Thickness _padding = new Thickness(10); + private bool _isVisible = true; + private Shadow _shadow = null; + private FlowDirection _flowDirection = FlowDirection.LeftToRight; + public ICommand ImageCommand { get; } + private int _clickTotal; + private int _pressedTotal; + private int _releasedTotal; + private bool _isButtonClicked; + private string _commandResult = "Tap the ImageButton to see the result."; + public object CommandParameter { get; set; } + + + public Aspect Aspect + { + get => _aspect; + set { if (_aspect != value) { _aspect = value; OnPropertyChanged(); } } + } + + public bool IsOpaque + { + get => _isOpaque; + set { if (_isOpaque != value) { _isOpaque = value; OnPropertyChanged(); } } + } + + + public ImageSource Source + { + get => _source!; + set { if (_source != value) { _source = value; OnPropertyChanged(); } } + } + + 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 int CornerRadius + { + get => _cornerRadius; + set { if (_cornerRadius != value) { _cornerRadius = value; OnPropertyChanged(); } } + } + + public bool IsEnabled + { + get => _isEnabled; + set { if (_isEnabled != value) { _isEnabled = value; OnPropertyChanged(); } } + } + + public Thickness Padding + { + get => _padding; + set { if (_padding != value) { _padding = value; OnPropertyChanged(); } } + } + + public bool IsVisible + { + get => _isVisible; + set { if (_isVisible != value) { _isVisible = value; OnPropertyChanged(); } } + } + + public Shadow Shadow + { + get => _shadow; + set { if (_shadow != value) { _shadow = value; OnPropertyChanged(); } } + } + + public FlowDirection FlowDirection + { + get => _flowDirection; + set { if (_flowDirection != value) { _flowDirection = value; OnPropertyChanged(); } } + } + + public string CommandResult + { + get => _commandResult; + set { _commandResult = value; OnPropertyChanged(); } + } + + public int ClickTotal + { + get => _clickTotal; + set { _clickTotal = value; OnPropertyChanged(); } + } + + public int PressedTotal + { + get => _pressedTotal; + set { _pressedTotal = value; OnPropertyChanged(); } + } + + public int ReleasedTotal + { + get => _releasedTotal; + set { _releasedTotal = value; OnPropertyChanged(); } + } + + + public bool IsButtonClicked + { + get => _isButtonClicked; + set + { + if (_isButtonClicked != value) + { + _isButtonClicked = value; + OnPropertyChanged(); + } + } + } + + public ImageButtonViewModel() + { + CommandParameter = "CommandParameter"; + ImageCommand = new Command(OnImageCommandExecuted); + } + + private void OnImageCommandExecuted(object parameter) + { + CommandResult = $"ImageButton: {parameter}"; + IsButtonClicked = true; + } + + + public event PropertyChangedEventHandler PropertyChanged; + + protected void OnPropertyChanged([CallerMemberName] string propertyName = "") => + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ImageButtonFeatureTests.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ImageButtonFeatureTests.cs new file mode 100644 index 000000000000..7df3acebe2b8 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/FeatureMatrix/ImageButtonFeatureTests.cs @@ -0,0 +1,508 @@ +using Microsoft.Maui.Controls.Shapes; +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + + +namespace Microsoft.Maui.TestCases.Tests; + +public class ImageButtonFeatureTests : UITest +{ + public const string ImageButtonFeatureMatrix = "ImageButton Feature Matrix"; + public const string Options = "Options"; + public const string Apply = "Apply"; + public const string ImageAspectFit = "ImageAspectFit"; + public const string ImageAspectFill = "ImageAspectFill"; + public const string ImageFill = "ImageFill"; + public const string ImageCenter = "ImageCenter"; + public const string SourceTypeFile = "SourceTypeFile"; + public const string SourceTypeFontImage = "SourceTypeFontImage"; + public const string SourceTypeStream = "SourceTypeStream"; + public const string SourceTypeUri = "SourceTypeUri"; + public const string FlowDirectionRTL = "FlowDirectionRTL"; + public const string ShadowTrue = "ShadowTrue"; + public const string BorderGreen = "BorderGreen"; + public const string BorderWidthEntry = "BorderWidthEntry"; + public const string CornerRadiusEntry = "CornerRadiusEntry"; + public const string IsVisibleFalse = "IsVisibleFalse"; + public const string IsEnabledFalse = "IsEnabledFalse"; + public const string PaddingEntry = "PaddingEntry"; + + + public ImageButtonFeatureTests(TestDevice device) + : base(device) + { + } + + protected override void FixtureSetup() + { + base.FixtureSetup(); + App.NavigateToGallery(ImageButtonFeatureMatrix); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFitWithImageSourceFromFile() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFit); + App.Tap(ImageAspectFit); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFitWithImageSourceFromUri() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFit); + App.Tap(ImageAspectFit); + App.WaitForElement(SourceTypeUri); + App.Tap(SourceTypeUri); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl", timeout: TimeSpan.FromSeconds(3)); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFitWithImageSourceFromStream() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFit); + App.Tap(ImageAspectFit); + App.WaitForElement(SourceTypeStream); + App.Tap(SourceTypeStream); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFitWithImageSourceFromFontImage() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFit); + App.Tap(ImageAspectFit); + App.WaitForElement(SourceTypeFontImage); + App.Tap(SourceTypeFontImage); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFillWithImageSourceFromFile() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFill); + App.Tap(ImageAspectFill); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFillWithImageSourceFromUri() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFill); + App.Tap(ImageAspectFill); + App.WaitForElement(SourceTypeUri); + App.Tap(SourceTypeUri); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl", timeout: TimeSpan.FromSeconds(3)); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFillWithImageSourceFromStream() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFill); + App.Tap(ImageAspectFill); + App.WaitForElement(SourceTypeStream); + App.Tap(SourceTypeStream); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_AspectFillWithImageSourceFromFontImage() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageAspectFill); + App.Tap(ImageAspectFill); + App.WaitForElement(SourceTypeFontImage); + App.Tap(SourceTypeFontImage); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_FillWithImageSourceFromFile() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageFill); + App.Tap(ImageFill); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_FillWithImageSourceFromUri() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageFill); + App.Tap(ImageFill); + App.WaitForElement(SourceTypeUri); + App.Tap(SourceTypeUri); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl", timeout: TimeSpan.FromSeconds(3)); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_FillWithImageSourceFromStream() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageFill); + App.Tap(ImageFill); + App.WaitForElement(SourceTypeStream); + App.Tap(SourceTypeStream); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_FillWithImageSourceFromFontImage() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageFill); + App.Tap(ImageFill); + App.WaitForElement(SourceTypeFontImage); + App.Tap(SourceTypeFontImage); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_CenterWithImageSourceFromFile() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageCenter); + App.Tap(ImageCenter); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_CenterWithImageSourceFromUri() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageCenter); + App.Tap(ImageCenter); + App.WaitForElement(SourceTypeUri); + App.Tap(SourceTypeUri); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl", timeout: TimeSpan.FromSeconds(3)); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_CenterWithImageSourceFromStream() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageCenter); + App.Tap(ImageCenter); + App.WaitForElement(SourceTypeStream); + App.Tap(SourceTypeStream); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonAspect_CenterWithImageSourceFromFontImage() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ImageCenter); + App.Tap(ImageCenter); + App.WaitForElement(SourceTypeFontImage); + App.Tap(SourceTypeFontImage); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithIsVisibleFalse() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(IsVisibleFalse); + App.Tap(IsVisibleFalse); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForNoElement("ImageButtonControl"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithIsEnabledFalse() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(IsEnabledFalse); + App.Tap(IsEnabledFalse); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + App.Tap("ImageButtonControl"); + App.WaitForNoElement("ImageButton Clicked: 1"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithShadow() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(ShadowTrue); + App.Tap(ShadowTrue); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonFlowDirectionRTL() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(FlowDirectionRTL); + App.Tap(FlowDirectionRTL); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithClickedEvent() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + App.Tap("ImageButtonControl"); + App.WaitForElement("ImageButton Clicked: 1"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithPressedEvent() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + App.Tap("ImageButtonControl"); + App.WaitForElement("ImageButton Pressed: 1"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithReleasedEvent() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + App.Tap("ImageButtonControl"); + App.WaitForElement("ImageButton Released: 1"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithCommandParameter() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(SourceTypeFile); + App.Tap(SourceTypeFile); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + App.Tap("ImageButtonControl"); + App.WaitForElement("ImageButton: CommandParameter"); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithPadding() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(PaddingEntry); + App.ClearText(PaddingEntry); + App.EnterText(PaddingEntry, "40,40,40,40"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithCornerRadius() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(CornerRadiusEntry); + App.ClearText(CornerRadiusEntry); + App.EnterText(CornerRadiusEntry, "50,50,50,50"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithBorderColor() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(BorderGreen); + App.Tap(BorderGreen); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithBorderWidth() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(BorderWidthEntry); + App.ClearText(BorderWidthEntry); + App.EnterText(BorderWidthEntry, "10"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithBorderColorAndWidth() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(BorderGreen); + App.Tap(BorderGreen); + App.WaitForElement(BorderWidthEntry); + App.ClearText(BorderWidthEntry); + App.EnterText(BorderWidthEntry, "10"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } + + [Test] + [Category(UITestCategories.ImageButton)] + public void VerifyImageButtonWithBorderColorAndWidthAndCornerRadius() + { + App.WaitForElement(Options); + App.Tap(Options); + App.WaitForElement(BorderWidthEntry); + App.ClearText(BorderWidthEntry); + App.EnterText(BorderWidthEntry, "10"); + App.WaitForElement(CornerRadiusEntry); + App.ClearText(CornerRadiusEntry); + App.EnterText(CornerRadiusEntry, "30,30,30,30"); + App.WaitForElement(Apply); + App.Tap(Apply); + App.WaitForElement("ImageButtonControl"); + VerifyScreenshot(); + } +} \ No newline at end of file From 2f5415188c9a1c47d120b771f46266826ab67730 Mon Sep 17 00:00:00 2001 From: NafeelaNazhir Date: Thu, 12 Jun 2025 11:25:08 +0530 Subject: [PATCH 2/6] Changes updated --- .../FeatureMatrix/ImageButton/ImageButtonControlPage.xaml | 6 +----- .../ImageButton/ImageButtonOptionsPage.xaml.cs | 2 +- .../Tests/FeatureMatrix/ImageButtonFeatureTests.cs | 6 ++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml index f12610b2182c..a2fd5489ae09 100644 --- a/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml +++ b/src/Controls/tests/TestCases.HostApp/FeatureMatrix/ImageButton/ImageButtonControlPage.xaml @@ -12,8 +12,7 @@ + ColumnDefinitions="*" >