Skip to content
Merged
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
[video_player] update test
Signed-off-by: ふぁ <[email protected]>
  • Loading branch information
fa0311 committed Feb 26, 2025
commit 96b33d94c2fae7c700a3b370e21bfc6fdf20fd91
33 changes: 17 additions & 16 deletions packages/video_player/video_player/test/video_player_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import 'dart:async';
import 'dart:io';
import 'dart:math' as math;
import 'dart:typed_data';

import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -178,28 +176,31 @@ void main() {
addTearDown(controller.dispose);
controller.textureId = 1;
await tester.pumpWidget(VideoPlayer(controller));
final Transform actualRotationCorrection =
find.byType(Transform).evaluate().single.widget as Transform;
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]));
}
final RotatedBox actualRotationCorrection =
find.byType(RotatedBox).evaluate().single.widget as RotatedBox;
final int actualQuarterTurns = actualRotationCorrection.quarterTurns;
expect(actualQuarterTurns, equals(2));
});

testWidgets('no transform when rotationCorrection is zero',
testWidgets('no RotatedBox when rotationCorrection is zero',
(WidgetTester tester) async {
final FakeController controller =
FakeController.value(const VideoPlayerValue(duration: Duration.zero));
addTearDown(controller.dispose);
controller.textureId = 1;
await tester.pumpWidget(VideoPlayer(controller));
expect(find.byType(Transform), findsNothing);
expect(find.byType(RotatedBox), findsNothing);
});

testWidgets('no RotatedBox when rotationCorrection is not a multiple of 90',
(WidgetTester tester) async {
final FakeController controller = FakeController.value(
const VideoPlayerValue(
duration: Duration.zero, rotationCorrection: 45));
addTearDown(controller.dispose);
controller.textureId = 1;
await tester.pumpWidget(VideoPlayer(controller));
expect(find.byType(RotatedBox), findsNothing);
});

group('ClosedCaption widget', () {
Expand Down