зеркало из https://github.com/DeGsoft/maui-linux.git
Adds a null check for Xamarin.Forms.Platform.Android.PageRenderer.Xamarin.Forms.Platform.Android.IOrderedTraversalController.UpdateTraversalOrder (#7050)
* Fixes #7049 * Test? * Tap View please * Spacing * Address comments * Excuse me, semicolons * Remove private
This commit is contained in:
Родитель
7e9c60edad
Коммит
f4ef490fac
|
@ -0,0 +1,58 @@
|
|||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
#if UITEST
|
||||
using NUnit.Framework;
|
||||
using Xamarin.UITest;
|
||||
#endif
|
||||
|
||||
namespace Xamarin.Forms.Controls.Issues
|
||||
{
|
||||
[Preserve (AllMembers=true)]
|
||||
[Issue (IssueTracker.Github, 7049, "Null reference exception on some Android devices - Xamarin.Forms.Platform.Android.PageRenderer.Xamarin.Forms.Platform.Android.IOrderedTraversalController.UpdateTraversalOrder", PlatformAffected.Android)]
|
||||
public class Issue7049 : TestContentPage
|
||||
{
|
||||
const string ContinueButton = "ContinueButton";
|
||||
const string View1 = "View1";
|
||||
const string View2 = "View2";
|
||||
const string View3 = "View3";
|
||||
|
||||
bool _flag = true;
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
|
||||
var button = new Button { AutomationId = ContinueButton, Text = "Continue" };
|
||||
button.Clicked += (_, __) =>
|
||||
{
|
||||
var view = _flag ?
|
||||
(View)new Entry { AutomationId = View2, Text = "Press 1 time to crash" } :
|
||||
new Label { AutomationId = View3, Text = "I'm shown, bug fixed!" };
|
||||
_flag ^= true;
|
||||
(Content as StackLayout).Children[1] = view;
|
||||
};
|
||||
Content = new StackLayout
|
||||
{
|
||||
Children =
|
||||
{
|
||||
button,
|
||||
new Label { AutomationId = View1, Text = "Press 2 times to crash" }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#if UITEST && __ANDROID__
|
||||
[Test]
|
||||
[Description ("Test null reference in IOrderedTraversalController.UpdateTraversalOrder of Android PageRenderer")]
|
||||
public void Issue7049TestsNullRefInUpdateTraversalOrder()
|
||||
{
|
||||
RunningApp.WaitForElement(View1);
|
||||
RunningApp.Tap(ContinueButton);
|
||||
RunningApp.WaitForElement(View2);
|
||||
RunningApp.Tap(ContinueButton);
|
||||
RunningApp.WaitForElement(View3);
|
||||
RunningApp.Tap(ContinueButton);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -22,6 +22,7 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)Issue6644.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Issue7049.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellGestures.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ShellInsets.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)CollectionViewGrouping.cs" />
|
||||
|
|
|
@ -187,7 +187,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
!(
|
||||
child is VisualElement ve && ve.IsTabStop
|
||||
&& AutomationProperties.GetIsInAccessibleTree(ve) != false // accessible == true
|
||||
&& ve.GetRenderer().View is ITabStop tabStop)
|
||||
&& ve.GetRenderer()?.View is ITabStop tabStop)
|
||||
)
|
||||
continue;
|
||||
|
||||
|
@ -218,4 +218,4 @@ namespace Xamarin.Forms.Platform.Android
|
|||
OrderedTraversalController.UpdateTraversalOrder();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче