Skip to content

Commit

Permalink
[camera_avfoundation] Migrate tests to Swift - part 3 (#8661)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
FirentisTFW authored Feb 28, 2025
1 parent 043e804 commit 70b41e1
Show file tree
Hide file tree
Showing 20 changed files with 756 additions and 925 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ extern CMSampleBufferRef FLTCreateTestSampleBuffer(void);
/// @return a test audio sample buffer.
extern CMSampleBufferRef FLTCreateTestAudioSampleBuffer(void);

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

NS_ASSUME_NONNULL_END
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,7 @@ CMSampleBufferRef FLTCreateTestAudioSampleBuffer(void) {
CFRelease(formatDescription);
return sampleBuffer;
}

void FLTdispatchQueueSetSpecific(dispatch_queue_t queue, const void *key) {
dispatch_queue_set_specific(queue, key, (void *)key, NULL);
}

This file was deleted.

Loading

0 comments on commit 70b41e1

Please sign in to comment.