- Timestamp:
- 2017-04-09T12:22:30+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java
r10945 r11859 15 15 import org.openstreetmap.josm.data.coor.LatLon; 16 16 import org.openstreetmap.josm.data.projection.CustomProjection; 17 import org.openstreetmap.josm.data.projection.Projection; 17 18 import org.openstreetmap.josm.data.projection.Projections; 18 19 import org.openstreetmap.josm.testutils.JOSMTestRules; … … 25 26 public class TemplatedWMSTileSourceTest { 26 27 27 private ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null);28 private ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null);28 private final ImageryInfo testImageryWMS = new ImageryInfo("test imagery", "http://localhost", "wms", null, null); 29 private final ImageryInfo testImageryTMS = new ImageryInfo("test imagery", "http://localhost", "tms", null, null); 29 30 30 31 /** … … 40 41 @Test 41 42 public void testEPSG3857() { 42 Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); 43 TemplatedWMSTileSource source = new TemplatedWMSTileSource(testImageryWMS); 43 Projection projection = Projections.getProjectionByCode("EPSG:3857"); 44 Main.setProjection(projection); 45 TemplatedWMSTileSource source = new TemplatedWMSTileSource(testImageryWMS, projection); 44 46 verifyMercatorTile(source, 0, 0, 1); 45 47 verifyMercatorTile(source, 0, 0, 2); … … 64 66 @Test 65 67 public void testEPSG4326() { 66 Main.setProjection(Projections.getProjectionByCode("EPSG:4326")); 67 TemplatedWMSTileSource source = getSource(); 68 Projection projection = Projections.getProjectionByCode("EPSG:4326"); 69 Main.setProjection(projection); 70 TemplatedWMSTileSource source = getSource(projection); 68 71 69 72 verifyLocation(source, new LatLon(53.5937132, 19.5652017)); … … 79 82 @Test 80 83 public void testEPSG4326widebounds() { 81 Main.setProjection(new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54")); 82 TemplatedWMSTileSource source = getSource(); 84 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=-180,53,180,54"); 85 Main.setProjection(projection); 86 TemplatedWMSTileSource source = getSource(projection); 83 87 84 88 verifyLocation(source, new LatLon(53.5937132, 19.5652017)); … … 91 95 @Test 92 96 public void testEPSG4326narrowbounds() { 93 Main.setProjection(new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90")); 94 TemplatedWMSTileSource source = getSource(); 97 Projection projection = new CustomProjection("+proj=lonlat +datum=WGS84 +axis=neu +bounds=18,-90,20,90"); 98 Main.setProjection(projection); 99 TemplatedWMSTileSource source = getSource(projection); 95 100 96 101 verifyLocation(source, new LatLon(53.5937132, 19.5652017)); … … 103 108 @Test 104 109 public void testEPSG2180() { 105 Main.setProjection(Projections.getProjectionByCode("EPSG:2180")); 106 TemplatedWMSTileSource source = getSource(); 110 Projection projection = Projections.getProjectionByCode("EPSG:2180"); 111 Main.setProjection(projection); 112 TemplatedWMSTileSource source = getSource(projection); 107 113 108 114 verifyLocation(source, new LatLon(53.5937132, 19.5652017)); … … 119 125 @Test 120 126 public void testEPSG3006withbounds() { 121 Main.setProjection(127 Projection projection = 122 128 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " 123 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006 +bounds=10.5700,55.2000,24.1800,69.1000 ")); 124 TemplatedWMSTileSource source = getSource(); 129 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006 +bounds=10.5700,55.2000,24.1800,69.1000 "); 130 Main.setProjection(projection); 131 TemplatedWMSTileSource source = getSource(projection); 125 132 126 133 verifyTileSquarness(source, 0, 1, 4); … … 134 141 @Test 135 142 public void testEPSG3006withoutbounds() { 136 Main.setProjection(143 Projection projection = 137 144 new CustomProjection("+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 " 138 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006")); 139 TemplatedWMSTileSource source = getSource(); 145 + "+units=m +no_defs +axis=neu +wmssrs=EPSG:3006"); 146 Main.setProjection(projection); 147 TemplatedWMSTileSource source = getSource(projection); 140 148 141 149 verifyTileSquarness(source, 0, 1, 4); … … 236 244 } 237 245 238 private TemplatedWMSTileSource getSource( ) {239 return new TemplatedWMSTileSource(testImageryWMS );246 private TemplatedWMSTileSource getSource(Projection projection) { 247 return new TemplatedWMSTileSource(testImageryWMS, projection); 240 248 } 241 249 }
Note:
See TracChangeset
for help on using the changeset viewer.