Flutter iOS Embedder
FlutterFakeKeyEvents.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERFAKEKEYEVENTS_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERFAKEKEYEVENTS_H_
7 
8 #import <Foundation/Foundation.h>
9 #import <OCMock/OCMock.h>
10 #import <UIKit/UIKit.h>
11 
13 
14 API_AVAILABLE(ios(13.4))
16 - (instancetype)initWithData:(UIPressPhase)phase
17  key:(UIKey*)key
18  type:(UIEventType)type
19  timestamp:(NSTimeInterval)timestamp API_AVAILABLE(ios(13.4));
20 
21 - (UIPressPhase)phase API_AVAILABLE(ios(13.4));
22 - (UIKey*)key API_AVAILABLE(ios(13.4));
23 - (UIEventType)type API_AVAILABLE(ios(13.4));
24 - (NSTimeInterval)timestamp API_AVAILABLE(ios(13.4));
25 
26 @property(nonatomic, readonly) UIPressPhase dataPhase;
27 @property(nonatomic, readonly) UIKey* dataKey;
28 @property(nonatomic, readonly) UIEventType dataType;
29 @property(nonatomic, readonly) NSTimeInterval dataTimestamp;
30 @end
31 
32 API_AVAILABLE(ios(13.4))
33 @interface FakeUIKey : UIKey
34 - (instancetype)initWithData:(UIKeyboardHIDUsage)keyCode
35  modifierFlags:(UIKeyModifierFlags)modifierFlags
36  characters:(NSString*)characters
37  charactersIgnoringModifiers:(NSString*)charactersIgnoringModifiers API_AVAILABLE(ios(13.4));
38 
39 - (UIKeyboardHIDUsage)keyCode;
40 - (UIKeyModifierFlags)modifierFlags;
41 - (NSString*)characters;
42 - (NSString*)charactersIgnoringModifiers;
43 
44 @property(assign, nonatomic) UIKeyboardHIDUsage dataKeyCode;
45 @property(assign, nonatomic) UIKeyModifierFlags dataModifierFlags;
46 @property(readwrite, nonatomic) NSString* dataCharacters;
47 @property(readwrite, nonatomic) NSString* dataCharactersIgnoringModifiers;
48 @end
49 
50 namespace flutter {
51 namespace testing {
52 extern FlutterUIPressProxy* keyDownEvent(UIKeyboardHIDUsage keyCode,
53  UIKeyModifierFlags modifierFlags = 0x0,
54  NSTimeInterval timestamp = 0.0f,
55  const char* characters = "",
56  const char* charactersIgnoringModifiers = "")
57  API_AVAILABLE(ios(13.4));
58 
59 extern FlutterUIPressProxy* keyUpEvent(UIKeyboardHIDUsage keyCode,
60  UIKeyModifierFlags modifierFlags = 0x0,
61  NSTimeInterval timestamp = 0.0f,
62  const char* characters = "",
63  const char* charactersIgnoringModifiers = "")
64  API_AVAILABLE(ios(13.4));
65 
66 extern FlutterUIPressProxy* keyEventWithPhase(UIPressPhase phase,
67  UIKeyboardHIDUsage keyCode,
68  UIKeyModifierFlags modifierFlags = 0x0,
69  NSTimeInterval timestamp = 0.0f,
70  const char* characters = "",
71  const char* charactersIgnoringModifiers = "")
72  API_AVAILABLE(ios(13.4));
73 } // namespace testing
74 } // namespace flutter
75 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERFAKEKEYEVENTS_H_
FakeUIKey::dataCharactersIgnoringModifiers
NSString * dataCharactersIgnoringModifiers
Definition: FlutterFakeKeyEvents.h:47
-[FakeUIKey keyCode]
UIKeyboardHIDUsage keyCode()
FakeUIPressProxy::dataType
UIEventType dataType
Definition: FlutterFakeKeyEvents.h:28
FakeUIPressProxy::dataKey
UIKey * dataKey
Definition: FlutterFakeKeyEvents.h:27
flutter::testing::keyDownEvent
FlutterUIPressProxy * keyDownEvent(UIKeyboardHIDUsage keyCode, UIKeyModifierFlags modifierFlags=0x0, NSTimeInterval timestamp=0.0f, const char *characters="", const char *charactersIgnoringModifiers="") API_AVAILABLE(ios(13.4))
Definition: FlutterFakeKeyEvents.mm:90
FakeUIKey::dataModifierFlags
UIKeyModifierFlags dataModifierFlags
Definition: FlutterFakeKeyEvents.h:45
API_AVAILABLE
UITextSmartQuotesType smartQuotesType API_AVAILABLE(ios(11.0))
flutter::testing::keyEventWithPhase
FlutterUIPressProxy * keyEventWithPhase(UIPressPhase phase, UIKeyboardHIDUsage keyCode, UIKeyModifierFlags modifierFlags=0x0, NSTimeInterval timestamp=0.0f, const char *characters="", const char *charactersIgnoringModifiers="") API_AVAILABLE(ios(13.4))
Definition: FlutterFakeKeyEvents.mm:109
-[FakeUIKey characters]
NSString * characters()
-[FakeUIKey charactersIgnoringModifiers]
NSString * charactersIgnoringModifiers()
flutter
Definition: accessibility_bridge.h:28
FakeUIKey::dataKeyCode
UIKeyboardHIDUsage dataKeyCode
Definition: FlutterFakeKeyEvents.h:44
FakeUIPressProxy
Definition: FlutterFakeKeyEvents.h:15
FlutterUIPressProxy
Definition: FlutterUIPressProxy.h:17
-[FakeUIKey modifierFlags]
UIKeyModifierFlags modifierFlags()
FlutterUIPressProxy.h
FakeUIKey
Definition: FlutterFakeKeyEvents.h:33
FakeUIPressProxy::dataPhase
UIPressPhase dataPhase
Definition: FlutterFakeKeyEvents.h:26
FakeUIKey::dataCharacters
NSString * dataCharacters
Definition: FlutterFakeKeyEvents.h:46
flutter::testing::keyUpEvent
FlutterUIPressProxy * keyUpEvent(UIKeyboardHIDUsage keyCode, UIKeyModifierFlags modifierFlags=0x0, NSTimeInterval timestamp=0.0f, const char *characters="", const char *charactersIgnoringModifiers="") API_AVAILABLE(ios(13.4))
Definition: FlutterFakeKeyEvents.mm:100
FakeUIPressProxy::dataTimestamp
NSTimeInterval dataTimestamp
Definition: FlutterFakeKeyEvents.h:29