Changeset 9817 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackAction.java
r9804 r9817 81 81 latcnt++; 82 82 } 83 } 84 if (latcnt == 0) { 85 return null; 83 86 } 84 87 double avglat = latsum / latcnt; … … 190 193 @Override 191 194 public void actionPerformed(ActionEvent e) { 192 Main.worker.submit(createTask()); 195 PleaseWaitRunnable task = createTask(); 196 if (task != null) { 197 Main.worker.submit(task); 198 } 193 199 } 194 200 } -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadAlongTrackActionTest.java
r9816 r9817 3 3 4 4 import static org.junit.Assert.assertNotNull; 5 import static org.junit.Assert.assertNull; 5 6 6 7 import org.junit.BeforeClass; … … 28 29 } 29 30 30 /** 31 * Test action. 32 * @throws Exception if an error occurs 33 */ 34 @Test 35 public void testDownload() throws Exception { 36 final OsmDataLayer layer = new OsmDataLayer(new DataSet(), getClass().getName(), null); 31 private static PleaseWaitRunnable createTask(String file) throws Exception { 32 final OsmDataLayer layer = new OsmDataLayer(new DataSet(), DownloadAlongTrackActionTest.class.getName(), null); 37 33 try { 38 34 Main.main.addLayer(layer); 39 35 // Perform action 40 final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + "minimal.gpx"); 41 PleaseWaitRunnable task = new DownloadAlongTrackAction(gpx).createTask(); 42 assertNotNull(task); 36 final GpxData gpx = GpxReaderTest.parseGpxData(TestUtils.getTestDataRoot() + file); 37 return new DownloadAlongTrackAction(gpx).createTask(); 43 38 } finally { 44 39 // Ensure we clean the place before leaving, even if test fails. … … 46 41 } 47 42 } 43 44 /** 45 * Test action with nominal data set. 46 * @throws Exception if an error occurs 47 */ 48 @Test 49 public void testDownload() throws Exception { 50 assertNotNull(createTask("minimal.gpx")); 51 } 52 53 /** 54 * Test action with empty data set. 55 * @throws Exception if an error occurs 56 */ 57 @Test 58 public void testDownloadEmpty() throws Exception { 59 assertNull(createTask("empty.gpx")); 60 } 48 61 }
Note:
See TracChangeset
for help on using the changeset viewer.