Skip to content
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

[camera] Remove OCMock from AvailableCamerasTests, CameraOrientationTests and ThreadSafeEventChannelTests #8363

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

mchudy
Copy link
Contributor

@mchudy mchudy commented Jan 2, 2025

Follow-up on #8342. This should be merged after #8351

  • Removes OCMock dependency in AvailableCamerasTests.m, CameraOrientationTests.m and ThreadSafeEventChannelTests.m
  • Introduces new protocol wrappers to enable mocking FLTEventChannel and FLTCameraDeviceDiscovering

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

#import "./include/camera_avfoundation/FLTCaptureDeviceControlling.h"

@interface FLTDefaultCaptureDeviceController ()
@property(nonatomic, strong) AVCaptureDevice *device;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we directly have AVCaptureDevice conform to FLTDefaultCaptureDeviceControlling protocol and save this boilerplate in this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, after playing around a bit I found that it is possible do that. I thought in ObjC that would be problematic and wanted to postpone it to the Swift migration (as Swift protocol extensions give much more flexibility). I had to change some other things like abstract AVCaptureInput creation to make this work, but it should be much cleaner now.

@mchudy mchudy requested a review from hellohuanlin January 7, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants