Skip to content

Commit c61633a

Browse files
committed
Flyout IsGestureEnabled - UI Test
1 parent a730258 commit c61633a

File tree

6 files changed

+79
-13
lines changed

6 files changed

+79
-13
lines changed
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<FlyoutPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="Maui.Controls.Sample.Issues.Issue21240"
5+
IsGestureEnabled="False"
6+
Title="Issue21240">
7+
<FlyoutPage.Flyout>
8+
<ContentPage Title="Flyout page"/>
9+
</FlyoutPage.Flyout>
10+
<FlyoutPage.Detail>
11+
<NavigationPage>
12+
<x:Arguments>
13+
<ContentPage>
14+
<Label AutomationId="label" Text="Hello, World!"/>
15+
</ContentPage>
16+
</x:Arguments>
17+
</NavigationPage>
18+
</FlyoutPage.Detail>
19+
</FlyoutPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Microsoft.Maui.Controls;
2+
using Microsoft.Maui.Controls.Xaml;
3+
4+
namespace Maui.Controls.Sample.Issues;
5+
6+
[XamlCompilation(XamlCompilationOptions.Compile)]
7+
[Issue(IssueTracker.Github, 21240, "FlyoutPage IsGestureEnabled not working", PlatformAffected.Android)]
8+
9+
public partial class Issue21240 : FlyoutPage
10+
{
11+
public Issue21240()
12+
{
13+
InitializeComponent();
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#if ANDROID || IOS
2+
using NUnit.Framework;
3+
using UITest.Appium;
4+
using UITest.Core;
5+
6+
namespace Microsoft.Maui.TestCases.Tests.Issues
7+
{
8+
public class Issue21240 : _IssuesUITest
9+
{
10+
public override string Issue => "FlyoutPage IsGestureEnabled not working";
11+
12+
public Issue21240(TestDevice device) : base(device)
13+
{
14+
}
15+
16+
[Test]
17+
[Category(UITestCategories.FlyoutPage)]
18+
public void FlyoutShouldNotBePresented()
19+
{
20+
App.WaitForElement("label");
21+
App.SwipeLeftToRight(1, 500);
22+
23+
// The test passes if a flyout is not present
24+
VerifyScreenshot();
25+
}
26+
}
27+
}
28+
#endif
Loading

src/Core/src/Handlers/FlyoutView/FlyoutViewHandler.Android.cs

+17-13
Original file line numberDiff line numberDiff line change
@@ -265,22 +265,26 @@ void UpdateIsPresented()
265265
void UpdateFlyoutBehavior()
266266
{
267267
var behavior = VirtualView.FlyoutBehavior;
268-
if (_detailViewFragment?.DetailView?.Handler?.PlatformView == null)
269-
return;
270268

271-
// Important to create the layout views before setting the lock mode
272-
LayoutViews();
269+
if (_detailViewFragment?.DetailView?.Handler?.PlatformView is not null)
270+
{
271+
// Important to create the layout views before setting the lock mode
272+
LayoutViews();
273+
}
273274

274-
switch (behavior)
275+
if (DrawerLayout is not null)
275276
{
276-
case FlyoutBehavior.Disabled:
277-
case FlyoutBehavior.Locked:
278-
DrawerLayout.CloseDrawers();
279-
DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeLockedClosed);
280-
break;
281-
case FlyoutBehavior.Flyout:
282-
DrawerLayout.SetDrawerLockMode(VirtualView.IsGestureEnabled ? DrawerLayout.LockModeUnlocked : DrawerLayout.LockModeLockedClosed);
283-
break;
277+
switch (behavior)
278+
{
279+
case FlyoutBehavior.Disabled:
280+
case FlyoutBehavior.Locked:
281+
DrawerLayout.CloseDrawers();
282+
DrawerLayout.SetDrawerLockMode(DrawerLayout.LockModeLockedClosed);
283+
break;
284+
case FlyoutBehavior.Flyout:
285+
DrawerLayout.SetDrawerLockMode(VirtualView.IsGestureEnabled ? DrawerLayout.LockModeUnlocked : DrawerLayout.LockModeLockedClosed);
286+
break;
287+
}
284288
}
285289
}
286290

0 commit comments

Comments
 (0)