public void DragTo() { using var app = Application.AttachOrLaunch(ExeFileName, WindowName); var window = app.MainWindow; var area = window.FindGroupBox("Touch area"); var events = window.FindListBox("Events"); using (Touch.Hold(area.Bounds.Center())) { Touch.DragTo(area.Bounds.Center() + new Vector(10, 10)); } var expected = new[] { "TouchEnter Position: 250,300", "PreviewTouchDown Position: 250,300", "TouchDown Position: 250,300", "ManipulationStarting", "ManipulationStarted", "PreviewTouchMove Position: 250,300", "TouchMove Position: 250,300", "StylusSystemGesture SystemGesture: Drag", "PreviewTouchMove Position: 260,310", "TouchMove Position: 260,310", "ManipulationDelta", "PreviewTouchUp Position: 260,310", "TouchUp Position: 260,310", "ManipulationInertiaStarting", "ManipulationCompleted", "TouchLeave Position: 260,310", }; CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray(), EventStringComparer.Default); }
public void DragTo() { if (WindowsVersion.IsAppVeyor()) { Assert.Inconclusive("We need a Win 10 image on AppVeyor for testing touch."); } using (var app = Application.AttachOrLaunch(ExeFileName, WindowName)) { var window = app.MainWindow; var area = window.FindGroupBox("Touch area"); var events = window.FindListBox("Events"); using (Touch.Down(area.Bounds.Center())) { Touch.DragTo(area.Bounds.TopLeft); } var expected = new[] { "TouchEnter Position: 99,299", "PreviewTouchDown Position: 99,299", "TouchDown Position: 99,299", "ManipulationStarting", "ManipulationStarted", "PreviewTouchMove Position: -1,-1", "TouchMove Position: -1,-1", "ManipulationDelta", "PreviewTouchUp Position: -1,-1", "TouchUp Position: -1,-1", "ManipulationInertiaStarting", "ManipulationCompleted", "TouchLeave Position: -1,-1", }; CollectionAssert.AreEqual(expected, events.Items.Select(x => x.Text).ToArray()); } }