Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ internal PointerGestureHandler(Func<View> getView, Func<AView> getControl)
public bool OnHover(AView control, MotionEvent e)
{
var view = GetView();

if (view == null)
return false;

var platformPointerArgs = new PlatformPointerEventArgs(control, e);

foreach (var gesture in view.GetCompositeGestureRecognizers())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Linq;
using System.Threading.Tasks;
using Android.Views;
Expand All @@ -22,12 +22,67 @@
using static Microsoft.Maui.Controls.Platform.Compatibility.ShellFlyoutTemplatedContentRenderer;
using static Microsoft.Maui.DeviceTests.AssertHelpers;
using AView = Android.Views.View;
using ShellHandler = Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer;

namespace Microsoft.Maui.DeviceTests
{
[Category(TestCategory.Shell)]
public partial class ShellTests
{
[Fact(DisplayName = "No crash going back using 'Shell.Current.GoToAsync(\"..\")'")]
public async Task GoingBackUsingGoToAsyncMethod()
{
SetupBuilder();

var page1 = new ContentPage();

var page2Content = new Label { Text = "Test" };
var page2 = new ContentPage { Content = page2Content };

var pointerGestureRecognizer = new PointerGestureRecognizer();
pointerGestureRecognizer.PointerPressed += (sender, args) =>
{
Console.WriteLine("Page Content pressed");
};

page2Content.GestureRecognizers.Add(pointerGestureRecognizer);

var shell = await CreateShellAsync((shell) =>
{
shell.Items.Add(new TabBar()
{
Items =
{
new ShellContent()
{
Route = "Item1",
Content = page1
},
new ShellContent()
{
Route = "Item2",
Content = page2
},
}
});
});

await CreateHandlerAndAddToWindow<ShellHandler>(shell, async (handler) =>
{
await OnLoadedAsync(page1);
await shell.GoToAsync("//Item2");
await shell.GoToAsync("..");

await shell.GoToAsync("//Item1");
await shell.GoToAsync("//Item2");
await shell.Navigation.PopAsync();

await shell.GoToAsync("//Item1");
await shell.GoToAsync("//Item2");
await shell.GoToAsync("..");
});
}

[Theory]
[InlineData(true)]
[InlineData(false)]
Expand Down