Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge branch '4.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rmarinho committed Oct 29, 2019
2 parents 80bb211 + d4cb7ec commit 4fe1dab
Show file tree
Hide file tree
Showing 19 changed files with 607 additions and 73 deletions.
6 changes: 3 additions & 3 deletions Xamarin.Forms.Build.Tasks/SetPropertiesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,15 +500,15 @@ static IList<(PropertyDefinition property, TypeReference propDeclTypeRef, string
if (int.TryParse(indexArg, out _))
indexer = previousPartTypeRef.GetProperty(pd => pd.Name == indexerName
&& pd.GetMethod != null
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType, module.ImportReference(("mscorlib", "System", "Int32")))
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(("mscorlib", "System", "Int32")))
&& pd.GetMethod.IsPublic, out indexerDeclTypeRef);
indexer = indexer ?? previousPartTypeRef.GetProperty(pd => pd.Name == indexerName
&& pd.GetMethod != null
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType, module.ImportReference(("mscorlib", "System", "String")))
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(("mscorlib", "System", "String")))
&& pd.GetMethod.IsPublic, out indexerDeclTypeRef);
indexer = indexer ?? previousPartTypeRef.GetProperty(pd => pd.Name == indexerName
&& pd.GetMethod != null
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType, module.ImportReference(("mscorlib", "System", "String")))
&& TypeRefComparer.Default.Equals(pd.GetMethod.Parameters[0].ParameterType.ResolveGenericParameters(previousPartTypeRef), module.ImportReference(("mscorlib", "System", "Object")))
&& pd.GetMethod.IsPublic, out indexerDeclTypeRef);

properties.Add((indexer, indexerDeclTypeRef, indexArg));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ public class DetailsPage : ContentPage
public DetailsPage(MasterDetailPage masterDetailPage)
{
MDP = masterDetailPage;
lblThings = new Label();
lblThings = new Label() { HorizontalTextAlignment = TextAlignment.Center, AutomationId = "CurrentMasterBehavior" };

Content = new StackLayout()
{
Children =
Expand All @@ -58,7 +59,8 @@ public DetailsPage(MasterDetailPage masterDetailPage)
new Button()
{
Text = "Click to rotate through MasterBehavior settings and test each one",
Command = new Command(OnChangeMasterBehavior)
Command = new Command(OnChangeMasterBehavior),
AutomationId = "ChangeMasterBehavior"
},
new Button()
{
Expand All @@ -75,7 +77,8 @@ public DetailsPage(MasterDetailPage masterDetailPage)
}
});
})
}
},
new Label(){ HorizontalTextAlignment = TextAlignment.Center, Text = "Close Master" }
}
};

Expand Down Expand Up @@ -113,6 +116,39 @@ public void MasterStillVisibleAfterPushingAndPoppingModalPage()
RunningApp.WaitForElement("Master Visible");
}

[Test]
public void SplitOnLandscapeFailsToDetectClose()
{
if (!RunningApp.IsTablet())
return;

while(RunningApp.WaitForElement("CurrentMasterBehavior")[0].ReadText() != MasterBehavior.SplitOnLandscape.ToString())
{
RunningApp.Tap("ChangeMasterBehavior");

if(RunningApp.Query("Master Visible").Length > 0)
RunningApp.Tap("Close Master");
}

RunningApp.Tap("Master");
RunningApp.WaitForElement("Master Visible");
RunningApp.Tap("Close Master");

RunningApp.SetOrientationLandscape();
RunningApp.SetOrientationPortrait();
RunningApp.SetOrientationLandscape();
RunningApp.SetOrientationPortrait();

if (RunningApp.Query("Master Visible").Length > 0)
RunningApp.Tap("Close Master");

RunningApp.Tap("Master");
RunningApp.WaitForElement("Master Visible");
RunningApp.Tap("Close Master");
RunningApp.Tap("Master");
RunningApp.WaitForElement("Master Visible");
}

[TearDown]
public override void TearDown()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Controls;

#if UITEST
using Xamarin.Forms.Core.UITests;
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Shell)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 8145, "Shell System.ObjectDisposedException: 'Cannot access a disposed object. Object name: 'Android.Support.Design.Widget.BottomSheetDialog'.'", PlatformAffected.Android)]
public class Issue8145 : TestShell
{
string _titleElement = "Connect";
protected override void Init()
{
Title = "Shell";
Items.Add(new FlyoutItem
{
Title = _titleElement,
Items = {
new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},new Tab {
Title = "notme",
Items = {
new ContentPage { Title = "notme", Content = new Label { Text = "Click More, then choose the target. If it does not crash, this test has passed." } }
}
},
new Tab {
Title = "target",
Items = {
new ContentPage { Title = "Target", Content = new Label { Text = "Success" } }
}
}
}
});
}

#if UITEST
#if !(__ANDROID__ || __IOS__)
[Ignore("Shell test is only supported on Android and iOS")]
#endif
[Test]
public void Issue8145ShellToolbarDisposedException()
{
RunningApp.WaitForElement("More");
RunningApp.Tap("More");
RunningApp.WaitForElement("target");
RunningApp.Tap("target");
RunningApp.WaitForElement("Success");
}
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
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, 8186, "[UWP] Setting IsRefreshing from OnAppearing on RefreshView crashes UWP",
PlatformAffected.UWP)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.RefreshView)]
#endif
public class Issue8186 : TestNavigationPage
{
RefreshView _refreshView;
protected override void Init()
{
_refreshView = new RefreshView()
{
Content = new ScrollView()
{
Content = new StackLayout()
{
Children =
{
new Label()
{
Text = "If you are reading this and see a refresh circle test has succeeded",
AutomationId = "Success"
},
new Button()
{
Text = "Push Page then return to this page.",
Command = new Command(() =>
{
Navigation.PushAsync(new ContentPage()
{
Content = new Button()
{
Text = "Pop Page",
AutomationId = "PopPage",
Command = new Command(()=> Navigation.PopAsync())
}
});
}),
AutomationId = "PushPage"
}
}
}
}
};

var page = new ContentPage() { Content = _refreshView };
page.Appearing += (_, __) => _refreshView.IsRefreshing = true;
page.Disappearing += (_, __) => _refreshView.IsRefreshing = false;
PushAsync(page);
}

#if UITEST
[Test]
public void SetIsRefreshingToTrueInOnAppearingDoesntCrash()
{
RunningApp.WaitForElement("Success");
RunningApp.Tap("PushPage");
RunningApp.Tap("PopPage");
RunningApp.WaitForElement("Success");
}
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using System.Linq;


#if UITEST
using Xamarin.Forms.Core.UITests;
#endif

namespace Xamarin.Forms.Controls.Issues
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.None, 0, "Shell AppearanceChange",
PlatformAffected.All)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Shell)]
[NUnit.Framework.Category(UITestCategories.ManualReview)]
#endif
public class ShellAppearanceChangeTests : TestShell
{
protected override void Init()
{
AddContentPage(GetContentPage(Color.Red));
}

ContentPage GetContentPage(Color color)
{
var stackLayout = new StackLayout()
{
Children =
{
new Label() { Text = $"I should have a {color} background"},
new Button()
{
Text = "Push Purple Page",
Command = new Command(() =>
{
var contentPage = GetContentPage(Color.Purple);
Navigation.PushAsync(contentPage);
}),
},
}
};

if (Navigation?.NavigationStack != null)
{
stackLayout.Children.Add(new Button()
{
Text = "Insert Orange Page Before Current Page",
Command = new Command(() =>
{
var contentPage = GetContentPage(Color.Orange);
Navigation.InsertPageBefore(contentPage, Navigation.NavigationStack.Last());
}),
});

stackLayout.Children.Add(new Button()
{
Text = "Pop Page",
Command = new Command(() =>
{
Navigation.PopAsync();
}),
});

stackLayout.Children.Add(new Button()
{
Text = "Remove Current Page",
Command = new Command(() =>
{
Navigation.RemovePage(Navigation.NavigationStack.Last());
}),
});

stackLayout.Children.Add(new Button()
{
Text = "Pop To Root",
Command = new Command(() =>
{
Navigation.PopToRootAsync();
}),
});
}

var page = new ContentPage()
{
Title = color.ToString(),
Content = stackLayout
};

Shell.SetBackgroundColor(page, color);
return page;
}
}
}

0 comments on commit 4fe1dab

Please sign in to comment.