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.8.0' into fix-11829
Browse files Browse the repository at this point in the history
  • Loading branch information
jsuarezruiz committed Aug 26, 2020
2 parents 2efee8c + 1eae946 commit 2363474
Show file tree
Hide file tree
Showing 41 changed files with 1,118 additions and 288 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestContentPage
xmlns:controls="clr-namespace:Xamarin.Forms.Controls"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Xamarin.Forms.Controls.Issues.Issue11653"
Title="Issue 11653">
<ContentPage.Content>
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White">
<Label.FormattedText>
<FormattedString>
<Span
Text="Without exceptions, the test has passed."/>
<Span
Text="NOTE: Nothing will render."/>
</FormattedString>
</Label.FormattedText>
</Label>
<Path Aspect="Uniform">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure
IsClosed="True"
StartPoint="10,100">
<PathFigure.Segments>
<PathSegmentCollection>
<PolyBezierSegment
Points="100, 100" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
</StackLayout>
</ContentPage.Content>
</controls:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Xamarin.Forms.Internals;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Shapes;
using System.Collections.Generic;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Shape)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 11653,
"[Bug] Polygon.Points doesn't respond to CollectionChanged events",
PlatformAffected.All)]
public partial class Issue11653 : TestContentPage
{
public Issue11653()
{
#if APP
Device.SetFlags(new List<string> { ExperimentalFlags.BrushExperimental, ExperimentalFlags.ShapesExperimental });
InitializeComponent();
#endif
}

protected override void Init()
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
using System;
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.Runtime.CompilerServices;
using System.Linq;


#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, 11723, "[Bug] ContentPage in NavigationStack misplaced initially",
PlatformAffected.iOS)]
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github10000)]
[NUnit.Framework.Category(UITestCategories.Shell)]
#endif
public class Issue11723 : TestShell
{
int labelIndex = 0;
ContentPage CreateContentPage()
{
var page = new ContentPage()
{
Content = new StackLayout()
{
Children =
{
new Label()
{
Text = "As you navigate this text should show up in the correct spot. If it's hidden and then shows up this test has failed.",
AutomationId = $"InitialText{labelIndex}"
},
new Button()
{
Text = "Push Page",
AutomationId = "PushPage",
Command = new Command(async () =>
{
labelIndex++;
await Navigation.PushAsync(CreateContentPage());
})
},
new Button()
{
Text = "Pop Page",
AutomationId = "PopPage",
Command = new Command(async () =>
{
labelIndex--;
await Navigation.PopAsync();
})
}
}
}
};

SetNavBarIsVisible(page, false);
PlatformConfiguration.iOSSpecific.Page.SetUseSafeArea(page, true);

return page;
}

protected override void Init()
{
AddContentPage(CreateContentPage());
}


#if UITEST
[Test]
public void PaddingIsSetOnPageBeforeItsVisible()
{
var initialTextPosition = RunningApp.WaitForFirstElement($"InitialText0").Rect;
RunningApp.Tap("PushPage");
CompareTextLocation(initialTextPosition, 1);
RunningApp.Tap("PushPage");
CompareTextLocation(initialTextPosition, 2);
RunningApp.Tap("PushPage");
CompareTextLocation(initialTextPosition, 3);
RunningApp.Tap("PopPage");
CompareTextLocation(initialTextPosition, 2);
RunningApp.Tap("PopPage");
CompareTextLocation(initialTextPosition, 1);

}

void CompareTextLocation(UITest.Queries.AppRect initialRect, int i)
{
var newRect = RunningApp.WaitForFirstElement($"InitialText{i}").Rect;

Assert.AreEqual(newRect.X, initialRect.X, $"Error With Test :{i}");
Assert.AreEqual(newRect.Y, initialRect.Y, $"Error With Test :{i}");
Assert.AreEqual(newRect.CenterX, initialRect.CenterX, $"Error With Test :{i}");
Assert.AreEqual(newRect.CenterY, initialRect.CenterY, $"Error With Test :{i}");
}
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using Xamarin.Forms.Internals;
using Xamarin.Forms.CustomAttributes;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.SearchBar)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 11865,
"iOS SearchBarRenderer throws a NullReferenceException when the SearchButton redirects to a new page",
PlatformAffected.iOS)]
public class Issue11865 : TestContentPage
{
public Issue11865()
{
}

protected override void Init()
{
Title = "Issue 11865";

var layout = new StackLayout
{
BackgroundColor = Color.LightGreen
};

var instructions = new Label
{
Padding = 12,
BackgroundColor = Color.Black,
TextColor = Color.White,
Text = "Type something in the SearchBar and tap the search button."
};

var searchBar = new SearchBar();

layout.Children.Add(instructions);
layout.Children.Add(searchBar);

Content = layout;

searchBar.SearchButtonPressed += (sender, args) =>
{
Application.Current.MainPage = new Issue11865SecondPage();
};
}
}

[Preserve(AllMembers = true)]
public class Issue11865SecondPage : ContentPage
{
public Issue11865SecondPage()
{
var layout = new StackLayout
{
BackgroundColor = Color.LightCoral
};

var instructions = new Label
{
Padding = 12,
BackgroundColor = Color.Black,
TextColor = Color.White,
Text = "If you can read this message (after changing the MainPage), the test has passed.",
Margin = new Thickness(0, 36, 0, 0)
};

layout.Children.Add(instructions);

Content = layout;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
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, 11869, "[Bug] ShellContent.IsVisible issue on Android",
PlatformAffected.Android)]
#if UITEST
[NUnit.Framework.Category(Core.UITests.UITestCategories.Github10000)]
[NUnit.Framework.Category(UITestCategories.Shell)]
#endif
public class Issue11869 : TestShell
{
protected override void Init()
{
ContentPage contentPage = new ContentPage();
var tabbar = AddContentPage<TabBar, Tab>(contentPage, title: "Tab 1");
AddBottomTab("Tab 2");
AddBottomTab("Tab 3");
AddTopTab("TopTab2");
AddTopTab("TopTab3");

contentPage.Content =
new StackLayout()
{
Children =
{
new Button
{
Text = "Hide Bottom Tab 2",
Command = new Command(() =>
{
Items[0].Items[1].Items[0].IsVisible = false;
}),
AutomationId = "HideBottom2"
},
new Button
{
Text = "Hide Bottom Tab 3",
Command = new Command(() =>
{
Items[0].Items[2].Items[0].IsVisible = false;
}),
AutomationId = "HideBottom3"
},
new Button
{
Text = "Hide Top Tab 2",
Command = new Command(() =>
{
Items[0].Items[0].Items[1].IsVisible = false;
}),
AutomationId = "HideTop2"
},
new Button
{
Text = "Hide Top Tab 3",
Command = new Command(() =>
{
Items[0].Items[0].Items[2].IsVisible = false;
}),
AutomationId = "HideTop3"
},
new Button
{
Text = "Show All Tabs",
Command = new Command(() =>
{
Items[0].Items[1].Items[0].IsVisible = true;
Items[0].Items[2].Items[0].IsVisible = true;
Items[0].Items[0].Items[1].IsVisible = true;
Items[0].Items[0].Items[2].IsVisible = true;
}),
AutomationId = "ShowAllTabs"
}
}
};
}


#if UITEST && __SHELL__
[Test]
public void IsVisibleWorksForShowingHidingTabs()
{
RunningApp.WaitForElement("TopTab2");
RunningApp.Tap("HideTop2");
RunningApp.WaitForNoElement("TopTab2");

RunningApp.WaitForElement("TopTab3");
RunningApp.Tap("HideTop3");
RunningApp.WaitForNoElement("TopTab3");

RunningApp.WaitForElement("Tab 2");
RunningApp.Tap("HideBottom2");
RunningApp.WaitForNoElement("Tab 2");

RunningApp.WaitForElement("Tab 3");
RunningApp.Tap("HideBottom3");
RunningApp.WaitForNoElement("Tab 3");

RunningApp.Tap("ShowAllTabs");
RunningApp.WaitForElement("TopTab2");
RunningApp.WaitForElement("TopTab3");
RunningApp.WaitForElement("Tab 2");
RunningApp.WaitForElement("Tab 3");
}
#endif
}
}

0 comments on commit 2363474

Please sign in to comment.