Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
dea50fc
Only run `initWithCameraName` on background thread.
renefloor Jul 7, 2021
da83b51
run camera start async
renefloor Jul 7, 2021
277d923
Start with migrating to ThreadSafeFlutterResult
renefloor Jul 8, 2021
9bd75bd
Migrated all results to thread safe class
renefloor Jul 9, 2021
a079af9
make data nonNullable
renefloor Jul 9, 2021
bd7d8eb
copyright
renefloor Jul 9, 2021
f0a2bb0
Merge remote-tracking branch 'flutter/master' into bugfix/camera-thre…
renefloor Jul 9, 2021
4125244
Added method channel tests
renefloor Jul 12, 2021
71e321e
Extend unit test
renefloor Jul 13, 2021
bdfde1a
replace dispatch loop with notifications
renefloor Jul 13, 2021
e6b848c
Made test much cleaner
renefloor Jul 13, 2021
d59a80d
add return for error
renefloor Jul 13, 2021
0f35095
changelog and pubspec
renefloor Jul 13, 2021
0b63dea
Add documentation
renefloor Jul 13, 2021
8bc557f
Merge branch 'master' into bugfix/camera-threading
renefloor Jul 13, 2021
b53ab3e
Make interface an extension
renefloor Jul 14, 2021
b6acf82
Increase timeout
renefloor Jul 14, 2021
9f31156
Merge remote-tracking branch 'flutter/master' into bugfix/camera-thre…
renefloor Aug 16, 2021
a4cf79e
update broken test
renefloor Aug 16, 2021
2b84db2
Documentation improvements
renefloor Aug 16, 2021
92c2d00
Make result methods verbs
renefloor Aug 16, 2021
2722cf4
small doc changes
renefloor Aug 16, 2021
4a1155a
remove notification center
renefloor Aug 17, 2021
04566ae
Added unit test for thread safe result
renefloor Aug 17, 2021
57c63ae
add extra comment
renefloor Aug 17, 2021
5c69728
Merge branch 'master' of https://github.com/flutter/plugins into bugf…
mvanbeusekom Oct 8, 2021
e2ba654
Revert removing handleMethodCallAsync.
mvanbeusekom Oct 8, 2021
17d1f5d
Fix unit tests
mvanbeusekom Oct 11, 2021
a0be148
Merge remote-tracking branch 'upstream/master' into bugfix/camera-thr…
mvanbeusekom Oct 11, 2021
ee453bc
Removed left over GIT merge tag
mvanbeusekom Oct 14, 2021
cd48ddd
Applied feedback on PR
mvanbeusekom Oct 14, 2021
98fe08a
Merge remote-tracking branch 'upstream/master' into bugfix/camera-thr…
mvanbeusekom Oct 14, 2021
a4e5262
Remove development team from project file
mvanbeusekom Oct 14, 2021
39d1438
Remove custom setting from XCScheme
mvanbeusekom Oct 14, 2021
3a12cbf
Clean up mock
mvanbeusekom Oct 14, 2021
8e8bdfc
Clean reference to CameraPlugin
mvanbeusekom Oct 14, 2021
3e86910
Apply feedback from PR.
mvanbeusekom Oct 18, 2021
9093887
Merge remote-tracking branch 'upstream/master' into bugfix/camera-thr…
mvanbeusekom Oct 18, 2021
1d51203
Apply review feedback.
mvanbeusekom Oct 18, 2021
f0b9f53
Merge remote-tracking branch 'upstream/master' into bugfix/camera-thr…
mvanbeusekom Oct 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'upstream/master' into bugfix/camera-thr…
…eading
  • Loading branch information
mvanbeusekom committed Oct 18, 2021
commit 9093887a72bcd8f1bed9d95b04abcf16474c5fb4
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ @implementation CameraMethodChannelTests

- (void)testCreate_ShouldCallResultOnMainThread {
CameraPlugin *camera = [[CameraPlugin alloc] initWithRegistry:nil messenger:nil];

XCTestExpectation *expectation =
[[XCTestExpectation alloc] initWithDescription:@"Result finished"];

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

MockFLTThreadSafeFlutterResult *resultObject = [[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];

MockFLTThreadSafeFlutterResult *resultObject =
[[MockFLTThreadSafeFlutterResult alloc] initWithExpectation:expectation];

// Set up method call
FlutterMethodCall *call = [FlutterMethodCall
methodCallWithMethodName:@"create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,25 @@ @implementation CameraOrientationTests
- (void)testOrientationNotifications {
id mockMessenger = OCMProtocolMock(@protocol(FlutterBinaryMessenger));
CameraPlugin *cameraPlugin = [[CameraPlugin alloc] initWithRegistry:nil messenger:mockMessenger];

[mockMessenger setExpectationOrderMatters:YES];

[self rotate:UIDeviceOrientationPortraitUpsideDown expectedChannelOrientation:@"portraitDown" cameraPlugin:cameraPlugin messenger: mockMessenger];
[self rotate:UIDeviceOrientationPortrait expectedChannelOrientation:@"portraitUp" cameraPlugin:cameraPlugin messenger: mockMessenger];
[self rotate:UIDeviceOrientationLandscapeRight expectedChannelOrientation:@"landscapeLeft" cameraPlugin:cameraPlugin messenger: mockMessenger];
[self rotate:UIDeviceOrientationLandscapeLeft expectedChannelOrientation:@"landscapeRight" cameraPlugin:cameraPlugin messenger: mockMessenger];
[self rotate:UIDeviceOrientationPortraitUpsideDown
expectedChannelOrientation:@"portraitDown"
cameraPlugin:cameraPlugin
messenger:mockMessenger];
[self rotate:UIDeviceOrientationPortrait
expectedChannelOrientation:@"portraitUp"
cameraPlugin:cameraPlugin
messenger:mockMessenger];
[self rotate:UIDeviceOrientationLandscapeRight
expectedChannelOrientation:@"landscapeLeft"
cameraPlugin:cameraPlugin
messenger:mockMessenger];
[self rotate:UIDeviceOrientationLandscapeLeft
expectedChannelOrientation:@"landscapeRight"
cameraPlugin:cameraPlugin
messenger:mockMessenger];

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

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

- (void)rotate:(UIDeviceOrientation)deviceOrientation
expectedChannelOrientation:(NSString *)channelOrientation
cameraPlugin: (CameraPlugin *)cameraPlugin
messenger: (NSObject<FlutterBinaryMessenger> *) messenger {

cameraPlugin:(CameraPlugin *)cameraPlugin
messenger:(NSObject<FlutterBinaryMessenger> *)messenger {
XCTestExpectation *orientationExpectation = [self expectationWithDescription:channelOrientation];

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

[cameraPlugin
orientationChanged:[self createMockNotificationForOrientation:deviceOrientation]];
[cameraPlugin orientationChanged:[self createMockNotificationForOrientation:deviceOrientation]];
[self waitForExpectationsWithTimeout:30.0 handler:nil];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ - (void)testPausePreviewWithResult_shouldPausePreview {
- (void)testResumePreviewWithResult_shouldResumePreview {
FLTCam *camera = [[FLTCam alloc] init];
MockFLTThreadSafeFlutterResult *resultObject = [[MockFLTThreadSafeFlutterResult alloc] init];

[camera resumePreviewWithResult:resultObject];
XCTAssertFalse(camera.isPreviewPaused);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
/**
* Initializes the MockFLTThreadSafeFlutterResult with an expectation.
*
* The expectation is fullfilled when a result is called allowing tests to await the result in an asynchronous manner.
* The expectation is fullfilled when a result is called allowing tests to await the result in an
* asynchronous manner.
*/
- (instancetype _Nonnull) initWithExpectation:(nonnull XCTestExpectation *)expectation;
- (instancetype _Nonnull)initWithExpectation:(nonnull XCTestExpectation *)expectation;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nonnull instancetype

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@end

#endif /* MockFLTThreadSafeFlutterResult_h */
2 changes: 1 addition & 1 deletion packages/camera/camera/ios/Classes/CameraPlugin_Test.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/// Exposes the [CameraPlugin handleMethodCallAsync:result:] method for unit testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments on these methods should be normal declaration comments explaining what the method actually does. The "exposed for unit testing" part belongs as a comment on the category itself (where it already is, correctly).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved the documentation as suggested.

///
/// This method should always be dispatched on a background queue to prevent deadlocks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the blank line here please.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

- (void)handleMethodCallAsync:(FlutterMethodCall *)call result:(FLTThreadSafeFlutterResult *)result;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a declaration comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


/// Exposes the [CameraPlugin orientationChanged:] method for unit testing.
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.