Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a931655

Browse files
authored
[camera]skip app delegate during unit test (#4729)
1 parent 9bf1737 commit a931655

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

packages/camera/camera/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Skips unnecessary AppDelegate setup for unit tests on iOS.
4+
15
## 0.9.4+11
26

37
* Manages iOS camera's orientation-related states on a background queue to prevent potential race conditions.

packages/camera/camera/example/ios/Runner/main.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
int main(int argc, char *argv[]) {
1010
@autoreleasepool {
11-
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
11+
// The setup logic in `AppDelegate::didFinishLaunchingWithOptions:` eventually sends camera
12+
// operations on the background queue, which would run concurrently with the test cases during
13+
// unit tests, making the debugging process confusing. This setup is actually not necessary for
14+
// the unit tests, so here we want to skip the AppDelegate when running unit tests.
15+
BOOL isTesting = NSClassFromString(@"XCTestCase") != nil;
16+
return UIApplicationMain(argc, argv, nil,
17+
isTesting ? nil : NSStringFromClass([AppDelegate class]));
1218
}
1319
}

0 commit comments

Comments
 (0)