747c8674e0ee41de9ba9db296c3e0114dbc0d203
[WebKit-https.git] / Tools / WebKitTestRunner / ios / HIDEventGenerator.h
1 /*
2  * Copyright (C) 2015 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #import "UIKitSPI.h"
27
28 #import <CoreGraphics/CGGeometry.h>
29
30 // Keys for sendEventStream:completionBlock:.
31 extern NSString* const TopLevelEventInfoKey;
32 extern NSString* const HIDEventInputType;
33 extern NSString* const HIDEventTimeOffsetKey;
34 extern NSString* const HIDEventPhaseKey;
35 extern NSString* const HIDEventTouchIDKey;
36 extern NSString* const HIDEventPressureKey;
37 extern NSString* const HIDEventXKey;
38 extern NSString* const HIDEventYKey;
39 extern NSString* const HIDEventTwistKey;
40 extern NSString* const HIDEventMajorRadiusKey;
41 extern NSString* const HIDEventMinorRadiusKey;
42 extern NSString* const HIDEventTouchesKey;
43
44 // Values for HIDEventInputType.
45 extern NSString* const HIDEventInputTypeHand;
46 extern NSString* const HIDEventInputTypeFinger;
47 extern NSString* const HIDEventInputTypeStylus;
48
49 // Values for HIDEventPhaseKey.
50 extern NSString* const HIDEventPhaseBegan;
51 extern NSString* const HIDEventPhaseMoved;
52 extern NSString* const HIDEventPhaseEnded;
53 extern NSString* const HIDEventPhaseCanceled;
54
55
56 @interface HIDEventGenerator : NSObject
57
58 + (HIDEventGenerator *)sharedHIDEventGenerator;
59
60 // Touches
61 - (void)touchDown:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
62 - (void)liftUp:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
63
64 // Stylus
65 - (void)stylusDownAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
66 - (void)stylusMoveToPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
67 - (void)stylusUpAtPoint:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
68 - (void)stylusTapAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
69
70 // Taps
71 - (void)tap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
72 - (void)doubleTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
73 - (void)twoFingerTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
74
75 // Long Press
76 - (void)longPress:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
77
78 // Drags
79 - (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
80
81 // Pinches
82 - (void)pinchCloseWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
83 - (void)pinchOpenWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
84
85 // Event stream
86 - (void)sendEventStream:(NSDictionary *)eventInfo completionBlock:(void (^)(void))completionBlock;
87
88 - (void)markerEventReceived:(IOHIDEventRef)event;
89
90 // Keyboard
91 - (void)keyPress:(NSString *)character completionBlock:(void (^)(void))completionBlock;
92 - (void)keyDown:(NSString *)character completionBlock:(void (^)(void))completionBlock;
93 - (void)keyUp:(NSString *)character completionBlock:(void (^)(void))completionBlock;
94
95 @end