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

Commit

Permalink
[video_player] Use epislon to compare values in matrix in test (#6088)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Yang authored Jul 8, 2022
1 parent 2adf9f3 commit bde0d0d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/video_player/video_player/test/video_player_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -160,8 +161,16 @@ void main() {
await tester.pumpWidget(VideoPlayer(controller));
final Transform actualRotationCorrection =
find.byType(Transform).evaluate().single.widget as Transform;
expect(
actualRotationCorrection.transform, equals(Matrix4.rotationZ(math.pi)));
final Float64List actualRotationCorrectionStorage =
actualRotationCorrection.transform.storage;
final Float64List expectedMatrixStorage =
Matrix4.rotationZ(math.pi).storage;
expect(actualRotationCorrectionStorage.length,
equals(expectedMatrixStorage.length));
for (int i = 0; i < actualRotationCorrectionStorage.length; i++) {
expect(actualRotationCorrectionStorage[i],
moreOrLessEquals(expectedMatrixStorage[i]));
}
});

testWidgets('no transform when rotationCorrection is zero',
Expand Down

0 comments on commit bde0d0d

Please sign in to comment.