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

Commit

Permalink
Shapes on iOS fail to render if the bounds of the view is set prior t…
Browse files Browse the repository at this point in the history
…o renderer creation (#13284) fixes #12245 fixes #13225 fixes #12911 fixes #13096 fixes #13164 fixes #11924 fixes #11656 fixes #12844 fixes #12521 fixes #13407

* UI Test

* Render Shape if it has an initial size already set

* - fix ui tests

* Unified issues with the same fix.

Co-authored-by: Javier Suárez Ruiz <javiersuarezruiz@hotmail.com>
  • Loading branch information
PureWeen and jsuarezruiz committed Jan 15, 2021
1 parent 4438439 commit 26a9f00
Show file tree
Hide file tree
Showing 25 changed files with 610 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Shapes;
using System.Collections.Generic;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Shape)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 11924, "[Bug] Shapes not loading in Xamarin ShellContent Tab once it is navigated back from other Tab",
PlatformAffected.All)]
public class Issue11924 : TestShell
{
const string Test1 = "Test 1";
const string Test2 = "Test 2";

public Issue11924()
{

}

protected override void Init()
{
AddBottomTab(CreatePage1(Test1), Test1);
AddBottomTab(CreatePage2(Test2), Test2);

static ContentPage CreatePage1(string title)
{
var layout = new StackLayout();

var instructions = new Label
{
Padding = 12,
BackgroundColor = Color.Black,
TextColor = Color.White,
Text = "Navigate to the second Tab"
};

var ellipse = new Ellipse
{
HorizontalOptions = LayoutOptions.Start,
HeightRequest = 50,
WidthRequest = 100,
Fill = Brush.Red
};

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

return new ContentPage
{
Title = title,
Content = layout
};
}

static ContentPage CreatePage2(string title)
{
var layout = new StackLayout();

var instructions = new Label
{
Padding = 12,
BackgroundColor = Color.Black,
TextColor = Color.White,
Text = "Navigate back to the first tab, and verify if the Ellipse is rendering or not."
};

layout.Children.Add(instructions);

return new ContentPage
{
Title = title,
Content = layout
};
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?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"
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.Issue12521"
Title="Issue 12521">
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="Scroll the list up and down. If the shapes not disappear, the test has passed."/>
<ListView
SelectionMode="None"
SeparatorColor="Transparent"
BackgroundColor="Transparent"
HasUnevenRows="True">
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>1</x:String>
<x:String>2</x:String>
<x:String>3</x:String>
<x:String>4</x:String>
<x:String>5</x:String>
<x:String>6</x:String>
<x:String>7</x:String>
<x:String>8</x:String>
<x:String>9</x:String>
<x:String>10</x:String>
<x:String>11</x:String>
<x:String>12</x:String>
<x:String>13</x:String>
<x:String>14</x:String>
<x:String>15</x:String>
<x:String>16</x:String>
<x:String>17</x:String>
<x:String>18</x:String>
<x:String>19</x:String>
<x:String>20</x:String>
</x:Array>
</ListView.ItemsSource>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<!-- Bug -->
<Frame>
<Path
Aspect="Uniform"
Data="M79.832501,980.76073L94.683501,965.90873 102.8065,974.03373 106.00049,946.36273 78.328501,949.55573 86.453501,957.67873 71.600501,972.53073C54.154501,959.13273 28.988501,960.40073 13.021501,976.36773 -4.34050019999999,993.73073 -4.34050019999999,1021.9787 13.021501,1039.3407 30.382501,1056.7027 58.632501,1056.7027 75.994501,1039.3407 91.959501,1023.3737 93.230501,998.20573 79.832501,980.76073z M21.251501,1031.1087C8.42850079999999,1018.2867 8.42750079999999,997.42273 21.251501,984.59773 34.073501,971.77573 54.938501,971.77573 67.762501,984.59773 80.585501,997.42273 80.585501,1018.2867 67.762501,1031.1087 54.938501,1043.9317 34.074501,1043.9317 21.251501,1031.1087z"
Fill="Black"
HeightRequest="24"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="24" />
</Frame>
<!-- Non bug -->
<!--
<Grid>
<Path
Aspect="Uniform"
Data="M79.832501,980.76073L94.683501,965.90873 102.8065,974.03373 106.00049,946.36273 78.328501,949.55573 86.453501,957.67873 71.600501,972.53073C54.154501,959.13273 28.988501,960.40073 13.021501,976.36773 -4.34050019999999,993.73073 -4.34050019999999,1021.9787 13.021501,1039.3407 30.382501,1056.7027 58.632501,1056.7027 75.994501,1039.3407 91.959501,1023.3737 93.230501,998.20573 79.832501,980.76073z M21.251501,1031.1087C8.42850079999999,1018.2867 8.42750079999999,997.42273 21.251501,984.59773 34.073501,971.77573 54.938501,971.77573 67.762501,984.59773 80.585501,997.42273 80.585501,1018.2867 67.762501,1031.1087 54.938501,1043.9317 34.074501,1043.9317 21.251501,1031.1087z"
Fill="Black"
HeightRequest="24"
HorizontalOptions="Start"
VerticalOptions="Start"
WidthRequest="24" />
</Grid>
-->
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</controls:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Xamarin.Forms.CustomAttributes;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Xaml;

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

namespace Xamarin.Forms.Controls.Issues
{
#if UITEST
[Category(UITestCategories.Shape)]
#endif
#if APP
[XamlCompilation(XamlCompilationOptions.Compile)]
#endif
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 12521, "[Bug][iOS] Shapes disappear in a Frame in a ListView when scrolled",
PlatformAffected.iOS)]
public partial class Issue12521 : TestContentPage
{
public Issue12521()
{
#if APP
InitializeComponent();
#endif
}

protected override void Init()
{

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8" ?>
<local:TestContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
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"
xmlns:local="using:Xamarin.Forms.Controls"
x:Class="Xamarin.Forms.Controls.Issues.Issue12911"
Title="Issue 12911">
<ScrollView>
<StackLayout>
<Label
Padding="12"
BackgroundColor="Black"
TextColor="White"
Text="Open the SwipeView, if can see the Red Shape, the test has passed."/>
<StackLayout
Padding="12">
<CollectionView x:Name="CollectionView">
<CollectionView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item 1</x:String>
<x:String>Item 2</x:String>
<x:String>Item 3</x:String>
</x:Array>
</CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate>
<StackLayout Spacing="0">
<SwipeView Padding="0">
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItemView>
<Grid
HeightRequest="60"
WidthRequest="100"
RowSpacing="0"
ColumnSpacing="0"
Padding="0"
Margin="0"
BackgroundColor="LightGray">
<StackLayout
Orientation="Horizontal"
Padding="0"
Margin="0"
Spacing="0">
<Label
Text="Left"
HorizontalOptions="Center"
VerticalOptions="Center" />
<Path
HorizontalOptions="EndAndExpand"
Fill="Red"
Stroke="Red"
Aspect="Fill"
Data="m0.19956,-0.20844l14.43749,0l0,0c7.97347,0 14.43748,6.51981 14.43748,14.56254c0,8.04265 -6.464,14.5625 -14.43748,14.5625l-14.43749,0l0,-29.12504z" >
<Path.RenderTransform>
<RotateTransform
CenterX="14.637"
CenterY="14.3541"
Angle="180" />
</Path.RenderTransform>
</Path>
</StackLayout>
</Grid>
</SwipeItemView>
</SwipeItems>
</SwipeView.LeftItems>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItemView>
<Grid
HeightRequest="60"
WidthRequest="100"
RowSpacing="0"
ColumnSpacing="0"
BackgroundColor="LightGray">
<StackLayout
Orientation="Horizontal">
<Path
Fill="Red"
Stroke="Red"
Aspect="Fill"
Data="m-0.05044,-0.08344l14.43749,0l0,0c7.97347,0 14.43748,6.51981 14.43748,14.56254c0,8.04265 -6.464,14.5625 -14.43748,14.5625l-14.43749,0l0,-29.12504z" />
<Label
Text="Right"
HorizontalOptions="Center"
VerticalOptions="Center" />
</StackLayout>
</Grid>
</SwipeItemView>
</SwipeItems>
</SwipeView.RightItems>
<StackLayout
Padding="10"
BackgroundColor="White">
<Label
Text="{Binding}"/>
</StackLayout>
</SwipeView>
<BoxView
HeightRequest="0.5"
BackgroundColor="LightGray"
VerticalOptions="End"/>
</StackLayout>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</StackLayout>
</ScrollView>
</local:TestContentPage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
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
{
[Preserve(AllMembers = true)]
[Issue(IssueTracker.Github, 12911, "[Bug] Shapes in SwipeView of a CollectionView/ListView has several issues",
PlatformAffected.Android | PlatformAffected.iOS)]
#if UITEST
[NUnit.Framework.Category(UITestCategories.Brush)]
#endif
public partial class Issue12911 : TestContentPage
{
public Issue12911()
{
#if APP
InitializeComponent();
#endif
}

protected override void Init()
{

}
}
}
Loading

0 comments on commit 26a9f00

Please sign in to comment.