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.
# Conflicts: # Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
- Loading branch information
Showing
33 changed files
with
798 additions
and
35 deletions.
There are no files selected for viewing
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
106 changes: 106 additions & 0 deletions
106
Xamarin.Forms.ControlGallery.Android/Issue10182Activity.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,106 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Android.App; | ||
using Android.Content; | ||
using Android.Content.PM; | ||
using Android.OS; | ||
using Android.Renderscripts; | ||
using Android.Runtime; | ||
using Android.Views; | ||
using Android.Widget; | ||
using Xamarin.Forms.Controls.Issues; | ||
|
||
namespace Xamarin.Forms.ControlGallery.Android | ||
{ | ||
[Activity(Label = "Issue10182Activity", Icon = "@drawable/icon", Theme = "@style/MyTheme", | ||
MainLauncher = false, HardwareAccelerated = true, | ||
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.UiMode)] | ||
public class Issue10182Activity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity | ||
{ | ||
Activity1 _activity1; | ||
protected override void OnCreate(Bundle savedInstanceState) | ||
{ | ||
var currentApplication = Xamarin.Forms.Application.Current; | ||
TabLayoutResource = Resource.Layout.Tabbar; | ||
ToolbarResource = Resource.Layout.Toolbar; | ||
|
||
base.OnCreate(savedInstanceState); | ||
|
||
global::Xamarin.Forms.Forms.Init(this, savedInstanceState); | ||
LoadApplication(new Issue10182Application()); | ||
|
||
_activity1 = (Activity1)DependencyService.Resolve<Context>(); | ||
|
||
Device.BeginInvokeOnMainThread(async () => | ||
{ | ||
try | ||
{ | ||
|
||
await Task.Delay(1000); | ||
{ | ||
Intent intent = new Intent(_activity1, typeof(Activity1)); | ||
intent.AddFlags(ActivityFlags.ReorderToFront); | ||
_activity1.StartActivity(intent); | ||
} | ||
|
||
await Task.Delay(1000); | ||
{ | ||
Intent intent = new Intent(this, typeof(Issue10182Activity)); | ||
intent.AddFlags(ActivityFlags.ReorderToFront); | ||
StartActivity(intent); | ||
} | ||
|
||
await Task.Delay(1000); | ||
{ | ||
Intent intent = new Intent(_activity1, typeof(Activity1)); | ||
intent.AddFlags(ActivityFlags.ReorderToFront); | ||
_activity1.StartActivity(intent); | ||
} | ||
} | ||
finally | ||
{ | ||
this.Finish(); | ||
_activity1.ReloadApplication(); | ||
currentApplication.MainPage = new Issue10182.Issue10182SuccessPage(); | ||
} | ||
}); | ||
} | ||
|
||
public class Issue10182Test : ContentPage | ||
{ | ||
public Issue10182Test() | ||
{ | ||
Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = "Hold Please. Activity should vanish soon and you'll see a success label", | ||
AutomationId = "Loaded" | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
|
||
public class Issue10182Application : Application | ||
{ | ||
protected override void OnStart() | ||
{ | ||
var contentPage = new Issue10182Test(); | ||
base.OnStart(); | ||
MainPage = contentPage; | ||
} | ||
|
||
protected override void OnSleep() | ||
{ | ||
base.OnSleep(); | ||
MainPage = new NavigationPage(new ContentPage()); | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Xamarin.Forms.ControlGallery.Android/MultiWindowService.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,23 @@ | ||
#if !FORMS_APPLICATION_ACTIVITY && !PRE_APPLICATION_CLASS | ||
|
||
using Android.Content; | ||
using Xamarin.Forms.Controls.Issues; | ||
using System; | ||
|
||
namespace Xamarin.Forms.ControlGallery.Android | ||
{ | ||
public class MultiWindowService : IMultiWindowService | ||
{ | ||
public void OpenWindow(Type type) | ||
{ | ||
if (type == typeof(Issue10182)) | ||
{ | ||
var context = DependencyService.Resolve<Context>(); | ||
Intent intent = new Intent(context, typeof(Issue10182Activity)); | ||
context.StartActivity(intent); | ||
} | ||
} | ||
} | ||
} | ||
|
||
#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
79 changes: 79 additions & 0 deletions
79
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10182.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,79 @@ | ||
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.Threading; | ||
|
||
|
||
#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, 10182, "[Bug] Exception Ancestor must be provided for all pushes except first", PlatformAffected.Android, NavigationBehavior.SetApplicationRoot)] | ||
#if UITEST | ||
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github10000)] | ||
[NUnit.Framework.Category(UITestCategories.LifeCycle)] | ||
#endif | ||
public class Issue10182 : TestContentPage | ||
{ | ||
public Issue10182() | ||
{ | ||
|
||
} | ||
|
||
protected override void Init() | ||
{ | ||
Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = "Starting Activity to Test Changing Page on Resume. If success label shows up test has passed." | ||
} | ||
} | ||
}; | ||
|
||
#if !UITEST | ||
Device.BeginInvokeOnMainThread(() => | ||
{ | ||
DependencyService.Get<IMultiWindowService>().OpenWindow(this.GetType()); | ||
}); | ||
#endif | ||
|
||
} | ||
|
||
public class Issue10182SuccessPage : ContentPage | ||
{ | ||
public Issue10182SuccessPage() | ||
{ | ||
Content = new StackLayout() | ||
{ | ||
Children = | ||
{ | ||
new Label() | ||
{ | ||
Text = "Success.", | ||
AutomationId = "Success" | ||
} | ||
} | ||
}; | ||
} | ||
} | ||
|
||
#if UITEST && __ANDROID__ | ||
[Test] | ||
public void AppDoesntCrashWhenResettingPage() | ||
{ | ||
RunningApp.WaitForElement("Success"); | ||
} | ||
#endif | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue10324.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,54 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 10324, "Unable to intercept or disable mouse back button navigation on UWP", PlatformAffected.UWP)] | ||
public class Issue10324 : TestNavigationPage | ||
{ | ||
protected override void Init() | ||
{ | ||
Navigation.PushAsync(new IssueFirstPage()); | ||
} | ||
|
||
class IssueFirstPage : ContentPage | ||
{ | ||
public IssueFirstPage() | ||
{ | ||
Navigation.PushAsync(new IssueTestAlertPage()); | ||
} | ||
} | ||
|
||
class IssueTestAlertPage : ContentPage | ||
{ | ||
public IssueTestAlertPage() | ||
{ | ||
Title = "Hit Mouse BackButton/XButton1. An alert will appear (OnBackButtonPressed overridden)"; | ||
Content = new StackLayout(); | ||
|
||
Navigation.PushAsync(new IssueTestBackPage()); | ||
} | ||
|
||
protected override bool OnBackButtonPressed() | ||
{ | ||
DisplayAlert("OnBackButtonPressed", "OnBackButtonPressed", "OK"); | ||
return true; | ||
} | ||
} | ||
|
||
class IssueTestBackPage : ContentPage | ||
{ | ||
public IssueTestBackPage() | ||
{ | ||
Title = "Hit Mouse BackButton/XButton1. Page will go back (OnBackButtonPressed not overridden)"; | ||
Content = new StackLayout(); | ||
} | ||
|
||
protected override bool OnBackButtonPressed() | ||
{ | ||
return base.OnBackButtonPressed(); | ||
} | ||
} | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11106.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,58 @@ | ||
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 | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.ScrollView)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11106, | ||
"[Bug] ScrollView UWP bug in 4.7.0.968!", | ||
PlatformAffected.UWP)] | ||
public class Issue11106 : TestContentPage | ||
{ | ||
protected override void Init() | ||
{ | ||
Title = "Issue 11106"; | ||
|
||
var grid = new Grid(); | ||
|
||
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); | ||
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "Scroll to the end and try to set focus to the last Entry. If you can tap the Entry and set the focus, the test has passed." | ||
}; | ||
|
||
var scroll = new ScrollView(); | ||
|
||
var layout = new StackLayout(); | ||
|
||
for (int i = 0; i < 30; i++) | ||
{ | ||
layout.Children.Add(new Entry()); | ||
} | ||
|
||
scroll.Content = layout; | ||
|
||
grid.Children.Add(instructions); | ||
Grid.SetRow(instructions, 0); | ||
|
||
grid.Children.Add(scroll); | ||
Grid.SetRow(scroll, 1); | ||
|
||
Content = grid; | ||
} | ||
} | ||
} |
Oops, something went wrong.