File tree Expand file tree Collapse file tree 2 files changed +51
-2
lines changed
src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/TabView Expand file tree Collapse file tree 2 files changed +51
-2
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change @@ -33,9 +33,8 @@ namespace Windows.UI.Xaml.Tests.MUXControls.ApiTests
33
33
{
34
34
35
35
[ TestClass ]
36
- public class TabViewTests
36
+ public partial class TabViewTests
37
37
{
38
-
39
38
[ TestMethod ]
40
39
[ Ignore ( "Automation peers are not fully supported on Uno https://github.com/unoplatform/uno/issues/4558" ) ]
41
40
public void VerifyCompactTabWidthVisualStates ( )
You can’t perform that action at this time.
0 commit comments