Changeset 11859 in josm for trunk/test


Ignore:
Timestamp:
2017-04-09T12:22:30+02:00 (8 years ago)
Author:
bastiK
Message:

see #7427 - fix test-compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/imagery/TemplatedWMSTileSourceTest.java

    r10945 r11859  
    1515import org.openstreetmap.josm.data.coor.LatLon;
    1616import org.openstreetmap.josm.data.projection.CustomProjection;
     17import org.openstreetmap.josm.data.projection.Projection;
    1718import org.openstreetmap.josm.data.projection.Projections;
    1819import org.openstreetmap.josm.testutils.JOSMTestRules;
     
    2526public class TemplatedWMSTileSourceTest {
    2627
    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);
    2930
    3031    /**
     
    4041    @Test
    4142    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);
    4446        verifyMercatorTile(source, 0, 0, 1);
    4547        verifyMercatorTile(source, 0, 0, 2);
     
    6466    @Test
    6567    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);
    6871
    6972        verifyLocation(source, new LatLon(53.5937132, 19.5652017));
     
    7982    @Test
    8083    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);
    8387
    8488        verifyLocation(source, new LatLon(53.5937132, 19.5652017));
     
    9195    @Test
    9296    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);
    95100
    96101        verifyLocation(source, new LatLon(53.5937132, 19.5652017));
     
    103108    @Test
    104109    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);
    107113
    108114        verifyLocation(source, new LatLon(53.5937132, 19.5652017));
     
    119125    @Test
    120126    public void testEPSG3006withbounds() {
    121         Main.setProjection(
     127        Projection projection =
    122128                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);
    125132
    126133        verifyTileSquarness(source, 0, 1, 4);
     
    134141    @Test
    135142    public void testEPSG3006withoutbounds() {
    136         Main.setProjection(
     143        Projection projection =
    137144                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);
    140148
    141149        verifyTileSquarness(source, 0, 1, 4);
     
    236244    }
    237245
    238     private TemplatedWMSTileSource getSource() {
    239         return new TemplatedWMSTileSource(testImageryWMS);
     246    private TemplatedWMSTileSource getSource(Projection projection) {
     247        return new TemplatedWMSTileSource(testImageryWMS, projection);
    240248    }
    241249}
Note: See TracChangeset for help on using the changeset viewer.