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.
When navigating between Shell Items disconnect the renderers from the…
… xplat elements (#11791) * Disconnect renderer before disposing of it * - fix ui test * - remove any processing animations * - cleanup code * - fix ui test and add null checks * - include android fixes #11784 fixes #11777
- Loading branch information
Showing
13 changed files
with
303 additions
and
81 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11723.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,108 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.Text; | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
using System.Threading.Tasks; | ||
using System.Runtime.CompilerServices; | ||
using System.Linq; | ||
|
||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11723, "[Bug] ContentPage in NavigationStack misplaced initially", | ||
PlatformAffected.iOS)] | ||
#if UITEST | ||
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github10000)] | ||
[NUnit.Framework.Category(UITestCategories.Shell)] | ||
#endif | ||
public class Issue11723 : TestShell | ||
{ | ||
int labelIndex = 0; | ||
ContentPage CreateContentPage() | ||
{ | ||
var page = new ContentPage() | ||
{ | ||
Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = "As you navigate this text should show up in the correct spot. If it's hidden and then shows up this test has failed.", | ||
AutomationId = $"InitialText{labelIndex}" | ||
}, | ||
new Button() | ||
{ | ||
Text = "Push Page", | ||
AutomationId = "PushPage", | ||
Command = new Command(async () => | ||
{ | ||
labelIndex++; | ||
await Navigation.PushAsync(CreateContentPage()); | ||
}) | ||
}, | ||
new Button() | ||
{ | ||
Text = "Pop Page", | ||
AutomationId = "PopPage", | ||
Command = new Command(async () => | ||
{ | ||
labelIndex--; | ||
await Navigation.PopAsync(); | ||
}) | ||
} | ||
} | ||
} | ||
}; | ||
|
||
SetNavBarIsVisible(page, false); | ||
PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(page, true); | ||
|
||
return page; | ||
} | ||
|
||
protected override void Init() | ||
{ | ||
AddContentPage(CreateContentPage()); | ||
} | ||
|
||
|
||
#if UITEST | ||
[Test] | ||
public void PaddingIsSetOnPageBeforeItsVisible() | ||
{ | ||
var initialTextPosition = RunningApp.WaitForFirstElement($"InitialText0").Rect; | ||
RunningApp.Tap("PushPage"); | ||
CompareTextLocation(initialTextPosition, 1); | ||
RunningApp.Tap("PushPage"); | ||
CompareTextLocation(initialTextPosition, 2); | ||
RunningApp.Tap("PushPage"); | ||
CompareTextLocation(initialTextPosition, 3); | ||
RunningApp.Tap("PopPage"); | ||
CompareTextLocation(initialTextPosition, 2); | ||
RunningApp.Tap("PopPage"); | ||
CompareTextLocation(initialTextPosition, 1); | ||
|
||
} | ||
|
||
void CompareTextLocation(UITest.Queries.AppRect initialRect, int i) | ||
{ | ||
var newRect = RunningApp.WaitForFirstElement($"InitialText{i}").Rect; | ||
|
||
Assert.AreEqual(newRect.X, initialRect.X, $"Error With Test :{i}"); | ||
Assert.AreEqual(newRect.Y, initialRect.Y, $"Error With Test :{i}"); | ||
Assert.AreEqual(newRect.CenterX, initialRect.CenterX, $"Error With Test :{i}"); | ||
Assert.AreEqual(newRect.CenterY, initialRect.CenterY, $"Error With Test :{i}"); | ||
} | ||
#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
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,8 @@ | ||
using System; | ||
namespace Xamarin.Forms.Platform.iOS | ||
{ | ||
internal interface IDisconnectable | ||
{ | ||
void Disconnect(); | ||
} | ||
} |
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
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
Oops, something went wrong.