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
test(video_player): rename customInterval to updatesInterval for clarity
  • Loading branch information
abdelaziz-mahdy committed Feb 10, 2025
commit 4e7b75d70430f6815b199614a698f0d45ecea567
13 changes: 6 additions & 7 deletions packages/video_player/video_player/test/video_player_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ void main() {
});
});
});

test('updates position', () async {
final VideoPlayerController controller = VideoPlayerController.networkUrl(
_localhostUri,
Expand All @@ -965,8 +965,7 @@ void main() {

await controller.initialize();

// Set a custom interval
const Duration customInterval = Duration(milliseconds: 100);
const Duration updatesInterval = Duration(milliseconds: 100);

final List<Duration> positions = <Duration>[];
final Completer<void> intervalUpdateCompleter = Completer<void>();
Expand All @@ -980,17 +979,17 @@ void main() {
});
await controller.play();
for (int i = 0; i < 3; i++) {
await Future<void>.delayed(customInterval);
await Future<void>.delayed(updatesInterval);
fakeVideoPlayerPlatform._positions[controller.textureId] =
Duration(milliseconds: i * customInterval.inMilliseconds);
Duration(milliseconds: i * updatesInterval.inMilliseconds);
}

// Wait for at least 3 position updates
await intervalUpdateCompleter.future.timeout(const Duration(seconds: 5));

// Verify that the intervals between updates are approximately correct
expect(positions[1] - positions[0], greaterThanOrEqualTo(customInterval));
expect(positions[2] - positions[1], greaterThanOrEqualTo(customInterval));
expect(positions[1] - positions[0], greaterThanOrEqualTo(updatesInterval));
expect(positions[2] - positions[1], greaterThanOrEqualTo(updatesInterval));
});

group('DurationRange', () {
Expand Down