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

Commit 9093887

Browse files
committed
Merge remote-tracking branch 'upstream/master' into bugfix/camera-threading
2 parents 3e86910 + 9e46048 commit 9093887

File tree

7 files changed

+36
-21
lines changed

7 files changed

+36
-21
lines changed

packages/camera/camera/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
group 'io.flutter.plugins.camera'
22
version '1.0-SNAPSHOT'
3-
def args = ["-Xlint:deprecation","-Xlint:unchecked","-Werror"]
3+
def args = ["-Xlint:deprecation","-Xlint:unchecked"]
44

55
buildscript {
66
repositories {

packages/camera/camera/example/ios/RunnerTests/CameraMethodChannelTests.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ @implementation CameraMethodChannelTests
1616

1717
- (void)testCreate_ShouldCallResultOnMainThread {
1818
CameraPlugin *camera = [[CameraPlugin alloc] initWithRegistry:nil messenger:nil];
19-
19+
2020
XCTestExpectation *expectation =
2121
[[XCTestExpectation alloc] initWithDescription:@"Result finished"];
2222

@@ -29,8 +29,9 @@ - (void)testCreate_ShouldCallResultOnMainThread {
2929
OCMStub([avCaptureSessionMock alloc]).andReturn(avCaptureSessionMock);
3030
OCMStub([avCaptureSessionMock canSetSessionPreset:[OCMArg any]]).andReturn(YES);
3131

32-
MockFLTThreadSafeFlutterResult *resultObject = [[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];
33-
32+
MockFLTThreadSafeFlutterResult *resultObject =
33+
[[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];
34+
3435
// Set up method call
3536
FlutterMethodCall *call = [FlutterMethodCall
3637
methodCallWithMethodName:@"create"

packages/camera/camera/example/ios/RunnerTests/CameraOrientationTests.m

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,25 @@ @implementation CameraOrientationTests
1717
- (void)testOrientationNotifications {
1818
id mockMessenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
1919
CameraPlugin *cameraPlugin = [[CameraPlugin alloc] initWithRegistry:nil messenger:mockMessenger];
20-
20+
2121
[mockMessenger setExpectationOrderMatters:YES];
2222

23-
[self rotate:UIDeviceOrientationPortraitUpsideDown expectedChannelOrientation:@"portraitDown" cameraPlugin:cameraPlugin messenger: mockMessenger];
24-
[self rotate:UIDeviceOrientationPortrait expectedChannelOrientation:@"portraitUp" cameraPlugin:cameraPlugin messenger: mockMessenger];
25-
[self rotate:UIDeviceOrientationLandscapeRight expectedChannelOrientation:@"landscapeLeft" cameraPlugin:cameraPlugin messenger: mockMessenger];
26-
[self rotate:UIDeviceOrientationLandscapeLeft expectedChannelOrientation:@"landscapeRight" cameraPlugin:cameraPlugin messenger: mockMessenger];
23+
[self rotate:UIDeviceOrientationPortraitUpsideDown
24+
expectedChannelOrientation:@"portraitDown"
25+
cameraPlugin:cameraPlugin
26+
messenger:mockMessenger];
27+
[self rotate:UIDeviceOrientationPortrait
28+
expectedChannelOrientation:@"portraitUp"
29+
cameraPlugin:cameraPlugin
30+
messenger:mockMessenger];
31+
[self rotate:UIDeviceOrientationLandscapeRight
32+
expectedChannelOrientation:@"landscapeLeft"
33+
cameraPlugin:cameraPlugin
34+
messenger:mockMessenger];
35+
[self rotate:UIDeviceOrientationLandscapeLeft
36+
expectedChannelOrientation:@"landscapeRight"
37+
cameraPlugin:cameraPlugin
38+
messenger:mockMessenger];
2739

2840
OCMReject([mockMessenger sendOnChannel:[OCMArg any] message:[OCMArg any]]);
2941

@@ -39,9 +51,8 @@ - (void)testOrientationNotifications {
3951

4052
- (void)rotate:(UIDeviceOrientation)deviceOrientation
4153
expectedChannelOrientation:(NSString *)channelOrientation
42-
cameraPlugin: (CameraPlugin *)cameraPlugin
43-
messenger: (NSObject<FlutterBinaryMessenger> *) messenger {
44-
54+
cameraPlugin:(CameraPlugin *)cameraPlugin
55+
messenger:(NSObject<FlutterBinaryMessenger> *)messenger {
4556
XCTestExpectation *orientationExpectation = [self expectationWithDescription:channelOrientation];
4657

4758
OCMExpect([messenger
@@ -55,8 +66,7 @@ - (void)rotate:(UIDeviceOrientation)deviceOrientation
5566
[methodCall.arguments isEqualToDictionary:@{@"orientation" : channelOrientation}];
5667
}]]);
5768

58-
[cameraPlugin
59-
orientationChanged:[self createMockNotificationForOrientation:deviceOrientation]];
69+
[cameraPlugin orientationChanged:[self createMockNotificationForOrientation:deviceOrientation]];
6070
[self waitForExpectationsWithTimeout:30.0 handler:nil];
6171
}
6272

packages/camera/camera/example/ios/RunnerTests/CameraPreviewPauseTests.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ - (void)testPausePreviewWithResult_shouldPausePreview {
3434
- (void)testResumePreviewWithResult_shouldResumePreview {
3535
FLTCam *camera = [[FLTCam alloc] init];
3636
MockFLTThreadSafeFlutterResult *resultObject = [[MockFLTThreadSafeFlutterResult alloc] init];
37-
37+
3838
[camera resumePreviewWithResult:resultObject];
3939
XCTAssertFalse(camera.isPreviewPaused);
4040
}

packages/camera/camera/example/ios/RunnerTests/MockFLTThreadSafeFlutterResult.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
/**
1717
* Initializes the MockFLTThreadSafeFlutterResult with an expectation.
1818
*
19-
* The expectation is fullfilled when a result is called allowing tests to await the result in an asynchronous manner.
19+
* The expectation is fullfilled when a result is called allowing tests to await the result in an
20+
* asynchronous manner.
2021
*/
21-
- (instancetype _Nonnull) initWithExpectation:(nonnull XCTestExpectation *)expectation;
22+
- (instancetype _Nonnull)initWithExpectation:(nonnull XCTestExpectation *)expectation;
2223
@end
2324

2425
#endif /* MockFLTThreadSafeFlutterResult_h */

packages/camera/camera/ios/Classes/CameraPlugin_Test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/// Exposes the [CameraPlugin handleMethodCallAsync:result:] method for unit testing.
2222
///
2323
/// This method should always be dispatched on a background queue to prevent deadlocks.
24-
24+
2525
- (void)handleMethodCallAsync:(FlutterMethodCall *)call result:(FLTThreadSafeFlutterResult *)result;
2626

2727
/// Exposes the [CameraPlugin orientationChanged:] method for unit testing.

script/tool/lib/src/create_all_plugins_app_command.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ class CreateAllPluginsAppCommand extends PluginCommand {
9393

9494
final StringBuffer newGradle = StringBuffer();
9595
for (final String line in gradleFile.readAsLinesSync()) {
96-
if (line.contains('minSdkVersion 16')) {
97-
// Android SDK 20 is required by Google maps.
98-
// Android SDK 19 is required by WebView.
96+
if (line.contains('minSdkVersion')) {
97+
// minSdkVersion 20 is required by Google maps.
98+
// minSdkVersion 19 is required by WebView.
9999
newGradle.writeln('minSdkVersion 20');
100+
} else if (line.contains('compileSdkVersion')) {
101+
// compileSdkVersion 31 is required by Camera.
102+
newGradle.writeln('compileSdkVersion 31');
100103
} else {
101104
newGradle.writeln(line);
102105
}

0 commit comments

Comments
 (0)