-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathchewie_controller_test.dart
More file actions
68 lines (53 loc) · 1.89 KB
/
Copy pathchewie_controller_test.dart
File metadata and controls
68 lines (53 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import 'package:chewie/chewie.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:video_player/video_player.dart';
void main() {
group('ChewieController', () {
late VideoPlayerController videoPlayerController;
setUp(() {
videoPlayerController = VideoPlayerController.networkUrl(
Uri.parse('https://example.com/video.mp4'),
);
});
test('sets useNativeWebFullscreen to true by default', () {
final controller = ChewieController(
videoPlayerController: videoPlayerController,
);
expect(controller.useNativeWebFullscreen, true);
controller.dispose();
});
test('assigns unique textureId to each controller', () {
final controller1 = ChewieController(
videoPlayerController: videoPlayerController,
);
final controller2 = ChewieController(
videoPlayerController: videoPlayerController,
);
expect(controller1.textureId, isNot(controller2.textureId));
controller1.dispose();
controller2.dispose();
});
test('toggleFullScreen toggles isFullScreen on non-web', () {
final controller = ChewieController(
videoPlayerController: videoPlayerController,
);
expect(controller.isFullScreen, false);
controller.toggleFullScreen();
expect(controller.isFullScreen, true);
controller.toggleFullScreen();
expect(controller.isFullScreen, false);
controller.dispose();
});
test('copyWith preserves useNativeWebFullscreen', () {
final controller = ChewieController(
videoPlayerController: videoPlayerController,
useNativeWebFullscreen: false,
);
expect(controller.useNativeWebFullscreen, false);
final copied = controller.copyWith(useNativeWebFullscreen: true);
expect(copied.useNativeWebFullscreen, true);
controller.dispose();
copied.dispose();
});
});
}