@@ -94,6 +94,105 @@ public async Task TestGridSplitterDragHorizontalPastMinimumAsync()
94
94
Verify . AreEqual ( columnDefinitionEnd . MinWidth , columnDefinitionEnd . ActualWidth , "Column was not the minimum size expected." ) ;
95
95
}
96
96
97
+ [ TestMethod ]
98
+ [ TestPage ( "GridSplitterTestPage" ) ]
99
+ public async Task TestGridSplitterDragHorizontalPastMaximumAsync ( )
100
+ {
101
+ var amount = 150 ;
102
+
103
+ var gridSplitter = FindElement . ById ( "GridSplitterHorizontal" ) ;
104
+
105
+ Verify . IsNotNull ( gridSplitter , "Can't find Horizontal GridSplitter" ) ;
106
+
107
+ // Drag to the Left
108
+ InputHelper . DragDistance ( gridSplitter , amount , Direction . East , 1000 ) ;
109
+
110
+ Wait . ForMilliseconds ( 1050 ) ;
111
+ Wait . ForIdle ( ) ;
112
+
113
+ ColumnDefinition columnDefinitionEnd = ( await VisualTreeHelper . FindElementPropertyAsync < List < ColumnDefinition > > ( "GridSplitterRoot" , "ColumnDefinitions" ) ) ? . FirstOrDefault ( ) ;
114
+
115
+ Wait . ForIdle ( ) ;
116
+
117
+ Verify . AreEqual ( columnDefinitionEnd . MaxWidth , columnDefinitionEnd . ActualWidth , "Column was not the maximum size expected." ) ;
118
+ }
119
+
120
+ [ TestMethod ]
121
+ [ TestPage ( "GridSplitterTestPage" ) ]
122
+ public async Task TestGridSplitterDragVerticalAsync ( )
123
+ {
124
+ var amount = 50 ;
125
+ var tolerance = 10 ;
126
+
127
+ var grid = FindElement . ByName ( "GridSplitterRoot" ) ;
128
+ var gridSplitter = FindElement . ById ( "GridSplitterVertical" ) ;
129
+
130
+ Verify . IsNotNull ( grid , "Can't find GridSplitterRoot" ) ;
131
+ Verify . IsNotNull ( gridSplitter , "Can't find Vertical GridSplitter" ) ;
132
+
133
+ RowDefinition rowDefinitionStart = ( await VisualTreeHelper . FindElementPropertyAsync < List < RowDefinition > > ( "GridSplitterRoot" , "RowDefinitions" ) ) ? . FirstOrDefault ( ) ;
134
+
135
+ Verify . IsNotNull ( rowDefinitionStart , "Couldn't retrieve Row Definition" ) ;
136
+
137
+ // Drag to the Left
138
+ InputHelper . DragDistance ( gridSplitter , amount , Direction . North , 1000 ) ;
139
+
140
+ Wait . ForMilliseconds ( 1050 ) ;
141
+ Wait . ForIdle ( ) ;
142
+
143
+ RowDefinition rowDefinitionEnd = ( await VisualTreeHelper . FindElementPropertyAsync < List < RowDefinition > > ( "GridSplitterRoot" , "RowDefinitions" ) ) ? . FirstOrDefault ( ) ;
144
+
145
+ Wait . ForIdle ( ) ;
146
+
147
+ Verify . IsTrue ( Math . Abs ( rowDefinitionStart . ActualHeight - amount - rowDefinitionEnd . ActualHeight ) <= tolerance , $ "RowDefinition not in range expected { rowDefinitionStart . ActualHeight - amount } was { rowDefinitionEnd . ActualHeight } ") ;
148
+ }
149
+
150
+ [ TestMethod ]
151
+ [ TestPage ( "GridSplitterTestPage" ) ]
152
+ public async Task TestGridSplitterDragVerticalPastMinimumAsync ( )
153
+ {
154
+ var amount = 150 ;
155
+
156
+ var gridSplitter = FindElement . ById ( "GridSplitterVertical" ) ;
157
+
158
+ Verify . IsNotNull ( gridSplitter , "Can't find Vertical GridSplitter" ) ;
159
+
160
+ // Drag to the Left
161
+ InputHelper . DragDistance ( gridSplitter , amount , Direction . North , 1000 ) ;
162
+
163
+ Wait . ForMilliseconds ( 1050 ) ;
164
+ Wait . ForIdle ( ) ;
165
+
166
+ RowDefinition rowDefinitionEnd = ( await VisualTreeHelper . FindElementPropertyAsync < List < RowDefinition > > ( "GridSplitterRoot" , "RowDefinitions" ) ) ? . FirstOrDefault ( ) ;
167
+
168
+ Wait . ForIdle ( ) ;
169
+
170
+ Verify . AreEqual ( rowDefinitionEnd . MinHeight , rowDefinitionEnd . ActualHeight , "Row was not the minimum size expected." ) ;
171
+ }
172
+
173
+ [ TestMethod ]
174
+ [ TestPage ( "GridSplitterTestPage" ) ]
175
+ public async Task TestGridSplitterDragVerticalPastMaximumAsync ( )
176
+ {
177
+ var amount = 150 ;
178
+
179
+ var gridSplitter = FindElement . ById ( "GridSplitterVertical" ) ;
180
+
181
+ Verify . IsNotNull ( gridSplitter , "Can't find Vertical GridSplitter" ) ;
182
+
183
+ // Drag to the Left
184
+ InputHelper . DragDistance ( gridSplitter , amount , Direction . South , 1000 ) ;
185
+
186
+ Wait . ForMilliseconds ( 1050 ) ;
187
+ Wait . ForIdle ( ) ;
188
+
189
+ RowDefinition rowDefinitionEnd = ( await VisualTreeHelper . FindElementPropertyAsync < List < RowDefinition > > ( "GridSplitterRoot" , "RowDefinitions" ) ) ? . FirstOrDefault ( ) ;
190
+
191
+ Wait . ForIdle ( ) ;
192
+
193
+ Verify . AreEqual ( rowDefinitionEnd . MaxHeight , rowDefinitionEnd . ActualHeight , "Row was not the maximum size expected." ) ;
194
+ }
195
+
97
196
private class ColumnDefinition
98
197
{
99
198
public GridLength Width { get ; set ; }
@@ -105,6 +204,17 @@ private class ColumnDefinition
105
204
public double MaxWidth { get ; set ; }
106
205
}
107
206
207
+ private class RowDefinition
208
+ {
209
+ public GridLength Height { get ; set ; }
210
+
211
+ public double ActualHeight { get ; set ; }
212
+
213
+ public double MinHeight { get ; set ; }
214
+
215
+ public double MaxHeight { get ; set ; }
216
+ }
217
+
108
218
private class GridLength
109
219
{
110
220
public int GridUnitType { get ; set ; } // 0 Auto, 1 Pixel, 2 Star
0 commit comments