@@ -121,6 +121,7 @@ Future<void> main(List<String> args) async {
121121 templatesDir: templatesDir,
122122 xcodeProjectDir: xcodeProjectDir,
123123 xcodeProjectName: xcodeProjectName,
124+ appDir: appDir,
124125 );
125126 testCount++ ;
126127 if (result != 0 ) {
@@ -302,11 +303,13 @@ Future<int> _testNativeApp({
302303 required Directory xcodeProjectDir,
303304 required String deviceId,
304305 required String xcodeProjectName,
306+ required Directory appDir,
305307}) async {
306308 final String resultBundleTemp = Directory .systemTemp
307309 .createTempSync ('flutter_module_test_ios_xcresult.' )
308310 .path;
309311 final String resultBundlePath = path.join (resultBundleTemp, 'result' );
312+ final String derivedDataPath = path.join (appDir.path, 'build' , 'DerivedData' );
310313 final int testResultExit = await exec (
311314 'xcodebuild' ,
312315 < String > [
@@ -318,6 +321,8 @@ Future<int> _testNativeApp({
318321 'Debug' ,
319322 '-destination' ,
320323 'id=$deviceId ' ,
324+ '-derivedDataPath' ,
325+ derivedDataPath,
321326 '-resultBundlePath' ,
322327 resultBundlePath,
323328 'test' ,
@@ -494,6 +499,22 @@ class Scenarios {
494499 r'$PLUGIN_DIR/ios/my_plugin/Sources/my_plugin/MyPlugin.swift' ,
495500 r'$TEMPLATE_DIR/native/UITests-ApplicationEvents-AppNotMigrated.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
496501 },
502+
503+ // Single scene app where FlutterViewController is instantiated with the engine,
504+ // but never added to the scene hierarchy. Engine still receives events automatically.
505+ 'SingleScene-FlutterViewControllerNotAddedToScene' : < String , String > {
506+ ...sharedAppLifecycleFiles,
507+ ...sharedPluginLifecycleFiles,
508+ r'$TEMPLATE_DIR/native/AppDelegate-FlutterAppDelegate-FlutterEngine.swift' :
509+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/AppDelegate.swift' ,
510+ r'$TEMPLATE_DIR/native/SceneDelegate-FlutterSceneDelegate.swift' :
511+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/SceneDelegate.swift' ,
512+ r'$TEMPLATE_DIR/native/ViewController-FlutterEngineFromAppDelegate-FlutterViewControllerNotAdded.swift' :
513+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/ViewController.swift' ,
514+ r'$TEMPLATE_DIR/flutterplugin/ios/LifecyclePlugin-migrated.swift' :
515+ r'$PLUGIN_DIR/ios/my_plugin/Sources/my_plugin/MyPlugin.swift' ,
516+ r'$TEMPLATE_DIR/native/UITests-SceneEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
517+ },
497518 };
498519
499520 late Map <String , Map <String , String >> multiSceneScenarios = < String , Map <String , String >> {
@@ -550,6 +571,42 @@ class Scenarios {
550571 r'$PLUGIN_DIR/ios/my_plugin/Sources/my_plugin/MyPlugin.swift' ,
551572 r'$TEMPLATE_DIR/native/UITests-SceneEvents-NoApplicationEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
552573 },
574+
575+ // Multi scene app where FlutterViewController is never added to the scene hierarchy,
576+ // but the engine is manually registered via registerSceneLifeCycle(with:scene:).
577+ 'MultiSceneEnabled-ManualRegistration-FlutterViewControllerNotAddedToScene' : < String , String > {
578+ ...sharedAppLifecycleFiles,
579+ ...sharedPluginLifecycleFiles,
580+ r'$TEMPLATE_DIR/native/Info-MultiSceneEnabled-NoStoryboard.plist' :
581+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/Info.plist' ,
582+ r'$TEMPLATE_DIR/native/AppDelegate-FlutterAppDelegate.swift' :
583+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/AppDelegate.swift' ,
584+ r'$TEMPLATE_DIR/native/SceneDelegate-FlutterSceneDelegate-MultiScene-FlutterViewControllerNotAdded.swift' :
585+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/SceneDelegate.swift' ,
586+ r'$TEMPLATE_DIR/native/ViewController-FlutterEngineFromSceneDelegate-FlutterViewControllerNotAdded.swift' :
587+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/ViewController.swift' ,
588+ r'$TEMPLATE_DIR/flutterplugin/ios/LifecyclePlugin-migrated.swift' :
589+ r'$PLUGIN_DIR/ios/my_plugin/Sources/my_plugin/MyPlugin.swift' ,
590+ r'$TEMPLATE_DIR/native/UITests-SceneEvents-NoApplicationEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
591+ },
592+
593+ // Multi scene app where FlutterViewController is never added to the scene hierarchy,
594+ // but the engine is manually registered via the legacy registerSceneLifeCycle(with:).
595+ 'MultiSceneEnabled-LegacyManualRegistration-FlutterViewControllerNotAddedToScene' : < String , String > {
596+ ...sharedAppLifecycleFiles,
597+ ...sharedPluginLifecycleFiles,
598+ r'$TEMPLATE_DIR/native/Info-MultiSceneEnabled-NoStoryboard.plist' :
599+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/Info.plist' ,
600+ r'$TEMPLATE_DIR/native/AppDelegate-FlutterAppDelegate.swift' :
601+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/AppDelegate.swift' ,
602+ r'$TEMPLATE_DIR/native/SceneDelegate-FlutterSceneDelegate-MultiScene-LegacyRegistration-FlutterViewControllerNotAdded.swift' :
603+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/SceneDelegate.swift' ,
604+ r'$TEMPLATE_DIR/native/ViewController-FlutterEngineFromSceneDelegate-FlutterViewControllerNotAdded.swift' :
605+ r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/ViewController.swift' ,
606+ r'$TEMPLATE_DIR/flutterplugin/ios/LifecyclePlugin-migrated.swift' :
607+ r'$PLUGIN_DIR/ios/my_plugin/Sources/my_plugin/MyPlugin.swift' ,
608+ r'$TEMPLATE_DIR/native/UITests-SceneEvents-NoApplicationEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
609+ },
553610 };
554611
555612 late Map <String , Map <String , String >> stateRestorationScenarios = < String , Map <String , String >> {
@@ -620,9 +677,8 @@ class Scenarios {
620677
621678 // When using an implicit FlutterEngine, created by the FlutterViewController in another
622679 // ViewController, we expect plugins to be registered after the FlutterViewController is
623- // created, which results in the `application:didFinishLaunchingWithOptions:` and
624- // `scene:willConnectToSession:options:` events being missed. This is not a expected use case
625- // but it could be utilized.
680+ // created, which results in the `application:didFinishLaunchingWithOptions:`. This is not
681+ // ideal, but it is the existing behavior. See: https://github.com/flutter/flutter/issues/186547.
626682 'FlutterImplicitEngineDelegate-AppMigrated-ImplicitFlutterEngine' : < String , String > {
627683 ...sharedAppLifecycleFiles,
628684 ...sharedPluginLifecycleFiles,
@@ -634,7 +690,7 @@ class Scenarios {
634690 r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/AppDelegate.swift' ,
635691 r'$TEMPLATE_DIR/native/ViewController-ImplicitFlutterEngine.swift' :
636692 r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperiment/ViewController.swift' ,
637- r'$TEMPLATE_DIR/native/UITests-SceneEventsNoConnect -NoApplicationEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
693+ r'$TEMPLATE_DIR/native/UITests-SceneEvents -NoApplicationEvents.swift' : r'$XCODE_PROJ_DIR/NativeUIKitSwiftExperimentUITests/NativeUIKitSwiftExperimentUITests.swift' ,
638694 },
639695 };
640696
0 commit comments