Skip to content

Commit 96ab51e

Browse files
kubaflormarinho
authored andcommitted
Added UiTests (dotnet#12429)
1 parent fb711d4 commit 96ab51e

File tree

3 files changed

+92
-0
lines changed

3 files changed

+92
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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.Issue12429"
5+
x:Name="Self"
6+
Title="Issue12429">
7+
<Grid RowDefinitions="Auto,*">
8+
<HorizontalStackLayout Grid.Row="0">
9+
<Button
10+
Command="{Binding AddCommand}"
11+
HorizontalOptions="Center"
12+
AutomationId="button"
13+
Text="Add" />
14+
</HorizontalStackLayout>
15+
16+
<CollectionView
17+
Grid.Row="1"
18+
ItemsSource="{Binding ItemList}">
19+
20+
<CollectionView.Header>
21+
<VerticalStackLayout>
22+
<VerticalStackLayout BindableLayout.ItemsSource="{Binding BindingContext.ItemListHeader, Source={x:Reference Self}}">
23+
<BindableLayout.ItemTemplate>
24+
<DataTemplate>
25+
<Label Padding="10" Text="{Binding .}" />
26+
</DataTemplate>
27+
</BindableLayout.ItemTemplate>
28+
</VerticalStackLayout>
29+
<BoxView
30+
Margin="0,5"
31+
HeightRequest="2"
32+
Color="Black" />
33+
</VerticalStackLayout>
34+
</CollectionView.Header>
35+
36+
<CollectionView.ItemTemplate>
37+
<DataTemplate>
38+
<Label Padding="10" Text="{Binding .}" />
39+
</DataTemplate>
40+
</CollectionView.ItemTemplate>
41+
</CollectionView>
42+
</Grid>
43+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System.Collections.ObjectModel;
2+
using Microsoft.Maui.Controls;
3+
using Microsoft.Maui.Controls.Xaml;
4+
5+
namespace Maui.Controls.Sample.Issues;
6+
7+
[XamlCompilation(XamlCompilationOptions.Compile)]
8+
[Issue(IssueTracker.Github, 12429, "[iOS] CollectionView Items display issue when Header is resized", PlatformAffected.iOS)]
9+
10+
public partial class Issue12429 : ContentPage
11+
{
12+
public ObservableCollection<string> ItemList { get; }
13+
public ObservableCollection<string> ItemListHeader { get; }
14+
15+
public Command AddCommand => new(() => ItemListHeader.Add($"HeaderItem{ItemListHeader.Count + 1}"));
16+
17+
public Issue12429()
18+
{
19+
InitializeComponent();
20+
ItemList = new() { "Item1", "Item2", "Itme3" };
21+
ItemListHeader = new() { "HeaderItem1" };
22+
BindingContext = this;
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.AppiumTests.Issues;
6+
7+
public class Issue12429 : _IssuesUITest
8+
{
9+
public override string Issue => "[iOS] CollectionView Items display issue when Header is resized";
10+
11+
public Issue12429(TestDevice device) : base(device)
12+
{ }
13+
14+
[Test]
15+
public void HeaderShouldNotCollapseWithItems()
16+
{
17+
App.WaitForElement("button");
18+
App.Click("button");
19+
App.Click("button");
20+
App.Click("button");
21+
22+
//The test passes of header has 4 elements that don't overlap with the collection view's items
23+
VerifyScreenshot();
24+
}
25+
}

0 commit comments

Comments
 (0)