Skip to content

Commit b1c026c

Browse files
[Testing] Feature Matrix UITest Cases for CollectionView EmptyView Feature (#28679)
* Added CollectionView FeatureMatrix * Updated Changes * updated changes * changes updated * Addressed feedbacks * Added Issue Link * changes updated * changes updated * updated changes * Added testcases * Changes updated * changes updated * updated changes * Corrected mistakes * Resolved Conflicts
1 parent 76baabc commit b1c026c

14 files changed

+2725
-49
lines changed

src/Controls/tests/TestCases.HostApp/CoreViews/CorePageView.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public override string ToString()
7777
new GalleryPageFactory(() => new TimePickerCoreGalleryPage(), "Time Picker Gallery"),
7878
new GalleryPageFactory(() => new WebViewCoreGalleryPage(), "WebView Gallery"),
7979
new GalleryPageFactory(() => new SliderControlPage(), "Slider Feature Matrix"),
80-
new GalleryPageFactory(() => new HeaderFooterMainPage(), "CollectionView Feature Matrix"),
80+
new GalleryPageFactory(() => new CollectionViewFeaturePage(), "CollectionView Feature Matrix"),
8181
};
8282

8383
public CorePageView(Page rootPage)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
xmlns:local="clr-namespace:Maui.Controls.Sample"
5+
x:Class="Maui.Controls.Sample.CollectionViewFeatureMainPage"
6+
Title="CollectionViewMainPage">
7+
<VerticalStackLayout Padding="20"
8+
Spacing="10"
9+
VerticalOptions="Center">
10+
<Button Text="EmptyView/EmptyViewTemplate"
11+
Clicked="OnEmptyViewButtonClicked"
12+
HorizontalOptions="Center"
13+
AutomationId="EmptyViewButton"
14+
WidthRequest="400"/>
15+
<Button Text="Header/FooterViewTemplate"
16+
Clicked="OnHeaderFooterViewButtonClicked"
17+
HorizontalOptions="Center"
18+
AutomationId="HeaderFooterViewButton"
19+
WidthRequest="400"/>
20+
</VerticalStackLayout>
21+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
using Microsoft.Maui.Controls;
3+
4+
namespace Maui.Controls.Sample
5+
{
6+
public class CollectionViewFeaturePage : NavigationPage
7+
{
8+
public CollectionViewFeaturePage()
9+
{
10+
PushAsync(new CollectionViewFeatureMainPage());
11+
}
12+
}
13+
14+
public partial class CollectionViewFeatureMainPage : ContentPage
15+
{
16+
public CollectionViewFeatureMainPage()
17+
{
18+
InitializeComponent();
19+
}
20+
21+
private async void OnEmptyViewButtonClicked(object sender, EventArgs e)
22+
{
23+
await Navigation.PushAsync(new CollectionViewEmptyViewPage());
24+
}
25+
26+
private async void OnHeaderFooterViewButtonClicked(object sender, EventArgs e)
27+
{
28+
await Navigation.PushAsync(new CollectionViewHeaderPage());
29+
}
30+
}
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
xmlns:local="clr-namespace:Maui.Controls.Sample"
5+
x:Class="Maui.Controls.Sample.CollectionViewEmptyViewPage"
6+
Title="CollectionViewFeature">
7+
<ContentPage.ToolbarItems>
8+
<ToolbarItem Text="Options"
9+
Clicked="NavigateToOptionsPage_Clicked"
10+
AutomationId="Options"/>
11+
</ContentPage.ToolbarItems>
12+
13+
<local:CollectionView2
14+
x:Name="collectionView"
15+
ItemsSource="{Binding ItemsSource}"
16+
EmptyView="{Binding EmptyView}"
17+
Header="{Binding Header}"
18+
Footer="{Binding Footer}"
19+
EmptyViewTemplate="{Binding EmptyViewTemplate}"
20+
GroupHeaderTemplate="{Binding GroupHeaderTemplate}"
21+
ItemTemplate="{Binding ItemTemplate}"
22+
IsGrouped="{Binding IsGrouped}"
23+
ItemsLayout="{Binding ItemsLayout}"
24+
AutomationId="CollectionViewControl">
25+
</local:CollectionView2>
26+
</ContentPage>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using Microsoft.Maui.Controls;
3+
using System.Collections.ObjectModel;
4+
5+
namespace Maui.Controls.Sample
6+
{
7+
public partial class CollectionViewEmptyViewPage : ContentPage
8+
{
9+
10+
private CollectionViewViewModel _viewModel;
11+
12+
public CollectionViewEmptyViewPage()
13+
{
14+
InitializeComponent();
15+
_viewModel = new CollectionViewViewModel();
16+
BindingContext = _viewModel;
17+
}
18+
19+
private async void NavigateToOptionsPage_Clicked(object sender, EventArgs e)
20+
{
21+
BindingContext = _viewModel = new CollectionViewViewModel();
22+
await Navigation.PushAsync(new EmptyViewOptionsPage(_viewModel));
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,248 @@
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+
xmlns:local="clr-namespace:Maui.Controls.Sample"
5+
x:Class="Maui.Controls.Sample.EmptyViewOptionsPage"
6+
Title="EmptyViewOptionsPage">
7+
<ContentPage.ToolbarItems>
8+
<ToolbarItem Text="Apply"
9+
Clicked="ApplyButton_Clicked"
10+
AutomationId="Apply"/>
11+
</ContentPage.ToolbarItems>
12+
<ScrollView>
13+
<Grid Padding="1"
14+
RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto">
15+
<StackLayout Grid.Row="1"
16+
Padding="1">
17+
<!-- Empty View -->
18+
<Label Text="EmptyView:"
19+
FontSize="12"
20+
FontAttributes="Bold"/>
21+
<StackLayout Orientation="Horizontal">
22+
<RadioButton x:Name="EmptyViewNone"
23+
Content="None"
24+
GroupName="EmptyView"
25+
IsChecked="True"
26+
CheckedChanged="OnEmptyViewChanged"
27+
FontSize="11"
28+
AutomationId="EmptyViewNone"/>
29+
<RadioButton x:Name="EmptyViewString"
30+
Content="String"
31+
GroupName="EmptyView"
32+
CheckedChanged="OnEmptyViewChanged"
33+
FontSize="11"
34+
AutomationId="EmptyViewString"/>
35+
<RadioButton x:Name="EmptyViewGrid"
36+
Content="View"
37+
GroupName="EmptyView"
38+
CheckedChanged="OnEmptyViewChanged"
39+
FontSize="11"
40+
AutomationId="EmptyViewGrid"/>
41+
<RadioButton x:Name="EmptyViewCustomSize"
42+
Content="View With Size"
43+
GroupName="EmptyView"
44+
CheckedChanged="OnEmptyViewChanged"
45+
FontSize="11"
46+
AutomationId="EmptyViewCustomSize"/>
47+
</StackLayout>
48+
<!-- EmptyViewTemplate -->
49+
<Label Text="EmptyViewTemplate"
50+
FontSize="12"
51+
FontAttributes="Bold"/>
52+
<StackLayout Orientation="Horizontal">
53+
<RadioButton x:Name="EmptyViewTemplateNone"
54+
Content="None"
55+
IsChecked="True"
56+
GroupName="EmptyViewTemplateGroup"
57+
CheckedChanged="OnEmptyViewTemplateChanged"
58+
FontSize="11"
59+
AutomationId="EmptyViewTemplateNone"/>
60+
<RadioButton x:Name="EmptyViewTemplateGrid"
61+
Content="View"
62+
GroupName="EmptyViewTemplateGroup"
63+
CheckedChanged="OnEmptyViewTemplateChanged"
64+
FontSize="11"
65+
AutomationId="EmptyViewTemplateGrid"/>
66+
<RadioButton x:Name="EmptyViewTemplateCustomSize"
67+
Content="View With Size"
68+
GroupName="EmptyViewTemplateGroup"
69+
CheckedChanged="OnEmptyViewTemplateChanged"
70+
FontSize="11"
71+
AutomationId="EmptyViewTemplateCustomSize"/>
72+
</StackLayout>
73+
<!-- Header-->
74+
<Label Text="Header:"
75+
FontSize="12"
76+
FontAttributes="Bold"/>
77+
<StackLayout Orientation="Horizontal">
78+
<RadioButton x:Name="HeaderNone"
79+
Content="None"
80+
GroupName="HeaderOptions"
81+
IsChecked="True"
82+
CheckedChanged="OnHeaderChanged"
83+
FontSize="11"
84+
AutomationId="HeaderNone"/>
85+
<RadioButton x:Name="HeaderString"
86+
Content="String"
87+
GroupName="HeaderOptions"
88+
CheckedChanged="OnHeaderChanged"
89+
FontSize="11"
90+
AutomationId="HeaderString"/>
91+
<RadioButton x:Name="HeaderGrid"
92+
Content="View"
93+
GroupName="HeaderOptions"
94+
CheckedChanged="OnHeaderChanged"
95+
FontSize="11"
96+
AutomationId="HeaderGrid"/>
97+
</StackLayout>
98+
<!-- Footer-->
99+
<Label Text="Footer:"
100+
FontSize="12"
101+
FontAttributes="Bold"/>
102+
<StackLayout Orientation="Horizontal">
103+
<RadioButton x:Name="FooterNone"
104+
Content="None"
105+
IsChecked="True"
106+
GroupName="FooterOptions"
107+
CheckedChanged="OnFooterChanged"
108+
FontSize="11"
109+
AutomationId="FooterNone"/>
110+
<RadioButton x:Name="FooterString"
111+
Content="String"
112+
GroupName="FooterOptions"
113+
CheckedChanged="OnFooterChanged"
114+
FontSize="11"
115+
AutomationId="FooterString"/>
116+
<RadioButton x:Name="FooterGrid"
117+
Content="View"
118+
GroupName="FooterOptions"
119+
CheckedChanged="OnFooterChanged"
120+
FontSize="11"
121+
AutomationId="FooterGrid"/>
122+
</StackLayout>
123+
124+
<Label Text="ItemsLayout:"
125+
FontAttributes="Bold"
126+
FontSize="12"/>
127+
<VerticalStackLayout>
128+
<!-- First Row -->
129+
<HorizontalStackLayout Spacing="10">
130+
<RadioButton x:Name="ItemsLayoutVerticalList"
131+
IsChecked="True"
132+
CheckedChanged="OnItemsLayoutChanged"
133+
Content="Vertical List"
134+
FontSize="11"
135+
GroupName="ItemsLayoutGroup"
136+
AutomationId="ItemsLayoutVerticalList"/>
137+
<RadioButton x:Name="ItemsLayoutHorizontalList"
138+
CheckedChanged="OnItemsLayoutChanged"
139+
Content="Horizontal List"
140+
FontSize="11"
141+
GroupName="ItemsLayoutGroup"
142+
AutomationId="ItemsLayoutHorizontalList"/>
143+
</HorizontalStackLayout>
144+
<!-- Second Row -->
145+
<HorizontalStackLayout Spacing="10">
146+
<RadioButton x:Name="ItemsLayoutVerticalGrid"
147+
CheckedChanged="OnItemsLayoutChanged"
148+
Content="Vertical Grid"
149+
FontSize="11"
150+
GroupName="ItemsLayoutGroup"
151+
AutomationId="ItemsLayoutVerticalGrid"/>
152+
<RadioButton x:Name="ItemsLayoutHorizontalGrid"
153+
CheckedChanged="OnItemsLayoutChanged"
154+
Content="Horizontal Grid"
155+
FontSize="11"
156+
GroupName="ItemsLayoutGroup"
157+
AutomationId="ItemsLayoutHorizontalGrid"/>
158+
</HorizontalStackLayout>
159+
</VerticalStackLayout>
160+
<!-- ItemTemplate -->
161+
<Label Text="Item Template:"
162+
FontSize="12"
163+
FontAttributes="Bold"/>
164+
<StackLayout Orientation="Horizontal">
165+
<RadioButton x:Name="ItemTemplateNone"
166+
Content="None"
167+
FontSize="11"
168+
IsChecked="True"
169+
GroupName="ItemTemplateGroup"
170+
CheckedChanged="OnItemTemplateChanged"
171+
AutomationId="ItemTemplateNone"/>
172+
<RadioButton x:Name="ItemTemplateBasic"
173+
Content="Basic DataTemplate"
174+
FontSize="11"
175+
GroupName="ItemTemplateGroup"
176+
CheckedChanged="OnItemTemplateChanged"
177+
AutomationId="ItemTemplateBasic"/>
178+
<RadioButton x:Name="ItemTemplateGrid"
179+
Content="View"
180+
FontSize="11"
181+
GroupName="ItemTemplateGroup"
182+
CheckedChanged="OnItemTemplateChanged"
183+
AutomationId="ItemTemplateGrid"/>
184+
</StackLayout>
185+
<!--IsGrouped-->
186+
<Label Text="IsGrouped:"
187+
FontSize="12"
188+
FontAttributes="Bold"/>
189+
<StackLayout Orientation="Horizontal">
190+
<RadioButton x:Name="IsGroupedTrue"
191+
Content="True"
192+
CheckedChanged="OnIsGroupedChanged"
193+
FontSize="11"
194+
AutomationId="IsGroupedTrue"/>
195+
<RadioButton x:Name="IsGroupedFalse"
196+
Content="False"
197+
IsChecked="True"
198+
CheckedChanged="OnIsGroupedChanged"
199+
FontSize="11"
200+
AutomationId="IsGroupedFalse"/>
201+
</StackLayout>
202+
<!-- ItemsSource Selection -->
203+
<Label Text="ItemsSource:"
204+
FontAttributes="Bold"
205+
FontSize="11"/>
206+
<VerticalStackLayout>
207+
<!-- First Row -->
208+
<HorizontalStackLayout Spacing="10">
209+
<RadioButton x:Name="ItemsSourceNone"
210+
Content="None"
211+
IsChecked="True"
212+
FontSize="10"
213+
GroupName="ItemsSourceGroup"
214+
CheckedChanged="OnItemsSourceChanged"
215+
AutomationId="ItemsSourceNone"/>
216+
<RadioButton x:Name="ItemsSourceObservableCollection5"
217+
Content="ObservableCollection"
218+
FontSize="10"
219+
GroupName="ItemsSourceGroup"
220+
CheckedChanged="OnItemsSourceChanged"
221+
AutomationId="ItemsSourceObservableCollection"/>
222+
<RadioButton x:Name="ItemsSourceGroupedList"
223+
Content="Grouped List"
224+
FontSize="10"
225+
GroupName="ItemsSourceGroup"
226+
CheckedChanged="OnItemsSourceChanged"
227+
AutomationId="ItemsSourceGroupedList"/>
228+
</HorizontalStackLayout>
229+
<!-- Second Row -->
230+
<HorizontalStackLayout Spacing="10">
231+
<RadioButton x:Name="ItemsSourceEmptyGroupedList"
232+
Content="Empty Grouped List"
233+
FontSize="10"
234+
GroupName="ItemsSourceGroup"
235+
CheckedChanged="OnItemsSourceChanged"
236+
AutomationId="ItemsSourceEmptyGroupedList"/>
237+
<RadioButton x:Name="ItemsSourceEmptyObservableCollection"
238+
Content="Empty ObservableCollection"
239+
FontSize="10"
240+
GroupName="ItemsSourceGroup"
241+
CheckedChanged="OnItemsSourceChanged"
242+
AutomationId="ItemsSourceEmptyObservableCollection"/>
243+
</HorizontalStackLayout>
244+
</VerticalStackLayout>
245+
</StackLayout>
246+
</Grid>
247+
</ScrollView>
248+
</ContentPage>

0 commit comments

Comments
 (0)