Skip to content

Commit

Permalink
test: debug for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Gustl22 committed May 3, 2023
1 parent 548dee7 commit 9cda452
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/audioplayers/example/integration_test/lib_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,18 @@ void main() {
(WidgetTester tester) async {
final players =
List.generate(audioTestDataList.length, (_) => AudioPlayer());
print("Dispose Debug A");

// Start all players simultaneously
final iterator = List<int>.generate(audioTestDataList.length, (i) => i);
await Future.wait<void>(
iterator.map((i) => players[i].play(audioTestDataList[i].source)),
);
print("Dispose Debug B");
await tester.pumpAndSettle();
// Sources take some time to get initialized
await tester.pump(const Duration(seconds: 8));
print("Dispose Debug C");
for (var i = 0; i < audioTestDataList.length; i++) {
final td = audioTestDataList[i];
if (td.isLiveStream || td.duration > const Duration(seconds: 10)) {
Expand All @@ -89,7 +92,9 @@ void main() {
}
await players[i].stop();
}
print("Dispose Debug D");
await Future.wait(players.map((p) => p.dispose()));
print("Dispose Debug E");
},
// FIXME: Causes media error on Android (see #1333, #1353)
// Unexpected platform error: MediaPlayer error with
Expand All @@ -99,8 +104,10 @@ void main() {

testWidgets('play multiple sources consecutively',
(WidgetTester tester) async {
print("Dispose Debug F");
final player = AudioPlayer();

print("Dispose Debug G");
for (var i = 0; i < audioTestDataList.length; i++) {
final td = audioTestDataList[i];
await player.play(td.source);
Expand All @@ -113,8 +120,10 @@ void main() {
printWithTimeOnFailure('Test position: $td');
expect(position, greaterThan(Duration.zero));
}
print("Dispose Debug H");
await player.stop();
}
print("Dispose Debug I");
await player.dispose();
});
});
Expand Down

0 comments on commit 9cda452

Please sign in to comment.