From 0a2943e745daf0b11ce626aac1b2ed9fe2ecd134 Mon Sep 17 00:00:00 2001 From: Christoph Deil Date: Fri, 13 Mar 2026 08:21:19 +0100 Subject: [PATCH] [camera_avfoundation] Remove unused Objective-C testing files --- .../ios/Runner.xcodeproj/project.pbxproj | 10 -------- .../ios/RunnerTests/ExceptionCatcher.h | 23 ------------------- .../ios/RunnerTests/ExceptionCatcher.m | 17 -------------- .../Mocks/MockCaptureDeviceInputFactory.swift | 2 ++ .../Mocks/MockFrameRateRange.swift | 2 ++ .../RunnerTests/Mocks/MockWritableData.swift | 2 ++ .../RunnerTests/RunnerTests-Bridging-Header.h | 5 ---- 7 files changed, 6 insertions(+), 55 deletions(-) delete mode 100644 packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.h delete mode 100644 packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.m delete mode 100644 packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h diff --git a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj index 0345270bc947..bf4447ef595a 100644 --- a/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/camera/camera_avfoundation/example/ios/Runner.xcodeproj/project.pbxproj @@ -22,7 +22,6 @@ 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 978D90B42D5F630300CD817E /* StreamingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 978D90B32D5F630300CD817E /* StreamingTests.swift */; }; 97922B0D2D6380C300A9B4CF /* SampleBufferTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 97922B0C2D6380C300A9B4CF /* SampleBufferTests.swift */; }; - 979B3DFB2D5B6BC7009BDE1A /* ExceptionCatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 979B3DFA2D5B6BC7009BDE1A /* ExceptionCatcher.m */; }; 979B3DFE2D5B985B009BDE1A /* CameraInitRaceConditionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979B3DFD2D5B985B009BDE1A /* CameraInitRaceConditionsTests.swift */; }; 979B3E002D5B9E6C009BDE1A /* CameraMethodChannelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979B3DFF2D5B9E6C009BDE1A /* CameraMethodChannelTests.swift */; }; 979B3E022D5BA48F009BDE1A /* CameraOrientationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 979B3E012D5BA48F009BDE1A /* CameraOrientationTests.swift */; }; @@ -110,9 +109,6 @@ 978296CE2D5F744B0009BDD3 /* PhotoCaptureTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoCaptureTests.swift; sourceTree = ""; }; 978D90B32D5F630300CD817E /* StreamingTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StreamingTests.swift; sourceTree = ""; }; 97922B0C2D6380C300A9B4CF /* SampleBufferTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleBufferTests.swift; sourceTree = ""; }; - 979B3DF92D5B6BA2009BDE1A /* ExceptionCatcher.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExceptionCatcher.h; sourceTree = ""; }; - 979B3DFA2D5B6BC7009BDE1A /* ExceptionCatcher.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExceptionCatcher.m; sourceTree = ""; }; - 979B3DFC2D5B985B009BDE1A /* RunnerTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RunnerTests-Bridging-Header.h"; sourceTree = ""; }; 979B3DFD2D5B985B009BDE1A /* CameraInitRaceConditionsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraInitRaceConditionsTests.swift; sourceTree = ""; }; 979B3DFF2D5B9E6C009BDE1A /* CameraMethodChannelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraMethodChannelTests.swift; sourceTree = ""; }; 979B3E012D5BA48F009BDE1A /* CameraOrientationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraOrientationTests.swift; sourceTree = ""; }; @@ -187,9 +183,6 @@ 7F29EB3F2D281C6D00740257 /* Mocks */, 03BB766C2665316900CE5A93 /* Info.plist */, E142681E2D8566230046CBBC /* CameraTestUtils.swift */, - 979B3DF92D5B6BA2009BDE1A /* ExceptionCatcher.h */, - 979B3DFA2D5B6BC7009BDE1A /* ExceptionCatcher.m */, - 979B3DFC2D5B985B009BDE1A /* RunnerTests-Bridging-Header.h */, 979B3DFD2D5B985B009BDE1A /* CameraInitRaceConditionsTests.swift */, 979B3DFF2D5B9E6C009BDE1A /* CameraMethodChannelTests.swift */, 979B3E012D5BA48F009BDE1A /* CameraOrientationTests.swift */, @@ -520,7 +513,6 @@ 972CA92D2D5A28C4004B846F /* QueueUtilsTests.swift in Sources */, E1FFEAB12D6CDE5B00B14107 /* CameraPluginInitializeCameraTests.swift in Sources */, E142F1362D8587F900824824 /* MockCameraDeviceDiscoverer.swift in Sources */, - 979B3DFB2D5B6BC7009BDE1A /* ExceptionCatcher.m in Sources */, E1ABED6E2D94392900AED9CC /* MockAssetWriterInputPixelBufferAdaptor.swift in Sources */, E1ABED6C2D94392500AED9CC /* MockAssetWriter.swift in Sources */, E1A5F4E32D80259C0005BA64 /* FLTCamSetFlashModeTests.swift in Sources */, @@ -626,7 +618,6 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.cameraExample.camera-exampleTests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "RunnerTests/RunnerTests-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; @@ -658,7 +649,6 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = "dev.flutter.plugins.cameraExample.camera-exampleTests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_OBJC_BRIDGING_HEADER = "RunnerTests/RunnerTests-Bridging-Header.h"; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner"; diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.h b/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.h deleted file mode 100644 index 4c7ae95dac32..000000000000 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// TODO(FirentisTFW): Remove this file when the plugin code that uses it is migrated to Swift. -// After the migration, the code should throw Swift errors instead of Objective-C exceptions, thus -// this file will not be needed. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/// A utility class for catching Objective-C exceptions. -/// -/// It allows to execute a block of code and catch any exceptions that are thrown during its -/// execution. This is useful for bridging between Objective-C and Swift code, as Swift does not -/// support catching Objective-C exceptions directly. -@interface ExceptionCatcher : NSObject -/// Executes a block of code and catches any exceptions that are thrown. -+ (nullable NSException *)catchException:(void (^)(void))tryBlock; -@end - -NS_ASSUME_NONNULL_END diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.m b/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.m deleted file mode 100644 index febd9ac4f79d..000000000000 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/ExceptionCatcher.m +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "ExceptionCatcher.h" - -@implementation ExceptionCatcher -+ (nullable NSException *)catchException:(void (^)(void))tryBlock { - @try { - tryBlock(); - // No exception occurred. - return nil; - } @catch (NSException *exception) { - return exception; - } -} -@end diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift index 9292b6256d7c..27925da75c0a 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCaptureDeviceInputFactory.swift @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Foundation + @testable import camera_avfoundation ///// A mocked implementation of FLTCaptureDeviceInputFactory which allows injecting a custom diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift index 1130a35937e7..d4bfbda30385 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockFrameRateRange.swift @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Foundation + @testable import camera_avfoundation /// A mock implementation of `FrameRateRange` that allows mocking the class properties. diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift index 9feb13e3f997..8666c4d96093 100644 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift +++ b/packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockWritableData.swift @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import Foundation + @testable import camera_avfoundation /// A mock implementation of `WritableData` that allows injecting a custom implementation diff --git a/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h b/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h deleted file mode 100644 index 5b3a1852fb82..000000000000 --- a/packages/camera/camera_avfoundation/example/ios/RunnerTests/RunnerTests-Bridging-Header.h +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright 2013 The Flutter Authors -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "ExceptionCatcher.h"