Skip to content

Commit a32288d

Browse files
committed
test: Verify fix for unoplatform#4899, unoplatform#4907
1 parent 75a3762 commit a32288d

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Collections.ObjectModel;
2+
using Microsoft.UI.Xaml.Controls;
3+
using Microsoft.UI.Xaml.Controls.Primitives;
4+
using Microsoft.VisualStudio.TestTools.UnitTesting;
5+
using MUXControlsTestApp.Utilities;
6+
using Private.Infrastructure;
7+
8+
namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
9+
{
10+
public partial class TabViewTests
11+
{
12+
#if HAS_UNO
13+
[TestMethod]
14+
public void VerifyItemsAreCreatedOnlyOnce()
15+
{
16+
TabView tabView = null;
17+
RunOnUIThread.Execute(() =>
18+
{
19+
tabView = new TabView();
20+
TestServices.WindowHelper.WindowContent = tabView;
21+
22+
var items = new ObservableCollection<int>()
23+
{
24+
1, 2, 3
25+
};
26+
27+
int containerContentChangingCounter = 0;
28+
29+
var listView = tabView.GetTemplateChild<TabViewListView>("TabListView");
30+
listView.ContainerContentChanging += (s, e) =>
31+
{
32+
if (e.ItemIndex == 0)
33+
{
34+
containerContentChangingCounter++;
35+
}
36+
};
37+
38+
tabView.TabItemsSource = items;
39+
40+
tabView.UpdateLayout();
41+
42+
TestServices.WindowHelper.WaitForIdle();
43+
44+
// Only one container should be generated for the first item.
45+
Assert.AreEqual(1, containerContentChangingCounter);
46+
});
47+
}
48+
#endif
49+
}
50+
}

src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/TabView/TabViewTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
3333
{
3434

3535
[TestClass]
36-
public class TabViewTests
36+
public partial class TabViewTests
3737
{
38-
3938
[TestMethod]
4039
[Ignore("Automation peers are not fully supported on Uno https://github.com/unoplatform/uno/issues/4558")]
4140
public void VerifyCompactTabWidthVisualStates()

0 commit comments

Comments
 (0)