source: josm/trunk/test/unit/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarkerTest.java@ 9782

Last change on this file since 9782 was 9782, checked in by Don-vip, 8 years ago

attempt to fix unit test

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.layer.markerlayer;
3
4import static org.junit.Assert.assertEquals;
5
6import java.io.File;
7import java.net.MalformedURLException;
8
9import org.junit.BeforeClass;
10import org.junit.Test;
11import org.openstreetmap.josm.JOSMFixture;
12import org.openstreetmap.josm.TestUtils;
13import org.openstreetmap.josm.data.coor.LatLon;
14import org.openstreetmap.josm.data.gpx.Extensions;
15import org.openstreetmap.josm.data.gpx.GpxConstants;
16import org.openstreetmap.josm.data.gpx.GpxData;
17import org.openstreetmap.josm.data.gpx.WayPoint;
18import org.openstreetmap.josm.tools.AudioPlayer;
19
20/**
21 * Unit tests of {@link AudioMarker} class.
22 */
23public class AudioMarkerTest {
24
25 /**
26 * Setup tests
27 */
28 @BeforeClass
29 public static void setUpBeforeClass() {
30 JOSMFixture.createUnitTestFixture().init();
31 }
32
33 /**
34 * Unit test of {@link AudioMarker#AudioMarker}.
35 * @throws MalformedURLException never
36 */
37 @Test
38 public void testAudioMarker() throws MalformedURLException {
39 AudioMarker marker = new AudioMarker(
40 LatLon.ZERO,
41 null,
42 new File(TestUtils.getRegressionDataFile(6851, "20111003_121226.wav")).toURI().toURL(),
43 new MarkerLayer(new GpxData(), null, null, null),
44 1d, 2d);
45 try {
46 marker.actionPerformed(null);
47 } finally {
48 AudioPlayer.reset();
49 }
50 assertEquals("2", marker.getText());
51 WayPoint wpt = marker.convertToWayPoint();
52 assertEquals(LatLon.ZERO, wpt.getCoor());
53 Extensions ext = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
54 assertEquals("2.0", ext.get("offset"));
55 }
56}
Note: See TracBrowser for help on using the repository browser.