-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[camera] Remove @throw
from iOS implementation
#5034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ - (void)testFLTGetFLTFlashModeForString { | |
XCTAssertEqual(FLTFlashModeAuto, FLTGetFLTFlashModeForString(@"auto")); | ||
XCTAssertEqual(FLTFlashModeAlways, FLTGetFLTFlashModeForString(@"always")); | ||
XCTAssertEqual(FLTFlashModeTorch, FLTGetFLTFlashModeForString(@"torch")); | ||
XCTAssertThrows(FLTGetFLTFlashModeForString(@"unkwown")); | ||
XCTAssertEqual(FLTFlashModeInvalid, FLTGetFLTFlashModeForString(@"unknown")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: should it be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we have a new flash mode in the future then we need to update both the Dart and Obj-C code at the same time. This code is purely for manual platform channel conversions, which means the only way to get a value we don't recognize is if someone adds serialization for that mode on the Dart side but not the corresponding deserialization code on the native side, which would make no sense. If we have flash modes that the Dart side of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (This is why Pigeon will moot all of this; in Pigeon it's impossible for an enum value defined in the interface to exist on one side but not the other.) |
||
} | ||
|
||
- (void)testFLTGetAVCaptureFlashModeForFLTFlashMode { | ||
|
@@ -34,27 +34,27 @@ - (void)testFLTGetAVCaptureFlashModeForFLTFlashMode { | |
- (void)testFLTGetStringForFLTExposureMode { | ||
XCTAssertEqualObjects(@"auto", FLTGetStringForFLTExposureMode(FLTExposureModeAuto)); | ||
XCTAssertEqualObjects(@"locked", FLTGetStringForFLTExposureMode(FLTExposureModeLocked)); | ||
XCTAssertThrows(FLTGetStringForFLTExposureMode(-1)); | ||
XCTAssertNil(FLTGetStringForFLTExposureMode(-1)); | ||
} | ||
|
||
- (void)testFLTGetFLTExposureModeForString { | ||
XCTAssertEqual(FLTExposureModeAuto, FLTGetFLTExposureModeForString(@"auto")); | ||
XCTAssertEqual(FLTExposureModeLocked, FLTGetFLTExposureModeForString(@"locked")); | ||
XCTAssertThrows(FLTGetFLTExposureModeForString(@"unknown")); | ||
XCTAssertEqual(FLTExposureModeInvalid, FLTGetFLTExposureModeForString(@"unknown")); | ||
} | ||
|
||
#pragma mark - focus mode tests | ||
|
||
- (void)testFLTGetStringForFLTFocusMode { | ||
XCTAssertEqualObjects(@"auto", FLTGetStringForFLTFocusMode(FLTFocusModeAuto)); | ||
XCTAssertEqualObjects(@"locked", FLTGetStringForFLTFocusMode(FLTFocusModeLocked)); | ||
XCTAssertThrows(FLTGetStringForFLTFocusMode(-1)); | ||
XCTAssertNil(FLTGetStringForFLTFocusMode(-1)); | ||
} | ||
|
||
- (void)testFLTGetFLTFocusModeForString { | ||
XCTAssertEqual(FLTFocusModeAuto, FLTGetFLTFocusModeForString(@"auto")); | ||
XCTAssertEqual(FLTFocusModeLocked, FLTGetFLTFocusModeForString(@"locked")); | ||
XCTAssertThrows(FLTGetFLTFocusModeForString(@"unknown")); | ||
XCTAssertEqual(FLTFocusModeInvalid, FLTGetFLTFocusModeForString(@"unknown")); | ||
} | ||
|
||
#pragma mark - resolution preset tests | ||
|
@@ -67,7 +67,7 @@ - (void)testFLTGetFLTResolutionPresetForString { | |
XCTAssertEqual(FLTResolutionPresetVeryHigh, FLTGetFLTResolutionPresetForString(@"veryHigh")); | ||
XCTAssertEqual(FLTResolutionPresetUltraHigh, FLTGetFLTResolutionPresetForString(@"ultraHigh")); | ||
XCTAssertEqual(FLTResolutionPresetMax, FLTGetFLTResolutionPresetForString(@"max")); | ||
XCTAssertThrows(FLTGetFLTFlashModeForString(@"unknown")); | ||
XCTAssertEqual(FLTResolutionPresetInvalid, FLTGetFLTResolutionPresetForString(@"unknown")); | ||
} | ||
|
||
#pragma mark - video format tests | ||
|
@@ -89,7 +89,7 @@ - (void)testFLTGetUIDeviceOrientationForString { | |
XCTAssertEqual(UIDeviceOrientationLandscapeLeft, | ||
FLTGetUIDeviceOrientationForString(@"landscapeRight")); | ||
XCTAssertEqual(UIDeviceOrientationPortrait, FLTGetUIDeviceOrientationForString(@"portraitUp")); | ||
XCTAssertThrows(FLTGetUIDeviceOrientationForString(@"unknown")); | ||
XCTAssertEqual(UIDeviceOrientationUnknown, FLTGetUIDeviceOrientationForString(@"unknown")); | ||
} | ||
|
||
- (void)testFLTGetStringForUIDeviceOrientation { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: ... cause crashes on launch on iOS 17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I unfortunately don't know if it's "on iOS 17" or "when compiled against the iOS 17 SDK" or some other slight variant of that, which is why I left it vague.