Changeset 15755 in josm for trunk/test/unit/org/openstreetmap
- Timestamp:
- 2020-01-23T22:57:46+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/audio/AudioPlayerTest.java
r12327 r15755 14 14 import org.openstreetmap.josm.JOSMFixture; 15 15 import org.openstreetmap.josm.TestUtils; 16 import org.openstreetmap.josm.tools. Utils;16 import org.openstreetmap.josm.tools.Stopwatch; 17 17 18 18 /** … … 46 46 System.out.println("Playing " + w.toPath()); 47 47 URL url = w.toURI().toURL(); 48 long start = System.currentTimeMillis();48 final Stopwatch stopwatch = Stopwatch.createStarted(); 49 49 AudioPlayer.play(url); 50 50 assertTrue(AudioPlayer.playing()); … … 54 54 assertTrue(AudioPlayer.paused()); 55 55 AudioPlayer.play(url, AudioPlayer.position()); 56 while (AudioPlayer.playing() && (System.currentTimeMillis() - start) < MAX_DURATION) {56 while (AudioPlayer.playing() && stopwatch.elapsed() < MAX_DURATION) { 57 57 Thread.sleep(500); 58 58 } 59 long duration = System.currentTimeMillis() - start; 60 System.out.println("Play finished after " + Utils.getDurationString(duration)); 61 assertTrue(duration < MAX_DURATION); 59 System.out.println("Play finished after " + stopwatch); 60 assertTrue(stopwatch.elapsed() < MAX_DURATION); 62 61 AudioPlayer.reset(); 63 62 Thread.sleep(1000); // precaution, see #13809
Note:
See TracChangeset
for help on using the changeset viewer.