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

[video_player] Use epislon to compare values in matrix in test #6088

Merged
merged 3 commits into from
Jul 8, 2022
Merged
Changes from all commits
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
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