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

Commit

Permalink
Merge branch '5.0.0' into fix-2448
Browse files Browse the repository at this point in the history
  • Loading branch information
PureWeen authored Nov 18, 2020
2 parents c829f4d + 4e7e390 commit afc2e63
Show file tree
Hide file tree
Showing 42 changed files with 1,970 additions and 809 deletions.
39 changes: 35 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,46 @@ assignees: ''

- Version with issue:
- Last known good version:
- IDE:
- Platform Target Frameworks: <!-- All that apply -->
- iOS: <!-- The version of the iOS SDK you are compiling against, e.g. 11.1 -->
- Android: <!-- The version of the Android SDK you are compiling against, e.g. 7.1 -->
- UWP: <!-- The version of the UWP SDK you are compiling against, e.g. 16299 -->
- Android Support Library Version: <!-- if applicable -->
- Nuget Packages:
- Android Support Library / AndroidX Version: <!-- if applicable -->
- NuGet Packages:
- Affected Devices:

### Environment

<!--
1.
Visual Studio: Help > About Microsoft Visual Studio > Copy Info [button]
Visual Studio for Mac: Visual Studio > About Visual Studio > Show Details > Copy Information [button]
2. Paste into the code block below (between ```)
-->

```
```

### Build Logs

<!--
If your issue is related to a build error, be sure to attach build logs.
Binary logs are preferred instead of text logs. Please save and attach a .binlog if possible:
(https://docs.microsoft.com/en-us/visualstudio/msbuild/obtaining-build-logs-with-msbuild?view=vs-2019#save-a-binary-log)
Otherwise, a text log is still helpful:
1. Place cursor below this comment block.
2. Attach build log or link to gist (https://gist.github.com/) of the log.
3. Logs can be found in the Build Output tab of the Errors pad in Visual Studio
To get full build logs, set the log verbosity to diagnostic at the following locations:
- On Visual Studio for Mac: Preferences > Projects > Build
- On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run
On Visual Studio for Windows you also want to add `-v -v -v -v` to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting `Properties`.
-->


### Screenshots

<!-- If the issue is a visual issue, please include screenshots showing the problem if possible -->
Expand All @@ -44,4 +75,4 @@ assignees: ''

### Workaround

<!-- Did you find any workaround for this issue? This can unblock other people while waiting for this issue to be resolved -->
<!-- Did you find any workaround for this issue? This can unblock other people while waiting for this issue to be resolved -->
2 changes: 1 addition & 1 deletion UWP.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFrameworks>$(UwpMinTargetFrameworks)</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition=" '$(UwpMinTargetFrameworks)' == '' ">
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">uap10.0.14393;uap10.0.16299</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' == 'Windows_NT' ">uap10.0.16299</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netstandard2.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public string TimeString(String format, String time)
RunningApp.ClearText("settingTime");
RunningApp.EnterText("settingTime", time);
RunningApp.PressEnter();
var text = RunningApp.WaitForElement("timeClockOptions")[0].ReadText();
var text = RunningApp.ReadTimePicker("timeClockOptions");
return text;
}

Expand All @@ -49,20 +49,28 @@ public string DateString(String format, String date)
RunningApp.ClearText("settingDate");
RunningApp.EnterText("settingDate", date);
RunningApp.PressEnter();
var text = RunningApp.WaitForElement("dateCalendarOptions")[0].ReadText();
var text = RunningApp.ReadDatePicker("dateCalendarOptions");
return text;
}

[Test]
// Tests runs locally without issues but doesn't run successfully in a hosted agent yet
[Category(UITestCategories.UwpIgnore)]
public void TimePicker24H()
{
RunningApp.Tap(x => x.Marked("TimePicker"));
#if !__WINDOWS__
Assert.AreEqual("0.0.0 A", TimeString("H.m.s t", "0, 0"));
Assert.AreEqual("13:05 PM", TimeString("HH:mm tt", "13, 5"));
Assert.AreEqual("12 PM", TimeString("HH tt", "12, 0"));
Assert.AreEqual("5.", TimeString("H.", "5, 1"));
#else
Assert.AreEqual("23:00", TimeString("HH", "23, 0"));
Assert.AreEqual("11:00:PM", TimeString("hh", "23, 0"));
#endif
}

#if !__WINDOWS__
[Test]
public void TimePicker12H()
{
Expand All @@ -83,26 +91,45 @@ public void TimePickerOther()
Assert.AreEqual("QRSTUVWXYZ", TimeString("QRSTUVWXYZ", "23, 59"));
Assert.AreEqual("abceijklnopqruvwx", TimeString("abceijklnopqruvwx", "23, 59"));
}
#endif

[Test]
// Tests runs locally without issues but doesn't run successfully in a hosted agent yet
[Category(UITestCategories.UwpIgnore)]
public void DatePickerDMY()
{
RunningApp.Tap(x => x.Marked("DatePicker"));
#if !__WINDOWS__
Assert.AreEqual("31/1/99", DateString("d/M/y", "1999, 1, 31"));
Assert.AreEqual("02-29-00", DateString("MM-dd-yy", "2000, 2, 29"));
Assert.AreEqual("2010, Apr, Thu", DateString("yyy, MMM, ddd", "2010, 4, 15"));
Assert.AreEqual("August.Saturday.2015", DateString("MMMM.dddd.yyyy", "2015, 8, 1"));
#else
Assert.AreEqual("31,1,99", DateString("d/M/y", "1999, 1, 31"));
Assert.AreEqual("29,2,00", DateString("MM-dd-yy", "2000, 2, 29"));
Assert.AreEqual("Thu 15,Apr,2010", DateString("yyy, MMM, ddd", "2010, 4, 15"));
Assert.AreEqual("Saturday,August,2015", DateString("MMMM.dddd.yyyy", "2015, 8, 1"));
#endif
}

[Test]
// Tests runs locally without issues but doesn't run successfully in a hosted agent yet
[Category(UITestCategories.UwpIgnore)]
public void DatePickerMissing()
{
RunningApp.Tap(x => x.Marked("DatePicker"));
#if !__WINDOWS__
Assert.AreEqual("October 97", DateString("MMMM yy", "1997, 10, 30"));
Assert.AreEqual("Monday", DateString("dddd", "2020, 7, 20"));
Assert.AreEqual("2002: Dec", DateString("yyyy: MMM", "2002, 12, 31"));
#else
Assert.AreEqual("October,97", DateString("MMMM yy", "1997, 10, 30"));
Assert.AreEqual("Monday", DateString("dddd", "2020, 7, 20"));
Assert.AreEqual("Dec,2002", DateString("yyyy: MMM", "2002, 12, 31"));
#endif
}

#if !__WINDOWS__
[Test]
public void DatePickerLetters()
{
Expand All @@ -111,6 +138,7 @@ public void DatePickerLetters()
Assert.AreEqual("QRSTUVWXYZ", DateString("QRSTUVWXYZ", "2002, 12, 31"));
Assert.AreEqual("abceijklnopqruvwx", DateString("abceijklnopqruvwx", "2002, 12, 31"));
}
#endif

#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Xamarin.UITest;
using NUnit.Framework;
using Xamarin.UITest.Queries;
using System.Linq;
using Xamarin.Forms.Core.UITests;

namespace Xamarin.Forms.Controls.Issues
{
Expand Down Expand Up @@ -35,6 +37,39 @@ public static void AssertHasText(this AppResult result, string text)

Assert.Fail();
}

public static string[] GetTestCategories(Type testType)
{
var testClassName = TestContext.CurrentContext.Test.ClassName;

// TestContext.CurrentContext.Test.Properties["Category"]
// Only gives you the categories on the test itself
// There isn't a property I could find that gives you the Categories
// on the Test Class
return testType
.Assembly
.GetType(testClassName)
.GetCustomAttributes(typeof(NUnit.Framework.CategoryAttribute), true)
.OfType<NUnit.Framework.CategoryAttribute>()
.Select(x => x.Name)
.Union(TestContext.CurrentContext.Test.Properties["Category"].OfType<string>())
.ToArray();
}

public static void MarkTestInconclusiveIfNoInternetConnectionIsPresent(Type testType, IApp app)
{
if (GetTestCategories(testType).Contains(UITestCategories.RequiresInternetConnection))
{
var hasInternetAccess = $"{app.Invoke("hasInternetAccess")}";
bool checkInternet;

if (bool.TryParse(hasInternetAccess, out checkInternet))
{
if (!checkInternet)
Assert.Inconclusive("Device Has No Internet Connection");
}
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.CarouselView)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 12193, "[Bug] CarouselView content disappears after 2 rotations if TextType=Html is used",
PlatformAffected.iOS)]
public class Issue12193 : TestContentPage
{
public const string HTML = "HTML";

protected override void Init()
{
#if APP
Title = "CarouselView HTML Label";

var instructions = new Label { Text = $"Rotate the device, then rotate it back 3 times. If the label \"{HTML}\" disappears, this test has failed." };

var source = new List<string>();
for (int n = 0; n < 10; n++)
{
source.Add($"Item: {n}");
}

var template = new DataTemplate(() =>
{
var label = new Label
{
TextType = TextType.Html,
Text = $"<p style='background-color:red;'>{HTML}</p>",
AutomationId = HTML
};
return label;
});

var cv = new CarouselView()
{
ItemsSource = source,
ItemTemplate = template,
Loop = false
};

var layout = new StackLayout();

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

Content = layout;
#endif
}


#if UITEST
[Test]
public async Task RotatingCarouselViewHTMLShouldNotDisappear()
{
int delay = 3000;

RunningApp.SetOrientationPortrait();
await Task.Delay(delay);

RunningApp.SetOrientationLandscape();
await Task.Delay(delay);

RunningApp.SetOrientationPortrait();
await Task.Delay(delay);

RunningApp.SetOrientationLandscape();
await Task.Delay(delay);

RunningApp.SetOrientationPortrait();
await Task.Delay(delay);

RunningApp.WaitForElement(HTML);
}
#endif
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8" ?>
<controls:TestContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:controls="clr-namespace:Xamarin.Forms.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="Xamarin.Forms.Controls.Issues.Issue12374"
Title="Issue 12374">
<Grid RowDefinitions="Auto,Auto,*">
<Label
Grid.Row="0"
AutomationId = "TestReady"
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="Tap each item to remove them and view the EmptyView. Then, tap the AddItems button. Without crash, the test has passed."/>
<StackLayout
Grid.Row="1"
Orientation="Horizontal"
HorizontalOptions="Center"
Margin="20">
<Button
AutomationId="AddItems"
Text="Add Items"
Clicked="AddItemsButton_Clicked" />
<Button
AutomationId="RemoveItems"
Text="Remove Items"
Clicked="RemoveItemsButton_Clicked" />
</StackLayout>
<RefreshView
Grid.Row="2"
x:Name="MainRefreshView"
IsRefreshing="{Binding IsRefreshing}"
Command="{Binding RefreshCommand}">
<CollectionView
Grid.Row="1"
ItemsSource="{Binding Items}"
SelectionMode="Single"
SelectionChanged="CollectionView_SelectionChanged">
<CollectionView.EmptyView>
<Grid>
<Label
Text="Empty View"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
</CollectionView.EmptyView>
<!--
<CollectionView.EmptyViewTemplate>
<DataTemplate>
<Grid>
<Label Text="Empty Template View" HorizontalOptions="Center" VerticalOptions="Center" />
</Grid>
</DataTemplate>
</CollectionView.EmptyViewTemplate>
-->
<CollectionView.ItemTemplate>
<DataTemplate>
<!--
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Delete" BackgroundColor="Red" Invoked="Item_SwipeInvoked" />
</SwipeItems>
</SwipeView.RightItems>
<Grid HeightRequest="40" Padding="10" BackgroundColor="{Binding Color}">
<Label Text="{Binding Name}" VerticalOptions="Center" />
</Grid>
</SwipeView>
-->
<Grid
HeightRequest="40"
Padding="10"
BackgroundColor="{Binding Color}">
<Label
Text="{Binding Name}"
VerticalOptions="Center" />
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</RefreshView>
</Grid>
</controls:TestContentPage>
Loading

0 comments on commit afc2e63

Please sign in to comment.