20- (
BOOL)prefersStatusBarHidden {
31- (
BOOL)prefersStatusBarHidden {
38- (
BOOL)application:(UIApplication*)application
39 didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
40 NSArray<NSString*>* processArguments = NSProcessInfo.processInfo.arguments;
41 if ([processArguments containsObject:
@"--enable-software-rendering"]) {
42 @throw @"--enable-software-rendering is unsupported in iOS scenario tests";
45 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
46 if ([processArguments containsObject:
@"--maskview-blocking"]) {
47 self.window.tintColor = UIColor.systemPinkColor;
51 @"--locale-initialization" :
@"locale_initialization",
52 @"--platform-view" :
@"platform_view",
53 @"--platform-view-no-overlay-intersection" :
@"platform_view_no_overlay_intersection",
54 @"--platform-view-two-intersecting-overlays" :
@"platform_view_two_intersecting_overlays",
55 @"--platform-view-partial-intersection" :
@"platform_view_partial_intersection",
56 @"--platform-view-one-overlay-two-intersecting-overlays" :
57 @"platform_view_one_overlay_two_intersecting_overlays",
58 @"--platform-view-multiple-without-overlays" :
@"platform_view_multiple_without_overlays",
59 @"--platform-view-max-overlays" :
@"platform_view_max_overlays",
60 @"--platform-view-surrounding-layers-fractional-coordinate" :
61 @"platform_view_surrounding_layers_fractional_coordinate",
62 @"--platform-view-partial-intersection-fractional-coordinate" :
63 @"platform_view_partial_intersection_fractional_coordinate",
64 @"--platform-view-multiple" :
@"platform_view_multiple",
65 @"--platform-view-multiple-background-foreground" :
66 @"platform_view_multiple_background_foreground",
67 @"--platform-view-cliprect" :
@"platform_view_cliprect",
68 @"--platform-view-cliprect-multiple-clips" :
@"platform_view_cliprect_multiple_clips",
69 @"--platform-view-cliprrect" :
@"platform_view_cliprrect",
70 @"--platform-view-cliprrect-multiple-clips" :
@"platform_view_cliprrect_multiple_clips",
71 @"--platform-view-large-cliprrect" :
@"platform_view_large_cliprrect",
72 @"--platform-view-large-cliprrect-multiple-clips" :
73 @"platform_view_large_cliprrect_multiple_clips",
74 @"--platform-view-clippath" :
@"platform_view_clippath",
75 @"--platform-view-clippath-multiple-clips" :
@"platform_view_clippath_multiple_clips",
76 @"--platform-view-cliprrect-with-transform" :
@"platform_view_cliprrect_with_transform",
77 @"--platform-view-cliprrect-with-transform-multiple-clips" :
78 @"platform_view_cliprrect_with_transform_multiple_clips",
79 @"--platform-view-large-cliprrect-with-transform" :
80 @"platform_view_large_cliprrect_with_transform",
81 @"--platform-view-large-cliprrect-with-transform-multiple-clips" :
82 @"platform_view_large_cliprrect_with_transform_multiple_clips",
83 @"--platform-view-cliprect-with-transform" :
@"platform_view_cliprect_with_transform",
84 @"--platform-view-cliprect-with-transform-multiple-clips" :
85 @"platform_view_cliprect_with_transform_multiple_clips",
86 @"--platform-view-clippath-with-transform" :
@"platform_view_clippath_with_transform",
87 @"--platform-view-clippath-with-transform-multiple-clips" :
88 @"platform_view_clippath_with_transform_multiple_clips",
89 @"--platform-view-transform" :
@"platform_view_transform",
90 @"--platform-view-opacity" :
@"platform_view_opacity",
91 @"--platform-view-with-other-backdrop-filter" :
@"platform_view_with_other_backdrop_filter",
92 @"--two-platform-views-with-other-backdrop-filter" :
93 @"two_platform_views_with_other_backdrop_filter",
94 @"--platform-view-with-negative-backdrop-filter" :
95 @"platform_view_with_negative_backdrop_filter",
96 @"--platform-view-rotate" :
@"platform_view_rotate",
97 @"--non-full-screen-flutter-view-platform-view" :
@"non_full_screen_flutter_view_platform_view",
98 @"--gesture-reject-after-touches-ended" :
@"platform_view_gesture_reject_after_touches_ended",
99 @"--gesture-reject-eager" :
@"platform_view_gesture_reject_eager",
100 @"--gesture-accept" :
@"platform_view_gesture_accept",
101 @"--gesture-accept-with-overlapping-platform-views" :
102 @"platform_view_gesture_accept_with_overlapping_platform_views",
103 @"--tap-status-bar" :
@"tap_status_bar",
104 @"--animated-color-square" :
@"animated_color_square",
105 @"--solid-blue" :
@"solid_blue",
106 @"--platform-view-with-continuous-texture" :
@"platform_view_with_continuous_texture",
107 @"--bogus-font-text" :
@"bogus_font_text",
108 @"--spawn-engine-works" :
@"spawn_engine_works",
109 @"--pointer-events" :
@"pointer_events",
110 @"--platform-view-scrolling-under-widget" :
@"platform_view_scrolling_under_widget",
111 @"--platform-views-with-clips-scrolling" :
@"platform_views_with_clips_scrolling",
112 @"--platform-views-with-clips-scrolling-multiple-clips" :
113 @"platform_views_with_clips_scrolling_multiple_clips",
114 @"--platform-view-cliprect-after-moved" :
@"platform_view_cliprect_after_moved",
115 @"--platform-view-cliprect-after-moved-multiple-clips" :
116 @"platform_view_cliprect_after_moved_multiple_clips",
117 @"--two-platform-view-clip-rect" :
@"two_platform_view_clip_rect",
118 @"--two-platform-view-clip-rect-multiple-clips" :
@"two_platform_view_clip_rect_multiple_clips",
119 @"--two-platform-view-clip-rrect" :
@"two_platform_view_clip_rrect",
120 @"--two-platform-view-clip-rrect-multiple-clips" :
121 @"two_platform_view_clip_rrect_multiple_clips",
122 @"--two-platform-view-clip-path" :
@"two_platform_view_clip_path",
123 @"--two-platform-view-clip-path-multiple-clips" :
@"two_platform_view_clip_path_multiple_clips",
124 @"--darwin-system-font" :
@"darwin_system_font",
126 __block NSString* flutterViewControllerTestName = nil;
128 enumerateKeysAndObjectsUsingBlock:^(NSString* argument, NSString* testName, BOOL* stop) {
129 if ([processArguments containsObject:argument]) {
130 flutterViewControllerTestName = testName;
134 if (flutterViewControllerTestName) {
135 [
self setupFlutterViewControllerTest:flutterViewControllerTestName];
136 }
else if ([processArguments containsObject:
@"--screen-before-flutter"]) {
137 self.window.rootViewController = [[
ScreenBeforeFlutter alloc] initWithEngineRunCompletion:nil];
139 self.window.rootViewController = [[UIViewController alloc] init];
142 [
self.window makeKeyAndVisible];
143 if ([processArguments containsObject:
@"--with-continuous-texture"]) {
147 return [
super application:application didFinishLaunchingWithOptions:launchOptions];
150- (
FlutterEngine*)engineForTest:(NSString*)scenarioIdentifier {
151 if ([scenarioIdentifier isEqualToString:
@"spawn_engine_works"]) {
166 if ([scenarioIdentifier isEqualToString:
@"tap_status_bar"]) {
173- (void)setupFlutterViewControllerTest:(NSString*)scenarioIdentifier {
176 [
self flutterViewControllerForTest:scenarioIdentifier withEngine:engine];
177 flutterViewController.view.accessibilityIdentifier =
@"flutter_view";
179 [engine.binaryMessenger
180 setMessageHandlerOnChannel:@"waiting_for_status"
181 binaryMessageHandler:^(NSData* _Nullable message, FlutterBinaryReply _Nonnull reply) {
186 [channel invokeMethod:@"set_scenario" arguments:@{@"name" : scenarioIdentifier}];
189 [engine.binaryMessenger
190 setMessageHandlerOnChannel:@"display_data"
191 binaryMessageHandler:^(NSData* _Nullable message, FlutterBinaryReply _Nonnull reply) {
192 NSDictionary* dict = [NSJSONSerialization JSONObjectWithData:message
195 UITextField* text = [[UITextField alloc] initWithFrame:CGRectMake(0, 400, 300, 100)];
196 text.text = dict[@"data"];
197 [flutterViewController.view addSubview:text];
202 NSObject<FlutterPluginRegistrar>* registrar =
204 [registrar registerViewFactory:textPlatformViewFactory
205 withId:@"scenarios/textPlatformView"
206 gestureRecognizersBlockingPolicy:FlutterPlatformViewGestureRecognizersBlockingPolicyEager];
207 [registrar registerViewFactory:textPlatformViewFactory
208 withId:@"scenarios/textPlatformView_blockPolicyUntilTouchesEnded"
209 gestureRecognizersBlockingPolicy:
210 FlutterPlatformViewGestureRecognizersBlockingPolicyWaitUntilTouchesEnded];
212 UIViewController* rootViewController = flutterViewController;
214 if ([scenarioIdentifier isEqualToString:
@"non_full_screen_flutter_view_platform_view"]) {
216 [rootViewController.view addSubview:flutterViewController.view];
217 flutterViewController.view.frame = CGRectMake(150, 150, 500, 500);
220 self.window.rootViewController = rootViewController;
NS_ASSUME_NONNULL_BEGIN NSDictionary * launchArgsMap
FlutterEngine * spawnWithEntrypoint:libraryURI:initialRoute:entrypointArgs:(nullable NSString *entrypoint,[libraryURI] nullable NSString *libraryURI,[initialRoute] nullable NSString *initialRoute,[entrypointArgs] nullable NSArray< NSString * > *entrypointArgs)
instancetype methodChannelWithName:binaryMessenger:codec:(NSString *name,[binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger,[codec] NSObject< FlutterMethodCodec > *codec)
void registerWithRegistrar:(NSObject< FlutterPluginRegistrar > *registrar)
nullable NSObject< FlutterPluginRegistrar > * registrarForPlugin:(NSString *pluginKey)