Expose Apple Pencil input to testing system
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2016 23:32:08 +0000 (23:32 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Sep 2016 23:32:08 +0000 (23:32 +0000)
commitee4445daad531156125b0cba809ff4f80a610cfa
tree4450e12f9117560d0a5c5b6df76f97551792f268
parent9d3a45104a09038e2f9193f570df3b32821c047a
Expose Apple Pencil input to testing system
https://bugs.webkit.org/show_bug.cgi?id=161670
<rdar://problem/28183327>

Reviewed by Simon Fraser.

Tools:

Add API to UIScriptController that allows a test to emulate
stylus input, such as from the Apple Pencil.

The code is only implemented for WebKitTestRunner.

There are also four new tests that ensure an Apple Pencil
operates similarly to a regular touch. The main difference
is that you can't have multiple touches when using an Apple Pencil.

* DumpRenderTree/ios/UIScriptControllerIOS.mm: New methods. Empty implementations.
(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):
* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: New methods.
* TestRunnerShared/UIScriptContext/UIScriptController.cpp: Empty implementations.
(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):
* TestRunnerShared/UIScriptContext/UIScriptController.h:

* WebKitTestRunner/ios/HIDEventGenerator.h:
* WebKitTestRunner/ios/HIDEventGenerator.mm: New StylusEvent types. Add some properties
to SyntheticEventDigitizerInfo.
(-[HIDEventGenerator _createIOHIDEventType:]): Add support for StylusEvent types.
(-[HIDEventGenerator touchDownAtPoints:touchCount:]): Clear any old stylus info.
(-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:]):
(-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:]):
(-[HIDEventGenerator stylusUpAtPoint:]):
(-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
(-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
(-[HIDEventGenerator stylusUpAtPoint:completionBlock:]):
(-[HIDEventGenerator stylusTapAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
* WebKitTestRunner/ios/IOKitSPI.h: Add new include, and new SPI.
* WebKitTestRunner/ios/UIScriptControllerIOS.mm: Calls into the HIDEventGenerator for the new API.
(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):

LayoutTests:

Four new tests that make sure Apple Pencil's register the correct
touch* style events.

* fast/events/touch/ios/pencil-down-gives-touchstart-expected.txt: Added.
* fast/events/touch/ios/pencil-down-gives-touchstart.html: Added.
* fast/events/touch/ios/pencil-move-gives-touchmove-expected.txt: Added.
* fast/events/touch/ios/pencil-move-gives-touchmove.html: Added.
* fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend-expected.txt: Added.
* fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend.html: Added.
* fast/events/touch/ios/pencil-up-gives-touchend-expected.txt: Added.
* fast/events/touch/ios/pencil-up-gives-touchend.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205572 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/pencil-down-gives-touchstart-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-down-gives-touchstart.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-move-gives-touchmove-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-move-gives-touchmove.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-up-gives-touchend-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-up-gives-touchend.html [new file with mode: 0644]
Tools/ChangeLog
Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/ios/HIDEventGenerator.h
Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
Tools/WebKitTestRunner/ios/IOKitSPI.h
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm