[ios] scenario test make parent view controller hide status bar (flutter/engine#46065)

The parent view controller of FlutterViewController in `non_full_screen_flutter_view_platform_view` does not explicitly set the status bar hidden. iOS 17 will show the status bar causing the golden to be no deterministic. 

Part of https://github.com/flutter/flutter/issues/133207

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
Chris Yang
2023-09-19 14:23:16 -07:00
committed by GitHub
parent f98560e895
commit 2b2092a781

View File

@@ -9,6 +9,20 @@
#import "ScreenBeforeFlutter.h"
#import "TextPlatformView.h"
// A UIViewController that sets YES for its preferedStatusBarHidden property.
// StatusBar includes current time, which is non-deterministic. This ViewController
// removes the StatusBar to make the screenshot deterministic.
@interface NoStatusBarViewController : UIViewController
@end
@implementation NoStatusBarViewController
- (BOOL)prefersStatusBarHidden {
return YES;
}
@end
// The FlutterViewController version of NoStatusBarViewController
@interface NoStatusBarFlutterViewController : FlutterViewController
@end
@@ -166,7 +180,7 @@
UIViewController* rootViewController = flutterViewController;
// Make Flutter View's origin x/y not 0.
if ([scenarioIdentifier isEqualToString:@"non_full_screen_flutter_view_platform_view"]) {
rootViewController = [UIViewController new];
rootViewController = [[NoStatusBarViewController alloc] init];
[rootViewController.view addSubview:flutterViewController.view];
flutterViewController.view.frame = CGRectMake(150, 150, 500, 500);
}