2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
// See the LICENSE file in the project root for more information.
4
4
5
+ using System ;
5
6
using Microsoft . Toolkit . Uwp ;
6
7
using Microsoft . Toolkit . Uwp . UI . Triggers ;
7
8
using Microsoft . VisualStudio . TestTools . UnitTesting ;
@@ -22,9 +23,10 @@ public class Test_ControlSizeTrigger : VisualUITestBase
22
23
[ DataRow ( 400 , 399 , false ) ]
23
24
public async Task ControlSizeTriggerTest ( double width , double height , bool expectedResult )
24
25
{
25
- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
26
+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
26
27
{
27
28
Grid grid = CreateGrid ( width , height ) ;
29
+ await SetTestContentAsync ( grid ) ;
28
30
var trigger = new ControlSizeTrigger ( ) ;
29
31
30
32
trigger . TargetElement = grid ;
@@ -42,9 +44,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
42
44
[ DataRow ( 400 , 399 , false ) ]
43
45
public async Task ControlSizeMinHeightTriggerTest ( double width , double height , bool expectedResult )
44
46
{
45
- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
47
+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
46
48
{
47
49
Grid grid = CreateGrid ( width , height ) ;
50
+ await SetTestContentAsync ( grid ) ;
48
51
var trigger = new ControlSizeTrigger ( ) ;
49
52
50
53
trigger . TargetElement = grid ;
@@ -59,9 +62,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
59
62
[ DataRow ( 400 , 400 , true ) ]
60
63
public async Task ControlSizeMinWidthTriggerTest ( double width , double height , bool expectedResult )
61
64
{
62
- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
65
+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
63
66
{
64
67
Grid grid = CreateGrid ( width , height ) ;
68
+ await SetTestContentAsync ( grid ) ;
65
69
var trigger = new ControlSizeTrigger ( ) ;
66
70
67
71
trigger . TargetElement = grid ;
@@ -76,9 +80,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
76
80
[ DataRow ( 450 , 449 , true ) ]
77
81
public async Task ControlSizeMaxHeightTriggerTest ( double width , double height , bool expectedResult )
78
82
{
79
- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
83
+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
80
84
{
81
85
Grid grid = CreateGrid ( width , height ) ;
86
+ await SetTestContentAsync ( grid ) ;
82
87
var trigger = new ControlSizeTrigger ( ) ;
83
88
84
89
trigger . TargetElement = grid ;
@@ -93,9 +98,10 @@ await App.DispatcherQueue.EnqueueAsync(() =>
93
98
[ DataRow ( 449 , 450 , true ) ]
94
99
public async Task ControlSizeMaxWidthTriggerTest ( double width , double height , bool expectedResult )
95
100
{
96
- await App . DispatcherQueue . EnqueueAsync ( ( ) =>
101
+ await App . DispatcherQueue . EnqueueAsync ( async ( ) =>
97
102
{
98
103
Grid grid = CreateGrid ( width , height ) ;
104
+ await SetTestContentAsync ( grid ) ;
99
105
var trigger = new ControlSizeTrigger ( ) ;
100
106
101
107
trigger . TargetElement = grid ;
@@ -112,9 +118,6 @@ private Grid CreateGrid(double width, double height)
112
118
Height = height ,
113
119
Width = width
114
120
} ;
115
- grid . Measure ( new Windows . Foundation . Size ( 1000 , 1000 ) ) ;
116
- grid . Arrange ( new Windows . Foundation . Rect ( 0 , 0 , 1000 , 1000 ) ) ;
117
- grid . UpdateLayout ( ) ;
118
121
119
122
return grid ;
120
123
}
0 commit comments