Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Clean up stub methods
  • Loading branch information
mchudy committed Jan 24, 2025
commit cd58a88075dc431c3fdc488626eb1db98cb7bca9
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,9 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, assign) float ISO;

// Configuration Lock
@property(nonatomic, assign) BOOL shouldFailConfiguration;
/// Overrides the default implementation of locking device for configuration.
/// @param error Error pointer to be set if lock fails
@property(nonatomic, copy) void (^lockForConfigurationStub)(NSError **error);
@property(nonatomic, copy) BOOL (^lockForConfigurationStub)(NSError **error);
/// Overrides the default implementation of unlocking device configuration.
@property(nonatomic, copy) void (^unlockForConfigurationStub)(void);

Expand All @@ -97,10 +96,9 @@ NS_ASSUME_NONNULL_BEGIN
@property(nonatomic, copy) void (^setActiveVideoMaxFrameDurationStub)(CMTime duration);

// Input Creation
@property(nonatomic, strong) AVCaptureInput *inputToReturn;
/// Overrides the default implementation of creating capture input.
/// @param error Error pointer to be set if creation fails
@property(nonatomic, copy) void (^createInputStub)(NSError **error);
@property(nonatomic, copy) AVCaptureInput* (^createInputStub)(NSError **error);

@end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ - (void)setExposureMode:(AVCaptureExposureMode)mode {
}

- (void)setExposurePointOfInterest:(CGPoint)point {
_exposurePointOfInterest = point;
if (self.setExposurePointOfInterestStub) {
self.setExposurePointOfInterestStub(point);
}
Expand All @@ -75,14 +74,7 @@ - (void)setVideoZoomFactor:(float)factor {

- (BOOL)lockForConfiguration:(NSError **)error {
if (self.lockForConfigurationStub) {
self.lockForConfigurationStub(error);
return !self.shouldFailConfiguration;
}
if (self.shouldFailConfiguration) {
if (error) {
*error = [NSError errorWithDomain:@"test" code:0 userInfo:nil];
}
return NO;
return self.lockForConfigurationStub(error);
}
return YES;
}
Expand Down Expand Up @@ -111,9 +103,9 @@ - (BOOL)isExposureModeSupported:(AVCaptureExposureMode)mode {

- (AVCaptureInput *)createInput:(NSError *_Nullable *_Nullable)error {
if (self.createInputStub) {
self.createInputStub(error);
return self.createInputStub(error);
}
return self.inputToReturn;
return NULL;
}

@end
Loading