Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit bde0d0d

Browse files
author
Chris Yang
authored
[video_player] Use epislon to compare values in matrix in test (#6088)
1 parent 2adf9f3 commit bde0d0d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/video_player/video_player/test/video_player_test.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import 'dart:async';
66
import 'dart:io';
77
import 'dart:math' as math;
8+
import 'dart:typed_data';
89

910
import 'package:flutter/material.dart';
1011
import 'package:flutter/services.dart';
@@ -160,8 +161,16 @@ void main() {
160161
await tester.pumpWidget(VideoPlayer(controller));
161162
final Transform actualRotationCorrection =
162163
find.byType(Transform).evaluate().single.widget as Transform;
163-
expect(
164-
actualRotationCorrection.transform, equals(Matrix4.rotationZ(math.pi)));
164+
final Float64List actualRotationCorrectionStorage =
165+
actualRotationCorrection.transform.storage;
166+
final Float64List expectedMatrixStorage =
167+
Matrix4.rotationZ(math.pi).storage;
168+
expect(actualRotationCorrectionStorage.length,
169+
equals(expectedMatrixStorage.length));
170+
for (int i = 0; i < actualRotationCorrectionStorage.length; i++) {
171+
expect(actualRotationCorrectionStorage[i],
172+
moreOrLessEquals(expectedMatrixStorage[i]));
173+
}
165174
});
166175

167176
testWidgets('no transform when rotationCorrection is zero',

0 commit comments

Comments
 (0)