This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Android] Fix occasional wrong touch interception in SwipeView Content (
#13732) * Fix wrong touch interception in SwipeView Content on Android * Updated swipe delta
- Loading branch information
1 parent
4f1a837
commit 3470b92
Showing
4 changed files
with
146 additions
and
9 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13726.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,50 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:TestContentPage | ||
xmlns="http://xamarin.com/schemas/2014/forms" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:d="http://xamarin.com/schemas/2014/forms/design" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Title="Test 13726" xmlns:local="using:Xamarin.Forms.Controls" | ||
x:Class="Xamarin.Forms.Controls.Issues.Issue13726"> | ||
<StackLayout> | ||
<Label | ||
Padding="12" | ||
BackgroundColor="Black" | ||
TextColor="White" | ||
Text="Tap several times the Button. If the counter is always updated, the test has passed."/> | ||
<StackLayout | ||
Padding="12"> | ||
<Label | ||
Text="Button"/> | ||
<Button | ||
Text="Tap" | ||
Clicked="OnButtonClicked"/> | ||
<Label | ||
x:Name="ButtonInfoLabel" | ||
FontSize="Medium" | ||
HorizontalOptions="Center"/> | ||
<Label | ||
Text="Button inside SwipeView"/> | ||
<SwipeView> | ||
<SwipeView.RightItems> | ||
<SwipeItem | ||
Text="Delete" | ||
BackgroundColor="Red"/> | ||
</SwipeView.RightItems> | ||
<Grid | ||
BackgroundColor="LightGray"> | ||
<Button | ||
AutomationId="SwipeViewButtonId" | ||
Text="Tap" | ||
Clicked="OnSwipeViewButtonClicked"/> | ||
</Grid> | ||
</SwipeView> | ||
<Label | ||
x:Name="SwipeViewInfoLabel" | ||
AutomationId="SwipeViewInfoLabelId" | ||
FontSize="Medium" | ||
HorizontalOptions="Center"/> | ||
</StackLayout> | ||
</StackLayout> | ||
</local:TestContentPage> |
73 changes: 73 additions & 0 deletions
73
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13726.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,73 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using Xamarin.Forms.CustomAttributes; | ||
using System.Threading.Tasks; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 13726, | ||
"[Bug] Clicks on elements within a SwipeView are buggy", | ||
PlatformAffected.Android)] | ||
public partial class Issue13726 : TestContentPage | ||
{ | ||
#if APP | ||
int _buttonCounter = 0; | ||
int _swipeViewCounter = 0; | ||
#endif | ||
|
||
public Issue13726() | ||
{ | ||
#if APP | ||
InitializeComponent(); | ||
#endif | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
} | ||
|
||
#if APP | ||
void OnButtonClicked(object sender, EventArgs e) | ||
{ | ||
_buttonCounter++; | ||
ButtonInfoLabel.Text = $"SwipeView Button tapped {_buttonCounter} times"; | ||
} | ||
|
||
void OnSwipeViewButtonClicked(object sender, EventArgs e) | ||
{ | ||
_swipeViewCounter++; | ||
SwipeViewInfoLabel.Text = $"SwipeView Button tapped {_swipeViewCounter} times"; | ||
} | ||
#endif | ||
|
||
#if UITEST && __ANDROID__ | ||
[Test] | ||
public void TouchSwipeViewContentTest() | ||
{ | ||
string swipeViewButtonId = "SwipeViewButtonId"; | ||
string swipeViewInfoLabelId = "SwipeViewInfoLabelId"; | ||
|
||
RunningApp.WaitForElement(q => q.Marked(swipeViewButtonId)); | ||
|
||
for (int i = 0; i < 10; i++) | ||
RunningApp.Tap(q => q.Marked(swipeViewButtonId)); | ||
|
||
RunningApp.SwipeRightToLeft(q => q.Marked(swipeViewButtonId)); | ||
|
||
for (int i = 0; i < 10; i++) | ||
RunningApp.Tap(q => q.Marked(swipeViewButtonId)); | ||
|
||
var infoLabel = RunningApp.WaitForFirstElement(swipeViewInfoLabelId); | ||
|
||
Assert.AreEqual("SwipeView Button tapped 20 times", infoLabel.ReadText()); | ||
} | ||
#endif | ||
} | ||
} |
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
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