2121import android .graphics .Color ;
2222import android .graphics .drawable .ColorDrawable ;
2323import android .net .Uri ;
24+ import android .view .View ;
2425import androidx .annotation .NonNull ;
2526import androidx .lifecycle .Lifecycle ;
2627import io .flutter .FlutterInjector ;
@@ -484,6 +485,7 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
484485 // --- Execute the behavior under test ---
485486 // The FlutterEngine is set up in onAttach().
486487 delegate .onAttach (RuntimeEnvironment .application );
488+ delegate .onCreateView (null , null , null , 0 , true );
487489 // Emulate app start.
488490 delegate .onStart ();
489491
@@ -511,6 +513,7 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
511513 // --- Execute the behavior under test ---
512514 // The FlutterEngine is set up in onAttach().
513515 delegate .onAttach (RuntimeEnvironment .application );
516+ delegate .onCreateView (null , null , null , 0 , true );
514517 // Emulate app start.
515518 delegate .onStart ();
516519
@@ -538,6 +541,7 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
538541 // --- Execute the behavior under test ---
539542 // The FlutterEngine is set up in onAttach().
540543 delegate .onAttach (RuntimeEnvironment .application );
544+ delegate .onCreateView (null , null , null , 0 , true );
541545 // Emulate app start.
542546 delegate .onStart ();
543547
@@ -565,6 +569,7 @@ public void itForwardsOnRequestPermissionsResultToFlutterEngine() {
565569 // --- Execute the behavior under test ---
566570 // The FlutterEngine is set up in onAttach().
567571 delegate .onAttach (RuntimeEnvironment .application );
572+ delegate .onCreateView (null , null , null , 0 , true );
568573 // Emulate app start.
569574 delegate .onStart ();
570575
@@ -590,6 +595,7 @@ public void itSendsdefaultInitialRouteOnStartIfNotDeepLinkingFromIntent() {
590595 // --- Execute the behavior under test ---
591596 // The FlutterEngine is set up in onAttach().
592597 delegate .onAttach (RuntimeEnvironment .application );
598+ delegate .onCreateView (null , null , null , 0 , true );
593599 // Emulate app start.
594600 delegate .onStart ();
595601
@@ -978,6 +984,26 @@ public void itThrowsWhenDelayingTheFirstDrawAndUsingATextureView() {
978984 });
979985 }
980986
987+ @ Test
988+ public void itChangesFlutterViewVisibilityWhenOnStartAndOnStop () {
989+ // ---- Test setup ----
990+ // Create the real object that we're testing.
991+ FlutterActivityAndFragmentDelegate delegate = new FlutterActivityAndFragmentDelegate (mockHost );
992+
993+ // --- Execute the behavior under test ---
994+ delegate .onAttach (RuntimeEnvironment .application );
995+ delegate .onCreateView (null , null , null , 0 , true );
996+ delegate .onStart ();
997+ // Verify that the flutterView is visible.
998+ assertEquals (View .VISIBLE , delegate .flutterView .getVisibility ());
999+ delegate .onStop ();
1000+ // Verify that the flutterView is not visible.
1001+ assertEquals (View .GONE , delegate .flutterView .getVisibility ());
1002+ delegate .onStart ();
1003+ // Verify that the flutterView is visible.
1004+ assertEquals (View .VISIBLE , delegate .flutterView .getVisibility ());
1005+ }
1006+
9811007 @ Test
9821008 public void itDoesNotDelayTheFirstDrawWhenRequestedAndWithAProvidedSplashScreen () {
9831009 when (mockHost .provideSplashScreen ())
0 commit comments