From 54ff607c1f1cb80b74783e49d20a103c7cf01e38 Mon Sep 17 00:00:00 2001 From: Jakub Florkowski Date: Mon, 6 May 2024 00:44:14 +0200 Subject: [PATCH] Issue #21837 - UITest --- .../TestCases.HostApp/Issues/Issue21837.xaml | 93 +++++++++++++++++++ .../Issues/Issue21837.xaml.cs | 28 ++++++ .../Tests/Issues/Issue21837.cs | 29 ++++++ 3 files changed, 150 insertions(+) create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml create mode 100644 src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml.cs create mode 100644 src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21837.cs diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml new file mode 100644 index 000000000000..99a5703ba492 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml @@ -0,0 +1,93 @@ + + + + + + diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml.cs new file mode 100644 index 000000000000..aab89dca26e7 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue21837.xaml.cs @@ -0,0 +1,28 @@ +using Microsoft.Maui.Controls; +using Microsoft.Maui.Controls.Xaml; +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 21837, "Span's TapGestureRecognizer not working if text is truncated", PlatformAffected.All)] + +public partial class Issue21837 : ContentPage +{ + private int _tapCount; + public int TapCount + { + get => _tapCount; + set + { + _tapCount = value; + OnPropertyChanged(); + } + } + + public Command TapCommand { get; set; } + + public Issue21837() + { + InitializeComponent(); + TapCommand = new Command(() => ++TapCount); + BindingContext = this; + } +} diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21837.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21837.cs new file mode 100644 index 000000000000..0f85924133b5 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue21837.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues; + +public class Issue21837 : _IssuesUITest +{ + public Issue21837(TestDevice device) : base(device) + { + } + + public override string Issue => "Span's TapGestureRecognizer not working if text is truncated"; + + [Test] + [Category(UITestCategories.Label)] + public void TapsShouldBeCorrectlyRecognized() + { + int numberOfTappableLabels = 7; + + _ = App.WaitForElement("label1"); + + for (int i = 0; i < numberOfTappableLabels; i++) + App.Click($"label{i + 1}"); + + var resultText = App.FindElement("resultLabel").GetText(); + Assert.That(resultText, Is.EqualTo($"Number of recognized taps: {numberOfTappableLabels}")); + } +}