[iOS] Shift + Tab does not focus previous field
[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 #import <wtf/RetainPtr.h>
30
31 // Keys for sendEventStream:completionBlock:.
32 extern NSString* const TopLevelEventInfoKey;
33 extern NSString* const HIDEventInputType;
34 extern NSString* const HIDEventTimeOffsetKey;
35 extern NSString* const HIDEventTouchesKey;
36 extern NSString* const HIDEventPhaseKey;
37 extern NSString* const HIDEventInterpolateKey;
38 extern NSString* const HIDEventTimestepKey;
39 extern NSString* const HIDEventCoordinateSpaceKey;
40 extern NSString* const HIDEventStartEventKey;
41 extern NSString* const HIDEventEndEventKey;
42 extern NSString* const HIDEventTouchIDKey;
43 extern NSString* const HIDEventPressureKey;
44 extern NSString* const HIDEventXKey;
45 extern NSString* const HIDEventYKey;
46 extern NSString* const HIDEventTwistKey;
47 extern NSString* const HIDEventMajorRadiusKey;
48 extern NSString* const HIDEventMinorRadiusKey;
49
50 // Values for HIDEventInputType.
51 extern NSString* const HIDEventInputTypeHand;
52 extern NSString* const HIDEventInputTypeFinger;
53 extern NSString* const HIDEventInputTypeStylus;
54
55 // Values for HIDEventCoordinateSpaceKey.
56 extern NSString* const HIDEventCoordinateSpaceTypeGlobal;
57 extern NSString* const HIDEventCoordinateSpaceTypeContent;
58
59 extern NSString* const HIDEventInterpolationTypeLinear;
60 extern NSString* const HIDEventInterpolationTypeSimpleCurve;
61
62 // Values for HIDEventPhaseKey.
63 extern NSString* const HIDEventPhaseBegan;
64 extern NSString* const HIDEventPhaseMoved;
65 extern NSString* const HIDEventPhaseEnded;
66 extern NSString* const HIDEventPhaseCanceled;
67
68 // Values for touch counts, etc, to keep debug code in sync
69
70 extern NSUInteger const HIDMaxTouchCount;
71
72 RetainPtr<IOHIDEventRef> createHIDKeyDownEvent(NSString *, uint64_t timestamp);
73
74 @interface HIDEventGenerator : NSObject
75
76 + (HIDEventGenerator *)sharedHIDEventGenerator;
77
78 // Touches
79 - (void)touchDown:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
80 - (void)liftUp:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
81
82 // Stylus
83 - (void)stylusDownAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
84 - (void)stylusMoveToPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
85 - (void)stylusUpAtPoint:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
86 - (void)stylusTapAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
87
88 // Taps
89 - (void)tap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
90 - (void)doubleTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
91 - (void)twoFingerTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
92
93 // Long Press
94 - (void)longPress:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
95
96 // Drags
97 - (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
98
99 // Pinches
100 - (void)pinchCloseWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
101 - (void)pinchOpenWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock;
102
103 // Event stream
104 - (void)sendEventStream:(NSDictionary *)eventInfo completionBlock:(void (^)(void))completionBlock;
105
106 - (void)markerEventReceived:(IOHIDEventRef)event;
107 - (BOOL)checkForOutstandingCallbacks;
108
109 // Keyboard
110 - (void)keyPress:(NSString *)character completionBlock:(void (^)(void))completionBlock;
111
112 @end