-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
src/Controls/samples/Controls.Sample.UITests/Issues/Issue19329.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue19329"> | ||
<VerticalStackLayout x:Name="layout" Margin="75,75,75,75" BackgroundColor="LightGray"> | ||
<BoxView x:Name="UpperBox" AutomationId="UpperBox" Color="CornflowerBlue" WidthRequest="20" HeightRequest="20"/> | ||
|
||
<Button AutomationId="TapHere" Text="Tap Here"> | ||
<Button.GestureRecognizers> | ||
<TapGestureRecognizer Tapped="OnTapped" /> | ||
</Button.GestureRecognizers> | ||
</Button> | ||
</VerticalStackLayout> | ||
</ContentPage> |
44 changes: 44 additions & 0 deletions
44
src/Controls/samples/Controls.Sample.UITests/Issues/Issue19329.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Collections.ObjectModel; | ||
using System.Diagnostics; | ||
using Microsoft.Maui; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Graphics; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 19329, "Pointer gestures should work with relative positions correctly", PlatformAffected.iOS)] | ||
public partial class Issue19329 : ContentPage | ||
{ | ||
public Issue19329() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void OnTapped(object sender, TappedEventArgs e) | ||
{ | ||
// Report that the callback was called. | ||
layout.Children.Add(new Label { Text = "TapAccepted", AutomationId = "TapAccepted" }); | ||
|
||
Point? position = e.GetPosition(relativeTo: UpperBox); | ||
|
||
string result; | ||
|
||
if (position is null) | ||
{ | ||
result = "Error: position is null"; | ||
} | ||
else if (position.Value.X < 75 && position.Value.X < 75) | ||
{ | ||
result = "Success"; | ||
} | ||
else | ||
{ | ||
result = $"Error: relative position is: X={position.Value.X},Y={position.Value.Y}"; | ||
} | ||
|
||
// Report the result of the test. | ||
layout.Children.Add(new Label { Text = result, AutomationId = result }); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
using System.Drawing; | ||
|
||
namespace Microsoft.Maui.AppiumTests.Issues | ||
{ | ||
public class Issue19329 : _IssuesUITest | ||
{ | ||
public Issue19329(TestDevice device) : base(device) { } | ||
|
||
public override string Issue => "Pointer gestures should work with relative positions correctly"; | ||
|
||
[Test] | ||
public void RelativePointerPositionIsComputedCorrectly() | ||
{ | ||
IUIElement button = App.FindElement("TapHere"); | ||
Rectangle rect = button.GetRect(); | ||
|
||
App.TapCoordinates(rect.CenterX(), rect.CenterY()); | ||
//App.Click(rect.CenterX(), rect.CenterY()); | ||
App.WaitForElement("TapAccepted"); | ||
App.WaitForElement("Success"); | ||
} | ||
} | ||
} |