mirror of
https://github.com/encounter/engine.git
synced 2026-07-10 03:18:43 -07:00
669cbba088
Cleanup: Made a macro to assert ARC is enabled (and its inverse).
73 lines
2.9 KiB
Objective-C
73 lines
2.9 KiB
Objective-C
// Copyright 2013 The Flutter Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#import <OCMock/OCMock.h>
|
|
#import <XCTest/XCTest.h>
|
|
#include "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
|
|
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterPluginAppLifeCycleDelegate.h"
|
|
|
|
FLUTTER_ASSERT_ARC
|
|
|
|
@interface FlutterPluginAppLifeCycleDelegateTest : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation FlutterPluginAppLifeCycleDelegateTest
|
|
|
|
- (void)testCreate {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
XCTAssertNotNil(delegate);
|
|
}
|
|
|
|
- (void)testDidEnterBackground {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
|
|
[delegate addDelegate:plugin];
|
|
[[NSNotificationCenter defaultCenter]
|
|
postNotificationName:UIApplicationDidEnterBackgroundNotification
|
|
object:nil];
|
|
OCMVerify([plugin applicationDidEnterBackground:[UIApplication sharedApplication]]);
|
|
}
|
|
|
|
- (void)testWillEnterForeground {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
|
|
[delegate addDelegate:plugin];
|
|
[[NSNotificationCenter defaultCenter]
|
|
postNotificationName:UIApplicationWillEnterForegroundNotification
|
|
object:nil];
|
|
OCMVerify([plugin applicationWillEnterForeground:[UIApplication sharedApplication]]);
|
|
}
|
|
|
|
- (void)testWillResignActive {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
|
|
[delegate addDelegate:plugin];
|
|
[[NSNotificationCenter defaultCenter]
|
|
postNotificationName:UIApplicationWillResignActiveNotification
|
|
object:nil];
|
|
OCMVerify([plugin applicationWillResignActive:[UIApplication sharedApplication]]);
|
|
}
|
|
|
|
- (void)testDidBecomeActive {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
|
|
[delegate addDelegate:plugin];
|
|
[[NSNotificationCenter defaultCenter]
|
|
postNotificationName:UIApplicationDidBecomeActiveNotification
|
|
object:nil];
|
|
OCMVerify([plugin applicationDidBecomeActive:[UIApplication sharedApplication]]);
|
|
}
|
|
|
|
- (void)testWillTerminate {
|
|
FlutterPluginAppLifeCycleDelegate* delegate = [[FlutterPluginAppLifeCycleDelegate alloc] init];
|
|
id plugin = OCMProtocolMock(@protocol(FlutterPlugin));
|
|
[delegate addDelegate:plugin];
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:UIApplicationWillTerminateNotification
|
|
object:nil];
|
|
OCMVerify([plugin applicationWillTerminate:[UIApplication sharedApplication]]);
|
|
}
|
|
|
|
@end
|