mirror of
https://github.com/flutter/packages.git
synced 2025-07-09 13:46:19 +08:00
[camera, camera_android] Re-enable passing integration tests (#5658)
Re-enables `Capture specific image resolutions` tests that pass, but were previously failing according to https://github.com/flutter/flutter/issues/93686.
This commit is contained in:
packages/camera
camera/example/integration_test
camera_android/example/integration_test
@ -69,32 +69,28 @@ void main() {
|
|||||||
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
|
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('Capture specific image resolutions',
|
||||||
'Capture specific image resolutions',
|
(WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
final List<CameraDescription> cameras = await availableCameras();
|
||||||
final List<CameraDescription> cameras = await availableCameras();
|
if (cameras.isEmpty) {
|
||||||
if (cameras.isEmpty) {
|
return;
|
||||||
return;
|
}
|
||||||
|
for (final CameraDescription cameraDescription in cameras) {
|
||||||
|
bool previousPresetExactlySupported = true;
|
||||||
|
for (final MapEntry<ResolutionPreset, Size> 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();
|
||||||
}
|
}
|
||||||
for (final CameraDescription cameraDescription in cameras) {
|
}
|
||||||
bool previousPresetExactlySupported = true;
|
});
|
||||||
for (final MapEntry<ResolutionPreset, Size> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TODO(egarciad): Fix https://github.com/flutter/flutter/issues/93686.
|
|
||||||
skip: true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// This tests that the capture is no bigger than the preset, since we have
|
// 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
|
// automatic code to fall back to smaller sizes when we need to. Returns
|
||||||
|
@ -70,33 +70,29 @@ void main() {
|
|||||||
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
|
expectedSize, Size(image.height.toDouble(), image.width.toDouble()));
|
||||||
}
|
}
|
||||||
|
|
||||||
testWidgets(
|
testWidgets('Capture specific image resolutions',
|
||||||
'Capture specific image resolutions',
|
(WidgetTester tester) async {
|
||||||
(WidgetTester tester) async {
|
final List<CameraDescription> cameras =
|
||||||
final List<CameraDescription> cameras =
|
await CameraPlatform.instance.availableCameras();
|
||||||
await CameraPlatform.instance.availableCameras();
|
if (cameras.isEmpty) {
|
||||||
if (cameras.isEmpty) {
|
return;
|
||||||
return;
|
}
|
||||||
|
for (final CameraDescription cameraDescription in cameras) {
|
||||||
|
bool previousPresetExactlySupported = true;
|
||||||
|
for (final MapEntry<ResolutionPreset, Size> 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();
|
||||||
}
|
}
|
||||||
for (final CameraDescription cameraDescription in cameras) {
|
}
|
||||||
bool previousPresetExactlySupported = true;
|
});
|
||||||
for (final MapEntry<ResolutionPreset, Size> 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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// TODO(egarciad): Fix https://github.com/flutter/flutter/issues/93686.
|
|
||||||
skip: true,
|
|
||||||
);
|
|
||||||
|
|
||||||
// This tests that the capture is no bigger than the preset, since we have
|
// 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
|
// automatic code to fall back to smaller sizes when we need to. Returns
|
||||||
|
Reference in New Issue
Block a user