Skip to content

Commit 70b41e1

Browse files
authored
[camera_avfoundation] Migrate tests to Swift - part 3 (#8661)
This PR migrates some of Objective-C tests to Swift as a part of Swift migration: [flutter/flutter/issues/119109](flutter/flutter#119109). I kept the names of test cases the same. Tests migrated in this PR: - PhotoCaptureTests - SampleBufferTests - StramingTests - ThreadSafeEventChannelTests I also migrated two Mock classes to Swift, but I think that for most of mocks it'd be easier to migrate them when migrating the actual implementation to Swift.
1 parent 043e804 commit 70b41e1

20 files changed

+756
-925
lines changed

packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 27 additions & 34 deletions
Large diffs are not rendered by default.

packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ extern CMSampleBufferRef FLTCreateTestSampleBuffer(void);
3030
/// @return a test audio sample buffer.
3131
extern CMSampleBufferRef FLTCreateTestAudioSampleBuffer(void);
3232

33+
/// Calls `dispatch_queue_set_specific` with a key that is used to identify the queue.
34+
/// This method is needed for comaptibility of Swift tests with Objective-C code.
35+
/// In Swift, the API for settinng key-value pairs on a queue is different, so Swift tests
36+
/// need to call this method to set the key-value pair on the queue in a way that's
37+
/// compatible withn the existing Objective-C code.
38+
extern void FLTdispatchQueueSetSpecific(dispatch_queue_t queue, const void *key);
39+
3340
NS_ASSUME_NONNULL_END

packages/camera/camera_avfoundation/example/ios/RunnerTests/CameraTestUtils.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,7 @@ CMSampleBufferRef FLTCreateTestAudioSampleBuffer(void) {
127127
CFRelease(formatDescription);
128128
return sampleBuffer;
129129
}
130+
131+
void FLTdispatchQueueSetSpecific(dispatch_queue_t queue, const void *key) {
132+
dispatch_queue_set_specific(queue, key, (void *)key, NULL);
133+
}

packages/camera/camera_avfoundation/example/ios/RunnerTests/FLTCamPhotoCaptureTests.m

Lines changed: 0 additions & 216 deletions
This file was deleted.

0 commit comments

Comments
 (0)