22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ using System ;
56using Microsoft . Toolkit . Uwp ;
67using Microsoft . Toolkit . Uwp . UI . Triggers ;
78using Microsoft . VisualStudio . TestTools . UnitTesting ;
@@ -22,9 +23,10 @@ public class Test_ControlSizeTrigger : VisualUITestBase
2223 [ DataRow ( 400 , 399 , false ) ]
2324 public async Task ControlSizeTriggerTest ( double width , double height , bool expectedResult )
2425 {
25- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
26+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
2627 {
2728 Grid grid = CreateGrid ( width , height ) ;
29+ await SetTestContentAsync ( grid ) ;
2830 var trigger = new ControlSizeTrigger ( ) ;
2931
3032 trigger . TargetElement = grid ;
@@ -42,9 +44,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
4244 [ DataRow ( 400 , 399 , false ) ]
4345 public async Task ControlSizeMinHeightTriggerTest ( double width , double height , bool expectedResult )
4446 {
45- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
47+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
4648 {
4749 Grid grid = CreateGrid ( width , height ) ;
50+ await SetTestContentAsync ( grid ) ;
4851 var trigger = new ControlSizeTrigger ( ) ;
4952
5053 trigger . TargetElement = grid ;
@@ -59,9 +62,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
5962 [ DataRow ( 400 , 400 , true ) ]
6063 public async Task ControlSizeMinWidthTriggerTest ( double width , double height , bool expectedResult )
6164 {
62- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
65+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
6366 {
6467 Grid grid = CreateGrid ( width , height ) ;
68+ await SetTestContentAsync ( grid ) ;
6569 var trigger = new ControlSizeTrigger ( ) ;
6670
6771 trigger . TargetElement = grid ;
@@ -76,9 +80,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
7680 [ DataRow ( 450 , 449 , true ) ]
7781 public async Task ControlSizeMaxHeightTriggerTest ( double width , double height , bool expectedResult )
7882 {
79- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
83+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
8084 {
8185 Grid grid = CreateGrid ( width , height ) ;
86+ await SetTestContentAsync ( grid ) ;
8287 var trigger = new ControlSizeTrigger ( ) ;
8388
8489 trigger . TargetElement = grid ;
@@ -93,9 +98,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
9398 [ DataRow ( 449 , 450 , true ) ]
9499 public async Task ControlSizeMaxWidthTriggerTest ( double width , double height , bool expectedResult )
95100 {
96- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
101+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
97102 {
98103 Grid grid = CreateGrid ( width , height ) ;
104+ await SetTestContentAsync ( grid ) ;
99105 var trigger = new ControlSizeTrigger ( ) ;
100106
101107 trigger . TargetElement = grid ;
@@ -112,9 +118,6 @@ private Grid CreateGrid(double width, double height)
112118 Height = height ,
113119 Width = width
114120 } ;
115- grid . Measure ( new Windows . Foundation . Size ( 1000 , 1000 ) ) ;
116- grid . Arrange ( new Windows . Foundation . Rect ( 0 , 0 , 1000 , 1000 ) ) ;
117- grid . UpdateLayout ( ) ;
118121
119122 return grid ;
120123 }
0 commit comments