Changeset 14507 in josm for trunk/test


Ignore:
Timestamp:
2018-12-04T01:45:45+01:00 (12 months ago)
Author:
Don-vip
Message:

see #16073 - test tile source

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/gui/preferences/imagery/ImageryPreferenceTestIT.java

    r14499 r14507  
    1616import org.junit.Rule;
    1717import org.junit.Test;
     18import org.openstreetmap.gui.jmapviewer.TileXY;
     19import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
    1820import org.openstreetmap.gui.jmapviewer.tilesources.AbstractTileSource;
    1921import org.openstreetmap.gui.jmapviewer.tilesources.BingAerialTileSource;
    2022import org.openstreetmap.gui.jmapviewer.tilesources.ScanexTileSource;
    2123import org.openstreetmap.gui.jmapviewer.tilesources.TemplatedTMSTileSource;
     24import org.openstreetmap.josm.data.coor.LatLon;
     25import org.openstreetmap.josm.data.imagery.CoordinateConversion;
    2226import org.openstreetmap.josm.data.imagery.ImageryInfo;
     27import org.openstreetmap.josm.data.imagery.ImageryInfo.ImageryBounds;
    2328import org.openstreetmap.josm.data.imagery.ImageryLayerInfo;
    2429import org.openstreetmap.josm.data.imagery.TemplatedWMSTileSource;
     
    7378    }
    7479
     80    private void checkTileUrl(ImageryInfo info, AbstractTileSource tileSource, ICoordinate center, int zoom)
     81            throws IOException {
     82        TileXY xy = tileSource.latLonToTileXY(center, zoom);
     83        checkUrl(info, tileSource.getTileUrl(zoom, xy.getXIndex(), xy.getYIndex()));
     84    }
     85
    7586    private void checkEntry(ImageryInfo info) {
    7687        Logging.info("Checking "+ info);
     
    90101
    91102        try {
    92             getTileSource(info);
     103            ImageryBounds bounds = info.getBounds();
     104            ICoordinate center = CoordinateConversion.llToCoor(bounds != null ? bounds.getCenter() : LatLon.ZERO);
     105            AbstractTileSource tileSource = getTileSource(info);
     106            checkTileUrl(info, tileSource, center, info.getMinZoom());
     107            checkTileUrl(info, tileSource, center, info.getMaxZoom());
    93108        } catch (IOException | WMTSGetCapabilitiesException | IllegalArgumentException e) {
    94109            addError(info, e.toString());
     
    113128                return new WMSEndpointTileSource(info, ProjectionRegistry.getProjection());
    114129            case WMTS:
    115                 return new WMTSTileSource(info);
     130                return new WMTSTileSource(info, ProjectionRegistry.getProjection());
    116131            default:
    117132                throw new UnsupportedOperationException(info.toString());
Note: See TracChangeset for help on using the changeset viewer.