From ff84ce5b2591c200ee02cc6ebc3b9f8413a53ccb Mon Sep 17 00:00:00 2001 From: jesswrd Date: Mon, 9 Dec 2024 13:42:19 -0800 Subject: [PATCH] deleted camera test and bumped sdk version --- .../camera/example/android/app/build.gradle | 2 +- .../android/app/src/main/AndroidManifest.xml | 1 + .../example/integration_test/camera_test.dart | 43 --------------- .../example/android/app/build.gradle | 2 +- .../android/app/src/main/AndroidManifest.xml | 1 - .../example/integration_test/camera_test.dart | 47 ---------------- .../example/android/app/build.gradle | 2 +- .../android/app/src/main/AndroidManifest.xml | 1 - .../integration_test/integration_test.dart | 55 ------------------- 9 files changed, 4 insertions(+), 150 deletions(-) diff --git a/packages/camera/camera/example/android/app/build.gradle b/packages/camera/camera/example/android/app/build.gradle index 9e2d6373e872..963b5a4a4ee0 100644 --- a/packages/camera/camera/example/android/app/build.gradle +++ b/packages/camera/camera/example/android/app/build.gradle @@ -32,7 +32,7 @@ android { defaultConfig { applicationId "io.flutter.plugins.cameraexample" minSdkVersion flutter.minSdkVersion - targetSdkVersion 28 + targetSdkVersion 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/packages/camera/camera/example/android/app/src/main/AndroidManifest.xml b/packages/camera/camera/example/android/app/src/main/AndroidManifest.xml index cef23162ddb6..a6879cf032d5 100644 --- a/packages/camera/camera/example/android/app/src/main/AndroidManifest.xml +++ b/packages/camera/camera/example/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ testCaptureImageResolution( - CameraController controller, ResolutionPreset preset) async { - final Size expectedSize = presetExpectedSizes[preset]!; - - // Take Picture - final XFile file = await controller.takePicture(); - - // Load picture - final File fileImage = File(file.path); - final Image image = await decodeImageFromList(fileImage.readAsBytesSync()); - - // Verify image dimensions are as expected - expect(image, isNotNull); - return assertExpectedDimensions( - expectedSize, Size(image.height.toDouble(), image.width.toDouble())); - } - - testWidgets('Capture specific image resolutions', - (WidgetTester tester) async { - final List cameras = await availableCameras(); - if (cameras.isEmpty) { - return; - } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; - for (final MapEntry preset - in presetExpectedSizes.entries) { - final CameraController controller = - CameraController(cameraDescription, preset.key); - await controller.initialize(); - final bool presetExactlySupported = - await testCaptureImageResolution(controller, preset.key); - assert(!(!previousPresetExactlySupported && presetExactlySupported), - 'The camera took higher resolution pictures at a lower resolution.'); - previousPresetExactlySupported = presetExactlySupported; - await controller.dispose(); - } - } - }); - // This tests that the capture is no bigger than the preset, since we have // automatic code to fall back to smaller sizes when we need to. Returns // whether the image is exactly the desired resolution. diff --git a/packages/camera/camera_android/example/android/app/build.gradle b/packages/camera/camera_android/example/android/app/build.gradle index 963b5a4a4ee0..9e2d6373e872 100644 --- a/packages/camera/camera_android/example/android/app/build.gradle +++ b/packages/camera/camera_android/example/android/app/build.gradle @@ -32,7 +32,7 @@ android { defaultConfig { applicationId "io.flutter.plugins.cameraexample" minSdkVersion flutter.minSdkVersion - targetSdkVersion 35 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml index a6879cf032d5..cef23162ddb6 100644 --- a/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml +++ b/packages/camera/camera_android/example/android/app/src/main/AndroidManifest.xml @@ -7,7 +7,6 @@ testCaptureImageResolution( - CameraController controller, ResolutionPreset preset) async { - final Size expectedSize = presetExpectedSizes[preset]!; - - // Take Picture - final XFile file = await controller.takePicture(); - - // Load picture - final File fileImage = File(file.path); - final Image image = await decodeImageFromList(fileImage.readAsBytesSync()); - - // Verify image dimensions are as expected - expect(image, isNotNull); - print(Size(image.height.toDouble(), image.width.toDouble())); - return assertExpectedDimensions( - expectedSize, Size(image.height.toDouble(), image.width.toDouble())); - } - - testWidgets('Capture specific image resolutions', - (WidgetTester tester) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); - if (cameras.isEmpty) { - return; - } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; - for (final MapEntry preset - in presetExpectedSizes.entries) { - print(cameraDescription.lensDirection); - final CameraController controller = CameraController(cameraDescription, - mediaSettings: MediaSettings(resolutionPreset: preset.key)); - await controller.initialize(); - final bool presetExactlySupported = - await testCaptureImageResolution(controller, preset.key); - print(preset.key); - assert(!(!previousPresetExactlySupported && presetExactlySupported), - 'The camera took higher resolution pictures at a lower resolution.'); - previousPresetExactlySupported = presetExactlySupported; - await controller.dispose(); - } - } - }); - // This tests that the capture is no bigger than the preset, since we have // automatic code to fall back to smaller sizes when we need to. Returns // whether the image is exactly the desired resolution. diff --git a/packages/camera/camera_android_camerax/example/android/app/build.gradle b/packages/camera/camera_android_camerax/example/android/app/build.gradle index 7d43d1f6e553..6c71a5b8e547 100644 --- a/packages/camera/camera_android_camerax/example/android/app/build.gradle +++ b/packages/camera/camera_android_camerax/example/android/app/build.gradle @@ -38,7 +38,7 @@ android { defaultConfig { applicationId "io.flutter.plugins.cameraxexample" minSdkVersion flutter.minSdkVersion - targetSdkVersion 35 + targetSdkVersion 28 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/packages/camera/camera_android_camerax/example/android/app/src/main/AndroidManifest.xml b/packages/camera/camera_android_camerax/example/android/app/src/main/AndroidManifest.xml index 1a0da4432332..0428d732d6d1 100644 --- a/packages/camera/camera_android_camerax/example/android/app/src/main/AndroidManifest.xml +++ b/packages/camera/camera_android_camerax/example/android/app/src/main/AndroidManifest.xml @@ -6,7 +6,6 @@ android:icon="@mipmap/ic_launcher"> testCaptureImageResolution( - CameraController controller, ResolutionPreset preset) async { - final Size expectedSize = presetExpectedSizes[preset]!; - - // Take Picture - final XFile file = await controller.takePicture(); - - // Load picture - final File fileImage = File(file.path); - final Image image = await decodeImageFromList(fileImage.readAsBytesSync()); - - // Verify image dimensions are as expected - expect(image, isNotNull); - print(Size(image.height.toDouble(), image.width.toDouble())); - return assertExpectedDimensions( - expectedSize, Size(image.height.toDouble(), image.width.toDouble())); - } - testWidgets('availableCameras only supports valid back or front cameras', (WidgetTester tester) async { final List availableCameras = @@ -79,40 +58,6 @@ void main() { } }); - testWidgets('Capture specific image resolutions', - (WidgetTester tester) async { - final List cameras = - await CameraPlatform.instance.availableCameras(); - if (cameras.isEmpty) { - return; - } - for (final CameraDescription cameraDescription in cameras) { - bool previousPresetExactlySupported = true; - for (final MapEntry preset - in presetExpectedSizes.entries) { - print(cameraDescription.lensDirection); - final CameraController controller = CameraController( - cameraDescription, - mediaSettings: MediaSettings(resolutionPreset: preset.key), - ); - await controller.initialize(); - final bool presetExactlySupported = - await testCaptureImageResolution(controller, preset.key); - // Ensures that if a lower resolution was used for previous (lower) - // resolution preset, then the current (higher) preset also is adjusted, - // as it demands a higher resolution. - - print(preset.key); - expect( - previousPresetExactlySupported || !presetExactlySupported, isTrue, - reason: - 'The camera took higher resolution pictures at a lower resolution.'); - previousPresetExactlySupported = presetExactlySupported; - await controller.dispose(); - } - } - }); - testWidgets('Preview takes expected resolution from preset', (WidgetTester tester) async { final List cameras =