5#import <Flutter/Flutter.h>
6#import <XCTest/XCTest.h>
20 self.continueAfterFailure = NO;
25 XCTestExpectation* vcDismissed = [
self expectationWithDescription:@"dismiss"];
26 [
self.flutterViewController dismissViewControllerAnimated:NO
28 [vcDismissed fulfill];
30 [
self waitForExpectationsWithTimeout:10.0 handler:nil];
36 XCTestExpectation* firstFrameRendered = [
self expectationWithDescription:@"firstFrameRendered"];
46 XCTestExpectation* displayingFlutterUIExpectation =
47 [
self keyValueObservingExpectationForObject:self.flutterViewController
48 keyPath:@"displayingFlutterUI"
50 displayingFlutterUIExpectation.assertForOverFulfill = YES;
52 [
self.flutterViewController setFlutterViewDidRenderCallback:^{
53 [firstFrameRendered fulfill];
57 UIViewController* rootVC = appDelegate.
window.rootViewController;
58 [rootVC presentViewController:
self.flutterViewController animated:NO completion:nil];
60 [
self waitForExpectationsWithTimeout:30.0 handler:nil];
64 XCTestExpectation* firstFrameRendered = [
self expectationWithDescription:@"firstFrameRendered"];
65 XCTestExpectation* imageRendered = [
self expectationWithDescription:@"imageRendered"];
69 [engine.binaryMessenger
76 [channel invokeMethod:@"set_scenario" arguments:@{@"name" : @"solid_blue"}];
85 [
self.flutterViewController setFlutterViewDidRenderCallback:^{
86 [firstFrameRendered fulfill];
90 UIViewController* rootVC = appDelegate.
window.rootViewController;
91 [rootVC presentViewController:
self.flutterViewController animated:NO completion:nil];
93 CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
98 CGContextRef context =
100 kCGBitmapByteOrder32Little | kCGImageAlphaPremultipliedFirst);
101 [appDelegate.window.layer renderInContext:context];
102 uint32_t* image_data = (uint32_t*)CGBitmapContextGetData(context);
103 if (image_data[20] == 0xFF0000FF) {
104 [imageRendered fulfill];
108 CGContextRelease(context);
110 dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
NSEC_PER_SEC), dispatch_get_main_queue(),
113 dispatch_after(dispatch_time(DISPATCH_TIME_NOW,
NSEC_PER_SEC), dispatch_get_main_queue(),
116 [
self waitForExpectationsWithTimeout:30.0 handler:nil];
118 CGColorSpaceRelease(color_space);
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
BOOL runWithEntrypoint:(nullable NSString *entrypoint)
FlutterBinaryMessengerConnection setMessageHandlerOnChannel:binaryMessageHandler:(NSString *channel, [binaryMessageHandler] FlutterBinaryMessageHandler handler)
instancetype sharedInstance()
instancetype methodChannelWithName:binaryMessenger:codec:(NSString *name,[binaryMessenger] NSObject< FlutterBinaryMessenger > *messenger,[codec] NSObject< FlutterMethodCodec > *codec)
FlutterViewController * flutterViewController
void testFirstFrameCallback()