Skip to content

Commit

Permalink
Adjust unit tests to the new type
Browse files Browse the repository at this point in the history
  • Loading branch information
FirentisTFW committed Jan 20, 2025
1 parent bdd5fd3 commit cee36ce
Showing 1 changed file with 20 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,13 @@ void main() {
});

test('dispose', () async {
player.playerViewTypes[1] = VideoViewType.textureView;
player.playerViewStates[1] =
const VideoPlayerTextureViewState(textureId: 1);

await player.dispose(1);
expect(log.log.last, 'dispose');
expect(log.textureId, 1);
expect(player.playerViewTypes, isEmpty);
expect(player.playerViewStates, isEmpty);
});

test('create with asset', () async {
Expand All @@ -136,7 +137,8 @@ void main() {
expect(log.creationOptions?.asset, 'someAsset');
expect(log.creationOptions?.packageName, 'somePackage');
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

// FIXME Is this test valid?
Expand Down Expand Up @@ -165,7 +167,8 @@ void main() {
expect(log.creationOptions?.formatHint, 'dash');
expect(log.creationOptions?.httpHeaders, <String, String>{});
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('create with network (some headers)', () async {
Expand All @@ -182,7 +185,8 @@ void main() {
expect(log.creationOptions?.httpHeaders,
<String, String>{'Authorization': 'Bearer token'});
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('create with file', () async {
Expand All @@ -193,7 +197,8 @@ void main() {
expect(log.log.last, 'create');
expect(log.creationOptions?.uri, 'someUri');
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('createWithOptions with asset', () async {
Expand All @@ -211,7 +216,8 @@ void main() {
expect(log.creationOptions?.asset, 'someAsset');
expect(log.creationOptions?.packageName, 'somePackage');
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

// FIXME Is this test valid?
Expand Down Expand Up @@ -250,7 +256,8 @@ void main() {
expect(log.creationOptions?.formatHint, 'dash');
expect(log.creationOptions?.httpHeaders, <String, String>{});
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('createWithOptions with network (some headers)', () async {
Expand All @@ -272,7 +279,8 @@ void main() {
expect(log.creationOptions?.httpHeaders,
<String, String>{'Authorization': 'Bearer token'});
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('createWithOptions with file', () async {
Expand All @@ -288,23 +296,8 @@ void main() {
expect(log.log.last, 'create');
expect(log.creationOptions?.uri, 'someUri');
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
});

test('createWithOptions with texture view', () async {
final int? textureId = await player.createWithOptions(
VideoCreationOptions(
dataSource: DataSource(
sourceType: DataSourceType.file,
uri: 'someUri',
),
viewType: VideoViewType.textureView,
),
);
expect(log.log.last, 'create');
expect(log.creationOptions?.viewType, PlatformVideoViewType.textureView);
expect(textureId, 3);
expect(player.playerViewTypes[3], VideoViewType.textureView);
expect(player.playerViewStates[3],
const VideoPlayerTextureViewState(textureId: 3));
});

test('createWithOptions with platform view', () async {
Expand All @@ -320,7 +313,7 @@ void main() {
expect(log.log.last, 'create');
expect(log.creationOptions?.viewType, PlatformVideoViewType.platformView);
expect(playerId, 3);
expect(player.playerViewTypes[3], VideoViewType.platformView);
expect(player.playerViewStates[3], const VideoPlayerPlatformViewState());
});

test('setLooping', () async {
Expand Down

0 comments on commit cee36ce

Please sign in to comment.