Skip to content

Commit b5958e2

Browse files
authored
[camera, camera_android] Re-enable passing integration tests (flutter#5658)
Re-enables `Capture specific image resolutions` tests that pass, but were previously failing according to flutter#93686.
1 parent 9487874 commit b5958e2

File tree

2 files changed

+43
-51
lines changed

2 files changed

+43
-51
lines changed

packages/camera/camera/example/integration_test/camera_test.dart

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -69,32 +69,28 @@ void main() {
6969
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
7070
}
7171

72-
testWidgets(
73-
'Capture specific image resolutions',
74-
(WidgetTester tester) async {
75-
final List<CameraDescription> cameras = await availableCameras();
76-
if (cameras.isEmpty) {
77-
return;
78-
}
79-
for (final CameraDescription cameraDescription in cameras) {
80-
bool previousPresetExactlySupported = true;
81-
for (final MapEntry<ResolutionPreset, Size> preset
82-
in presetExpectedSizes.entries) {
83-
final CameraController controller =
84-
CameraController(cameraDescription, preset.key);
85-
await controller.initialize();
86-
final bool presetExactlySupported =
87-
await testCaptureImageResolution(controller, preset.key);
88-
assert(!(!previousPresetExactlySupported && presetExactlySupported),
89-
'The camera took higher resolution pictures at a lower resolution.');
90-
previousPresetExactlySupported = presetExactlySupported;
91-
await controller.dispose();
92-
}
72+
testWidgets('Capture specific image resolutions',
73+
(WidgetTester tester) async {
74+
final List<CameraDescription> cameras = await availableCameras();
75+
if (cameras.isEmpty) {
76+
return;
77+
}
78+
for (final CameraDescription cameraDescription in cameras) {
79+
bool previousPresetExactlySupported = true;
80+
for (final MapEntry<ResolutionPreset, Size> preset
81+
in presetExpectedSizes.entries) {
82+
final CameraController controller =
83+
CameraController(cameraDescription, preset.key);
84+
await controller.initialize();
85+
final bool presetExactlySupported =
86+
await testCaptureImageResolution(controller, preset.key);
87+
assert(!(!previousPresetExactlySupported && presetExactlySupported),
88+
'The camera took higher resolution pictures at a lower resolution.');
89+
previousPresetExactlySupported = presetExactlySupported;
90+
await controller.dispose();
9391
}
94-
},
95-
// TODO(egarciad): Fix https://github.com/flutter/flutter/issues/93686.
96-
skip: true,
97-
);
92+
}
93+
});
9894

9995
// This tests that the capture is no bigger than the preset, since we have
10096
// automatic code to fall back to smaller sizes when we need to. Returns

packages/camera/camera_android/example/integration_test/camera_test.dart

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -70,33 +70,29 @@ void main() {
7070
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
7171
}
7272

73-
testWidgets(
74-
'Capture specific image resolutions',
75-
(WidgetTester tester) async {
76-
final List<CameraDescription> cameras =
77-
await CameraPlatform.instance.availableCameras();
78-
if (cameras.isEmpty) {
79-
return;
80-
}
81-
for (final CameraDescription cameraDescription in cameras) {
82-
bool previousPresetExactlySupported = true;
83-
for (final MapEntry<ResolutionPreset, Size> preset
84-
in presetExpectedSizes.entries) {
85-
final CameraController controller =
86-
CameraController(cameraDescription, preset.key);
87-
await controller.initialize();
88-
final bool presetExactlySupported =
89-
await testCaptureImageResolution(controller, preset.key);
90-
assert(!(!previousPresetExactlySupported && presetExactlySupported),
91-
'The camera took higher resolution pictures at a lower resolution.');
92-
previousPresetExactlySupported = presetExactlySupported;
93-
await controller.dispose();
94-
}
73+
testWidgets('Capture specific image resolutions',
74+
(WidgetTester tester) async {
75+
final List<CameraDescription> cameras =
76+
await CameraPlatform.instance.availableCameras();
77+
if (cameras.isEmpty) {
78+
return;
79+
}
80+
for (final CameraDescription cameraDescription in cameras) {
81+
bool previousPresetExactlySupported = true;
82+
for (final MapEntry<ResolutionPreset, Size> preset
83+
in presetExpectedSizes.entries) {
84+
final CameraController controller =
85+
CameraController(cameraDescription, preset.key);
86+
await controller.initialize();
87+
final bool presetExactlySupported =
88+
await testCaptureImageResolution(controller, preset.key);
89+
assert(!(!previousPresetExactlySupported && presetExactlySupported),
90+
'The camera took higher resolution pictures at a lower resolution.');
91+
previousPresetExactlySupported = presetExactlySupported;
92+
await controller.dispose();
9593
}
96-
},
97-
// TODO(egarciad): Fix https://github.com/flutter/flutter/issues/93686.
98-
skip: true,
99-
);
94+
}
95+
});
10096

10197
// This tests that the capture is no bigger than the preset, since we have
10298
// automatic code to fall back to smaller sizes when we need to. Returns

0 commit comments

Comments
 (0)