[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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user