Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix tests + bump version
  • Loading branch information
camsim99 committed May 9, 2025
commit 1351c201fa25e7ae9ffeac9f94349c8a731f51df
5 changes: 5 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.6.17

* Fixes incorrect camera preview mirroring for front cameras of devices using the `ImageReader`
Impeller backend.

## 0.6.16

* Fixes incorrect camera preview rotation for landscape-oriented devices.
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android_camerax/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: camera_android_camerax
description: Android implementation of the camera plugin using the CameraX library.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android_camerax
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.6.16
version: 0.6.17

environment:
sdk: ^3.6.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:camera_android_camerax/src/camerax_library.dart';
import 'package:camera_android_camerax/src/camerax_proxy.dart';
import 'package:camera_platform_interface/camera_platform_interface.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart' show RotatedBox, Texture;
import 'package:flutter/widgets.dart' show RotatedBox, Texture, Transform;
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';

Expand Down Expand Up @@ -1031,8 +1031,13 @@ void main() {
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(
rotatedBox.quarterTurns,
expectedQuarterTurns,
Expand Down Expand Up @@ -1077,8 +1082,14 @@ void main() {
const int expectedQuarterTurns = _180DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(
rotatedBox.quarterTurns,
expectedQuarterTurns,
Expand Down Expand Up @@ -1122,8 +1133,14 @@ void main() {
const int expectedQuarterTurns = _90DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(
rotatedBox.quarterTurns,
expectedQuarterTurns,
Expand Down Expand Up @@ -1168,8 +1185,14 @@ void main() {
const int expectedQuarterTurns = _0DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(rotatedBox.quarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down Expand Up @@ -1245,8 +1268,13 @@ void main() {
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(rotatedBox.quarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down Expand Up @@ -1283,9 +1311,16 @@ void main() {
const int expectedQuarterTurns = _90DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);

final int clockwiseQuarterTurns = rotatedBox.quarterTurns + 4;
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
expect(clockwiseQuarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down Expand Up @@ -1320,9 +1355,16 @@ void main() {
const int expectedQuarterTurns = _180DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);

final int clockwiseQuarterTurns = rotatedBox.quarterTurns + 4;
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
expect(clockwiseQuarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down Expand Up @@ -1359,9 +1401,16 @@ void main() {
const int expectedQuarterTurns = _270DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);

final int clockwiseQuarterTurns = rotatedBox.quarterTurns + 4;
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
expect(clockwiseQuarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down Expand Up @@ -1449,11 +1498,18 @@ void main() {
currentDefaultDisplayRotation]!;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);

final int clockwiseQuarterTurns = rotatedBox.quarterTurns < 0
? rotatedBox.quarterTurns + 4
: rotatedBox.quarterTurns;
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
expect(clockwiseQuarterTurns, expectedQuarterTurns,
reason:
'When the default display rotation is $currentDefaultDisplayRotation, expected the preview to be rotated by $expectedQuarterTurns quarter turns (which is ${expectedQuarterTurns * 90} degrees clockwise) but instead was rotated ${rotatedBox.quarterTurns} quarter turns.');
Expand Down Expand Up @@ -1539,11 +1595,17 @@ void main() {
final RotatedBox rotatedBox = tester.widget<RotatedBox>(
find.byType(RotatedBox),
);

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
final int clockwiseQuarterTurns = rotatedBox.quarterTurns < 0
? rotatedBox.quarterTurns + 4
: rotatedBox.quarterTurns;
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);
expect(clockwiseQuarterTurns, expectedQuarterTurns,
reason:
'When the device orientation is $currentDeviceOrientation, expected the preview to be rotated by $expectedQuarterTurns quarter turns (which is ${expectedQuarterTurns * 90} degrees clockwise) but instead was rotated ${rotatedBox.quarterTurns} quarter turns.');
Expand Down Expand Up @@ -1760,8 +1822,14 @@ void main() {
const int expectedQuarterTurns = _90DegreesClockwise;
final RotatedBox rotatedBox =
tester.widget<RotatedBox>(find.byType(RotatedBox));
expect(rotatedBox.child, isA<Texture>());
expect((rotatedBox.child! as Texture).textureId, cameraId);

// We expect a Transform widget to wrap the RotatedBox with the camera
// preview to mirror the preview, since the front camera is being
// used.
expect(rotatedBox.child, isA<Transform>());

final Transform tranformedPreview = rotatedBox.child! as Transform;
expect((tranformedPreview.child! as Texture).textureId, cameraId);
expect(rotatedBox.quarterTurns, expectedQuarterTurns,
reason: getExpectedRotationTestFailureReason(
expectedQuarterTurns, rotatedBox.quarterTurns));
Expand Down