Changeset 34716 in osm for applications/viewer/jmapviewer/test
- Timestamp:
- 2018-11-02T18:45:19+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/viewer/jmapviewer/test/org/openstreetmap/gui/jmapviewer/tilesources/TemplatedTMSTileSourceTest.java
r34715 r34716 11 11 import java.util.stream.Stream; 12 12 13 import org.apache.commons.lang3.tuple.Triple;14 13 import org.junit.Test; 15 import org.openstreetmap.josm.data.imagery.ImageryInfo;16 14 17 15 … … 39 37 */ 40 38 @SuppressWarnings("unchecked") 41 private Collection<Triple<String, String, String>> TEST_DATA = Arrays.asList(new Triple[] { 42 Triple.of("http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z={zoom}&x={x}&y={-y}", "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=1&x=2&y=-2", "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=3&x=2&y=6"), 43 /* 44 * generate with main method below once TMS_IMAGERIES is filled in 45 */ 39 private Collection<String[]> TEST_DATA = Arrays.asList(new String[][] { 40 /* 41 * generate with main method below once TMS_IMAGERIES is filled in 42 */ 43 new String[]{"http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z={zoom}&x={x}&y={-y}", 44 "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=1&x=2&y=-2", 45 "http://imagico.de/map/osmim_tiles.php?layer=S2A_R136_N41_20150831T093006&z=3&x=2&y=6" 46 } 46 47 }); 47 48 … … 112 113 @Test 113 114 public void testGetTileUrl_switch() { 114 ImageryInfo testImageryTMS = newImageryInfo("test imagery", "http://{switch:a,b,c}.localhost/{10-zoom-5}/{x}/{y}", "tms", null, null);115 TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", "http://{switch:a,b,c}.localhost/{10-zoom-5}/{x}/{y}", "id1"); 115 116 TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS); 116 117 assertTrue( … … 170 171 171 172 private void checkGetTileUrl(String url, String expected123, String expected312) { 172 ImageryInfo testImageryTMS = newImageryInfo("test imagery", url, "tms", null, null);173 TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", url, "id1"); 173 174 TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS); 174 175 assertEquals(expected123, ts.getTileUrl(1, 2, 3)); … … 180 181 @Test 181 182 public void testAllUrls() { 182 for( Triple<String, String, String>test: TEST_DATA) {183 ImageryInfo testImageryTMS = newImageryInfo("test imagery", test.getLeft(), "tms", null, null);183 for(String[] test: TEST_DATA) { 184 TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", test[0], "id1"); 184 185 TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS); 185 assertEquals(test .getMiddle(), ts.getTileUrl(1, 2, 3));186 assertEquals(test .getRight(), ts.getTileUrl(3, 2, 1));186 assertEquals(test[1], ts.getTileUrl(1, 2, 3)); 187 assertEquals(test[2], ts.getTileUrl(3, 2, 1)); 187 188 } 188 189 } … … 190 191 public static void main(String[] args) { 191 192 for(String url: TMS_IMAGERIES) { 192 ImageryInfo testImageryTMS = newImageryInfo("test imagery", url, "tms", null, null);193 TileSourceInfo testImageryTMS = new TileSourceInfo("test imagery", url, "id1"); 193 194 TemplatedTMSTileSource ts = new TemplatedTMSTileSource(testImageryTMS); 194 System.out.println(MessageFormat.format(" Triple.of(\"{0}\", \"{1}\", \"{2}\"),", url, ts.getTileUrl(1, 2, 3), ts.getTileUrl(3, 2, 1)));195 System.out.println(MessageFormat.format("new String[]{\"{0}\", \"{1}\", \"{2}\"},", url, ts.getTileUrl(1, 2, 3), ts.getTileUrl(3, 2, 1))); 195 196 } 196 197 }
Note:
See TracChangeset
for help on using the changeset viewer.