зеркало из https://github.com/DeGsoft/maui-linux.git
Fix failing UI tests for Android FormsApplicationActivity (#1141)
* Fix broken test for 57910 when using FormsApplicationActivity * Fix NRE when removing a page during OnAppearing using FormsApplicationActivity * Update 45926 test to work correctly with FormsApplicationActivity * Update 32830 test so it doesn't crash on FormsApplicationActivity * Longer wait before refreshing appearing messages (to work with FormsApplicationActivity) * Fix input transparency issue with old FrameRenderer * Remove extraneous using directive * Just ignore test 32830 on FormsApplicationActivity * [Controls] Add missing directive
This commit is contained in:
Родитель
a0252e5833
Коммит
813b953360
|
@ -533,15 +533,27 @@ namespace Xamarin.Forms.ControlGallery.Android
|
|||
// }
|
||||
// }
|
||||
|
||||
public class NoFlashTestNavigationPage : Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
|
||||
public class NoFlashTestNavigationPage
|
||||
#if FORMS_APPLICATION_ACTIVITY
|
||||
: Xamarin.Forms.Platform.Android.NavigationRenderer
|
||||
#else
|
||||
: Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
|
||||
#endif
|
||||
{
|
||||
#if !FORMS_APPLICATION_ACTIVITY
|
||||
protected override void SetupPageTransition(global::Android.Support.V4.App.FragmentTransaction transaction, bool isPush)
|
||||
{
|
||||
transaction.SetTransition((int)FragmentTransit.None);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public class QuickCollectNavigationPage : Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
|
||||
public class QuickCollectNavigationPage
|
||||
#if FORMS_APPLICATION_ACTIVITY
|
||||
: Xamarin.Forms.Platform.Android.NavigationRenderer
|
||||
#else
|
||||
: Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer
|
||||
#endif
|
||||
{
|
||||
bool _disposed;
|
||||
NavigationPage _page;
|
||||
|
|
|
@ -133,6 +133,8 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
[Test]
|
||||
public void Bugzilla32830Test()
|
||||
{
|
||||
IgnoreFormsApplicationActivity();
|
||||
|
||||
RunningApp.WaitForElement(q => q.Marked(BottomLabel));
|
||||
RunningApp.WaitForElement(q => q.Marked(Button1));
|
||||
RunningApp.Tap(q => q.Marked(Button1));
|
||||
|
@ -140,6 +142,16 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
RunningApp.Tap(q => q.Marked(Button2));
|
||||
RunningApp.WaitForElement(q => q.Marked(BottomLabel));
|
||||
}
|
||||
|
||||
static void IgnoreFormsApplicationActivity()
|
||||
{
|
||||
#if __ANDROID__
|
||||
if (AppSetup.IsFormsApplicationActivity)
|
||||
{
|
||||
Assert.Ignore("This test only applies to FormsAppCompatActivity.");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Xamarin.Forms.CustomAttributes;
|
||||
using Xamarin.Forms.Internals;
|
||||
|
||||
|
@ -66,9 +67,12 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
RunningApp.WaitForElement (q => q.Marked ("New Page"));
|
||||
|
||||
RunningApp.Tap (q => q.Marked ("New Page"));
|
||||
RunningApp.WaitForElement (q => q.Marked ("Second Page #1"));
|
||||
RunningApp.Back();
|
||||
RunningApp.WaitForElement (q => q.Marked ("Intermediate Page"));
|
||||
RunningApp.Back();
|
||||
RunningApp.Tap(q => q.Marked("Do GC"));
|
||||
RunningApp.Tap(q => q.Marked("Do GC"));
|
||||
RunningApp.Tap(q => q.Marked("Send Message"));
|
||||
RunningApp.Tap(q => q.Marked("Do GC"));
|
||||
|
||||
|
@ -81,6 +85,10 @@ namespace Xamarin.Forms.Controls.Issues
|
|||
[Preserve(AllMembers = true)]
|
||||
public class _45926IntermediatePage : ContentPage
|
||||
{
|
||||
public _45926IntermediatePage()
|
||||
{
|
||||
Content = new Label { Text = "Intermediate Page" };
|
||||
}
|
||||
}
|
||||
|
||||
[Preserve(AllMembers = true)]
|
||||
|
|
|
@ -109,7 +109,8 @@ namespace Xamarin.Forms.Controls
|
|||
protected override void OnAppearing ()
|
||||
{
|
||||
base.OnAppearing ();
|
||||
Device.StartTimer (new TimeSpan (200), () => {
|
||||
|
||||
Device.StartTimer (TimeSpan.FromMilliseconds(750), () => {
|
||||
_listMessages.ItemsSource = App.AppearingMessages;
|
||||
return false;
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System.ComponentModel;
|
||||
using Android.Graphics;
|
||||
using Android.Graphics.Drawables;
|
||||
using Android.Views;
|
||||
using AButton = Android.Widget.Button;
|
||||
using ACanvas = Android.Graphics.Canvas;
|
||||
using GlobalResource = Android.Resource;
|
||||
|
@ -10,6 +11,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
public class FrameRenderer : VisualElementRenderer<Frame>
|
||||
{
|
||||
bool _disposed;
|
||||
readonly MotionEventHelper _motionEventHelper = new MotionEventHelper();
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
|
@ -22,6 +24,14 @@ namespace Xamarin.Forms.Platform.Android
|
|||
}
|
||||
}
|
||||
|
||||
public override bool OnTouchEvent(MotionEvent e)
|
||||
{
|
||||
if (base.OnTouchEvent(e))
|
||||
return true;
|
||||
|
||||
return _motionEventHelper.HandleMotionEvent(Parent, e);
|
||||
}
|
||||
|
||||
protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
|
||||
{
|
||||
base.OnElementChanged(e);
|
||||
|
@ -30,6 +40,7 @@ namespace Xamarin.Forms.Platform.Android
|
|||
{
|
||||
UpdateBackground();
|
||||
UpdateCornerRadius();
|
||||
_motionEventHelper.UpdateElement(e.NewElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,10 @@ namespace Xamarin.Forms.Platform.Android
|
|||
}
|
||||
s_currentAnimation = null;
|
||||
tcs.TrySetResult(true);
|
||||
((Platform)Element.Platform).NavAnimationInProgress = false;
|
||||
if (Element?.Platform != null)
|
||||
{
|
||||
((Platform)Element.Platform).NavAnimationInProgress = false;
|
||||
}
|
||||
} });
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче