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

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

add more unit tests

  • Property svn:eol-style set to native
File size: 1.5 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.net.MalformedURLException;
7import java.net.URL;
8
9import org.junit.BeforeClass;
10import org.junit.Test;
11import org.openstreetmap.josm.JOSMFixture;
12import org.openstreetmap.josm.data.coor.LatLon;
13import org.openstreetmap.josm.data.gpx.Extensions;
14import org.openstreetmap.josm.data.gpx.GpxConstants;
15import org.openstreetmap.josm.data.gpx.GpxData;
16import org.openstreetmap.josm.data.gpx.WayPoint;
17
18/**
19 * Unit tests of {@link AudioMarker} class.
20 */
21public class AudioMarkerTest {
22
23 /**
24 * Setup tests
25 */
26 @BeforeClass
27 public static void setUpBeforeClass() {
28 JOSMFixture.createUnitTestFixture().init();
29 }
30
31 /**
32 * Unit test of {@link AudioMarker#AudioMarker}.
33 * @throws MalformedURLException never
34 */
35 @Test
36 public void testAudioMarker() throws MalformedURLException {
37 AudioMarker marker = new AudioMarker(
38 LatLon.ZERO,
39 null,
40 new URL("file://something.wav"),
41 new MarkerLayer(new GpxData(), null, null, null),
42 1d, 2d);
43 marker.actionPerformed(null);
44 assertEquals("2", marker.getText());
45 WayPoint wpt = marker.convertToWayPoint();
46 assertEquals(LatLon.ZERO, wpt.getCoor());
47 Extensions ext = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS);
48 assertEquals("2.0", ext.get("offset"));
49 }
50}
Note: See TracBrowser for help on using the repository browser.