[iOS] Ensure FlutterView's background color is not nil to avoid CAMetalLayer nextDrawable being time-consuming (flutter/engine#39359)
* ++ * Add tests * ++
This commit is contained in:
@@ -47,6 +47,12 @@
|
||||
if (self) {
|
||||
_delegate = delegate;
|
||||
self.layer.opaque = opaque;
|
||||
|
||||
// This line is necessary. CoreAnimation(or UIKit) may take this to do
|
||||
// something to compute the final frame presented on screen, if we don't set this,
|
||||
// it will make it take long time for us to take next CAMetalDrawable and will
|
||||
// cause constant junk during rendering.
|
||||
self.backgroundColor = UIColor.clearColor;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -49,4 +49,10 @@
|
||||
XCTAssertTrue(delegate.callbackCalled);
|
||||
}
|
||||
|
||||
- (void)testFlutterViewBackgroundColorIsNotNil {
|
||||
FakeDelegate* delegate = [[FakeDelegate alloc] init];
|
||||
FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO];
|
||||
XCTAssertNotNil(view.backgroundColor);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user