Changeset 11988 in josm for trunk/test/unit
- Timestamp:
- 2017-04-23T21:49:05+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r11986 r11988 8 8 import static org.junit.Assert.assertTrue; 9 9 10 import java.net.MalformedURLException; 11 import java.nio.file.Paths; 10 12 import java.util.Collection; 11 13 import java.util.List; … … 96 98 } 97 99 98 /** 99 * Unit test of {@link Main#postConstructorProcessCmdLine} - nominal cases. 100 * This test assumes the DEV API contains nodes around 0,0 and GPX tracks around London 101 */ 102 @Test 103 public void testPostConstructorProcessCmdLineNominal() { 100 private static void doTestPostConstructorProcessCmdLine(String download, String downloadGps, boolean gpx) { 104 101 assertNull(Main.getLayerManager().getEditDataSet()); 105 102 Main.postConstructorProcessCmdLine(new ProgramArguments(new String[]{ 106 "--download= 0.01,0.01,0.05,0.05",107 "--downloadgps= 51.35,-0.4,51.60,0.2",103 "--download=" + download, 104 "--downloadgps=" + downloadGps, 108 105 "--selection=type: node"})); 109 106 DataSet ds = Main.getLayerManager().getEditDataSet(); … … 111 108 assertFalse(ds.getSelected().isEmpty()); 112 109 Main.getLayerManager().removeLayer(Main.getLayerManager().getEditLayer()); 113 List<GpxLayer> gpxLayers = Main.getLayerManager().getLayersOfType(GpxLayer.class); 114 assertEquals(1, gpxLayers.size()); 115 Main.getLayerManager().removeLayer(gpxLayers.iterator().next()); 110 if (gpx) { 111 List<GpxLayer> gpxLayers = Main.getLayerManager().getLayersOfType(GpxLayer.class); 112 assertEquals(1, gpxLayers.size()); 113 Main.getLayerManager().removeLayer(gpxLayers.iterator().next()); 114 } 115 } 116 117 /** 118 * Unit test of {@link Main#postConstructorProcessCmdLine} - nominal case with bounds. 119 * This test assumes the DEV API contains nodes around 0,0 and GPX tracks around London 120 */ 121 @Test 122 public void testPostConstructorProcessCmdLineBounds() { 123 doTestPostConstructorProcessCmdLine( 124 "0.01,0.01,0.05,0.05", 125 "51.35,-0.4,51.60,0.2", true); 126 } 127 128 /** 129 * Unit test of {@link Main#postConstructorProcessCmdLine} - nominal case with http/https URLs. 130 * This test assumes the DEV API contains nodes around 0,0 and GPX tracks around London 131 */ 132 @Test 133 public void testPostConstructorProcessCmdLineHttpUrl() { 134 doTestPostConstructorProcessCmdLine( 135 "http://api06.dev.openstreetmap.org/api/0.6/map?bbox=0.01,0.01,0.05,0.05", 136 "https://master.apis.dev.openstreetmap.org/api/0.6/trackpoints?bbox=-0.4,51.35,0.2,51.6&page=0", true); 137 } 138 139 /** 140 * Unit test of {@link Main#postConstructorProcessCmdLine} - nominal case with file URLs. 141 * @throws MalformedURLException if an error occurs 142 */ 143 @Test 144 public void testPostConstructorProcessCmdLineFileUrl() throws MalformedURLException { 145 doTestPostConstructorProcessCmdLine( 146 Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toUri().toURL().toExternalForm(), 147 Paths.get(TestUtils.getTestDataRoot() + "minimal.gpx").toUri().toURL().toExternalForm(), false); 148 } 149 150 /** 151 * Unit test of {@link Main#postConstructorProcessCmdLine} - nominal case with file names. 152 * @throws MalformedURLException if an error occurs 153 */ 154 @Test 155 public void testPostConstructorProcessCmdLineFilename() throws MalformedURLException { 156 doTestPostConstructorProcessCmdLine( 157 Paths.get(TestUtils.getTestDataRoot() + "multipolygon.osm").toFile().getAbsolutePath(), 158 Paths.get(TestUtils.getTestDataRoot() + "minimal.gpx").toFile().getAbsolutePath(), false); 116 159 } 117 160
Note:
See TracChangeset
for help on using the changeset viewer.