@@ -71,6 +71,35 @@ public void ZoomingInMultiTouch()
7171 Assert . IsTrue ( int . Parse ( zoomScaleTextBox . Text ) > 100 ) ;
7272 }
7373
74+ [ TestMethod ]
75+ public void ZoomingInMultiTouchWithInterpolation ( )
76+ {
77+ // Set pointer move Duration to 300 ms to implicitly generate 6 interpolation moves that are performed every 50 ms
78+ TimeSpan moveDuration = TimeSpan . FromMilliseconds ( 300 ) ;
79+
80+ // Drag a touch contact diagonally in NE direction distancing apart from the other contact point
81+ PointerInputDevice touch1 = new PointerInputDevice ( PointerKind . Touch ) ;
82+ ActionSequence touch1Sequence = new ActionSequence ( touch1 , 0 ) ;
83+ touch1Sequence . AddAction ( touch1 . CreatePointerMove ( zoomInteractor , 50 , - 50 , TimeSpan . Zero ) ) ;
84+ touch1Sequence . AddAction ( touch1 . CreatePointerDown ( PointerButton . TouchContact ) ) ;
85+ touch1Sequence . AddAction ( touch1 . CreatePointerMove ( zoomInteractor , 80 , - 80 , moveDuration ) ) ;
86+ touch1Sequence . AddAction ( touch1 . CreatePointerUp ( PointerButton . TouchContact ) ) ;
87+
88+ // Drag a touch contact diagonally in SW direction distancing apart from the other contact point
89+ PointerInputDevice touch2 = new PointerInputDevice ( PointerKind . Touch ) ;
90+ ActionSequence touch2Sequence = new ActionSequence ( touch2 , 0 ) ;
91+ touch2Sequence . AddAction ( touch2 . CreatePointerMove ( zoomInteractor , - 50 , 50 , TimeSpan . Zero ) ) ;
92+ touch2Sequence . AddAction ( touch2 . CreatePointerDown ( PointerButton . TouchContact ) ) ;
93+ touch2Sequence . AddAction ( touch2 . CreatePointerMove ( zoomInteractor , - 80 , 80 , moveDuration ) ) ;
94+ touch2Sequence . AddAction ( touch2 . CreatePointerUp ( PointerButton . TouchContact ) ) ;
95+
96+ // Perform the 2 fingers zoom in (expand) multi-touch sequences defined above
97+ session . PerformActions ( new List < ActionSequence > { touch1Sequence , touch2Sequence } ) ;
98+
99+ // Ensure that the zoom level now is greater than 100%
100+ Assert . IsTrue ( int . Parse ( zoomScaleTextBox . Text ) > 100 ) ;
101+ }
102+
74103 [ TestMethod ]
75104 public void ZoomingOutMultiTouch ( )
76105 {
@@ -107,6 +136,35 @@ public void ZoomingOutMultiTouch()
107136 Assert . IsTrue ( int . Parse ( zoomScaleTextBox . Text ) < 100 ) ;
108137 }
109138
139+ [ TestMethod ]
140+ public void ZoomingOutMultiTouchWithInterpolation ( )
141+ {
142+ // Set pointer move Duration to 300 ms to implicitly generate 6 interpolation moves that are performed every 50 ms
143+ TimeSpan moveDuration = TimeSpan . FromMilliseconds ( 300 ) ;
144+
145+ // Drag a touch contact diagonally in SW direction approaching the other contact point
146+ PointerInputDevice touch1 = new PointerInputDevice ( PointerKind . Touch ) ;
147+ ActionSequence touch1Sequence = new ActionSequence ( touch1 , 0 ) ;
148+ touch1Sequence . AddAction ( touch1 . CreatePointerMove ( zoomInteractor , 50 , - 50 , TimeSpan . Zero ) ) ;
149+ touch1Sequence . AddAction ( touch1 . CreatePointerDown ( PointerButton . TouchContact ) ) ;
150+ touch1Sequence . AddAction ( touch1 . CreatePointerMove ( zoomInteractor , 20 , - 20 , moveDuration ) ) ;
151+ touch1Sequence . AddAction ( touch1 . CreatePointerUp ( PointerButton . TouchContact ) ) ;
152+
153+ // Drag a touch contact diagonally in NE direction approaching the other contact point
154+ PointerInputDevice touch2 = new PointerInputDevice ( PointerKind . Touch ) ;
155+ ActionSequence touch2Sequence = new ActionSequence ( touch2 , 0 ) ;
156+ touch2Sequence . AddAction ( touch2 . CreatePointerMove ( zoomInteractor , - 50 , 50 , TimeSpan . Zero ) ) ;
157+ touch2Sequence . AddAction ( touch2 . CreatePointerDown ( PointerButton . TouchContact ) ) ;
158+ touch2Sequence . AddAction ( touch2 . CreatePointerMove ( zoomInteractor , - 20 , 20 , moveDuration ) ) ;
159+ touch2Sequence . AddAction ( touch2 . CreatePointerUp ( PointerButton . TouchContact ) ) ;
160+
161+ // Perform the 2 fingers zoom out (pinch) multi-touch sequences defined above
162+ session . PerformActions ( new List < ActionSequence > { touch1Sequence , touch2Sequence } ) ;
163+
164+ // Ensure that the zoom level now is less than 100%
165+ Assert . IsTrue ( int . Parse ( zoomScaleTextBox . Text ) < 100 ) ;
166+ }
167+
110168 [ ClassInitialize ]
111169 public static void ClassInitialize ( TestContext context )
112170 {
@@ -128,6 +186,40 @@ public void SetupZoomLevel()
128186
129187 // Ensure that the zoom level starts at 100%
130188 Assert . IsTrue ( int . Parse ( zoomScaleTextBox . Text ) == 100 ) ;
189+
190+ // Draw a circle to help visualize the zoom level changes
191+ DrawCircle ( ) ;
192+ }
193+
194+ private void DrawCircle ( )
195+ {
196+ // Draw a circle with radius 300 and 40 (x, y) points
197+ const int radius = 300 ;
198+ const int points = 40 ;
199+
200+ // Select the Brushes toolbox to have the Brushes Pane sidebar displayed and ensure that Marker is selected
201+ session . FindElementByAccessibilityId ( "Toolbox" ) . FindElementByAccessibilityId ( "TopBar_ArtTools" ) . Click ( ) ;
202+ session . FindElementByAccessibilityId ( "SidebarWrapper" ) . FindElementByAccessibilityId ( "Marker3d" ) . Click ( ) ;
203+
204+ // Locate the drawing surface
205+ WindowsElement inkCanvas = session . FindElementByAccessibilityId ( "InteractorFocusWrapper" ) ;
206+
207+ // Draw the circle with a single touch actions
208+ PointerInputDevice touchContact = new PointerInputDevice ( PointerKind . Touch ) ;
209+ ActionSequence touchSequence = new ActionSequence ( touchContact , 0 ) ;
210+ touchSequence . AddAction ( touchContact . CreatePointerMove ( inkCanvas , 0 , - radius , TimeSpan . Zero ) ) ;
211+ touchSequence . AddAction ( touchContact . CreatePointerDown ( PointerButton . TouchContact ) ) ;
212+ for ( double angle = 0 ; angle <= 2 * Math . PI ; angle += 2 * Math . PI / points )
213+ {
214+ touchSequence . AddAction ( touchContact . CreatePointerMove ( inkCanvas , ( int ) ( Math . Sin ( angle ) * radius ) , - ( int ) ( Math . Cos ( angle ) * radius ) , TimeSpan . Zero ) ) ;
215+ }
216+ touchSequence . AddAction ( touchContact . CreatePointerUp ( PointerButton . TouchContact ) ) ;
217+ session . PerformActions ( new List < ActionSequence > { touchSequence } ) ;
218+
219+ // Verify that the drawing operations took place
220+ WindowsElement undoButton = session . FindElementByAccessibilityId ( "UndoIcon" ) ;
221+ Assert . IsTrue ( undoButton . Displayed ) ;
222+ Assert . IsTrue ( undoButton . Enabled ) ;
131223 }
132224 }
133- }
225+ }
0 commit comments