Remove Material Frame Renderer from Frame element on dispose of renderer (#7752) fixes #7339

* [iOS] remove renderer from Frame on dispose

* - add uitests
This commit is contained in:
Shane Neuville 2019-10-03 17:20:07 -06:00 коммит произвёл Rui Marinho
Родитель 9cf4ccdc6f
Коммит 0d092133e2
3 изменённых файлов: 66 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
#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, 7339, "[iOS] Material frame renderer not being cleared",
PlatformAffected.iOS)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Shell)]
#endif
public class Issue7339 : TestShell
{
protected override void Init()
{
Visual = VisualMarker.Material;
CreateContentPage("Item1").Content =
new StackLayout()
{
Children =
{
new Frame()
{
Content = new Label()
{
Text = "Navigate between flyout items a few times. If app doesn't crash then test has passed"
}
}
}
};
CreateContentPage("Item2").Content =
new StackLayout() { Children = { new Frame() } };
}
#if UITEST
[Test]
public void MaterialFrameDisposesCorrectly()
{
TapInFlyout("Item1");
TapInFlyout("Item2");
TapInFlyout("Item1");
TapInFlyout("Item2");
}
#endif
}
}

Просмотреть файл

@ -28,6 +28,7 @@
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)Issue6889.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue6945.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7313.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7556.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7329.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7290.cs" />
@ -58,6 +59,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Issue7338.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ScrollToGroup.cs" />
<Compile Include="$(MSBuildThisFileDirectory)NestedCollectionViews.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7339.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShellFlyoutBehavior.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Issue7128.cs" />
<Compile Include="$(MSBuildThisFileDirectory)ShellGestures.cs" />

Просмотреть файл

@ -100,13 +100,17 @@ namespace Xamarin.Forms.Material.iOS
if (_packager == null)
return;
SetElement(null);
_packager.Dispose();
_packager = null;
_tracker.Dispose();
_tracker = null;
if (Element != null)
{
Element.ClearValue(Platform.iOS.Platform.RendererProperty);
SetElement(null);
}
}
base.Dispose(disposing);