Skip to content

Commit 886e33c

Browse files
[camera] Fix unit test asserting external value (#8814)
A unit test in the app-facing package that predates federation is asserting an expected string that includes constant text that is controlled by a `toString` method from the platform interface package. This fixes the test to only assert the parts that are within the package's control. Unblocks flutter/packages#8723 ## Pre-Review Checklist
1 parent d9792bf commit 886e33c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/camera/camera/test/camera_value_test.dart

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,22 @@ void main() {
146146
description: FakeController.fakeDescription,
147147
);
148148

149-
expect(cameraValue.toString(),
150-
'CameraValue(isRecordingVideo: false, isInitialized: false, errorDescription: null, previewSize: Size(10.0, 10.0), isStreamingImages: false, flashMode: FlashMode.auto, exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, exposurePointSupported: true, focusPointSupported: true, deviceOrientation: DeviceOrientation.portraitUp, lockedCaptureOrientation: DeviceOrientation.portraitUp, recordingOrientation: DeviceOrientation.portraitUp, isPreviewPaused: true, previewPausedOrientation: DeviceOrientation.portraitUp, description: CameraDescription(, CameraLensDirection.back, 0))');
149+
expect(
150+
cameraValue.toString(),
151+
'CameraValue(isRecordingVideo: false, isInitialized: false, '
152+
'errorDescription: null, previewSize: Size(10.0, 10.0), '
153+
'isStreamingImages: false, flashMode: FlashMode.auto, '
154+
'exposureMode: ExposureMode.auto, focusMode: FocusMode.auto, '
155+
'exposurePointSupported: true, focusPointSupported: true, '
156+
'deviceOrientation: DeviceOrientation.portraitUp, '
157+
'lockedCaptureOrientation: DeviceOrientation.portraitUp, '
158+
'recordingOrientation: DeviceOrientation.portraitUp, '
159+
'isPreviewPaused: true, '
160+
'previewPausedOrientation: DeviceOrientation.portraitUp, '
161+
// CameraDescription.toString is defined in the platform interface
162+
// package, so don't assert a specific value for it, only that
163+
// whatever it returns is inserted as expected.
164+
'description: ${FakeController.fakeDescription})');
151165
});
152166
});
153167
}

0 commit comments

Comments
 (0)