Skip to content

Commit 0b99f74

Browse files
committed
Added a UITest
1 parent b515625 commit 0b99f74

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4+
x:Class="Maui.Controls.Sample.Issues.Issue25946">
5+
<Grid RowDefinitions="*,Auto">
6+
<CarouselView x:Name="collectionView">
7+
<CarouselView.ItemsSource>
8+
<x:Array Type="{x:Type x:String}">
9+
<x:String>Item1</x:String>
10+
<x:String>Item2</x:String>
11+
<x:String>Item3</x:String>
12+
</x:Array>
13+
</CarouselView.ItemsSource>
14+
<CarouselView.ItemTemplate>
15+
<DataTemplate>
16+
<ContentView>
17+
<VerticalStackLayout HorizontalOptions="Center"
18+
WidthRequest="200"
19+
HeightRequest="200"
20+
Background="Green">
21+
<Label Text="{Binding .}"/>
22+
<Label Text="{Binding .}"
23+
TextType="Html"/>
24+
</VerticalStackLayout>
25+
</ContentView>
26+
</DataTemplate>
27+
</CarouselView.ItemTemplate>
28+
</CarouselView>
29+
<Button Grid.Row="1"
30+
AutomationId="btnScrollToLastItem"
31+
Clicked="ButtonClicked"
32+
Text="Scroll to last Item"/>
33+
</Grid>
34+
</ContentPage>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace Maui.Controls.Sample.Issues
2+
{
3+
[Issue(IssueTracker.Github, 25946, "App crashes on iOS 18 when placing html label in carousel view with > 2 elements", PlatformAffected.iOS)]
4+
public partial class Issue25946 : ContentPage
5+
{
6+
public Issue25946()
7+
{
8+
InitializeComponent();
9+
}
10+
11+
void ButtonClicked(object sender, EventArgs e)
12+
{
13+
collectionView.ScrollTo(1, animate: true);
14+
}
15+
}
16+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class Issue25946 : _IssuesUITest
8+
{
9+
public Issue25946(TestDevice testDevice) : base(testDevice)
10+
{
11+
}
12+
13+
public override string Issue => "App crashes on iOS 18 when placing html label in carousel view with > 2 elements";
14+
15+
[Test]
16+
[Category(UITestCategories.CarouselView)]
17+
[Category(UITestCategories.Label)]
18+
public void AppShouldNotCrash()
19+
{
20+
App.WaitForElement("btnScrollToLastItem");
21+
App.Click("btnScrollToLastItem");
22+
23+
App.WaitForElement("Item2");
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)