Ticket #16010: v1-0002-DownloadWmsAlongTrackActionTest-use-TileSourceRul.patch

File v1-0002-DownloadWmsAlongTrackActionTest-use-TileSourceRul.patch, 2.2 KB (added by ris, 7 years ago)
  • test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java

    From 8ad17f1615d98b2164c976c2f5d8f965d312002f Mon Sep 17 00:00:00 2001
    From: Robert Scott <code@humanleg.org.uk>
    Date: Sat, 28 Jul 2018 23:28:27 +0100
    Subject: [PATCH v1 2/2] DownloadWmsAlongTrackActionTest: use TileSourceRule
     instead of fetching tiles from a real remote server
    
    ---
     .../josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java    | 10 +++++++---
     1 file changed, 7 insertions(+), 3 deletions(-)
    
    diff --git a/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java b/test/unit/org/openstreetmap/josm/gui/layer/gpx/DownloadWmsAlongTrackActionTest.java
    index 1b9c23876..49ebb9b90 100644
    a b import org.openstreetmap.josm.gui.layer.GpxLayerTest;  
    1515import org.openstreetmap.josm.gui.layer.TMSLayer;
    1616import org.openstreetmap.josm.gui.layer.gpx.DownloadWmsAlongTrackAction.PrecacheWmsTask;
    1717import org.openstreetmap.josm.testutils.JOSMTestRules;
     18import org.openstreetmap.josm.testutils.TileSourceRule;
    1819
    1920import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2021
    public class DownloadWmsAlongTrackActionTest {  
    2829     */
    2930    @Rule
    3031    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    31     public JOSMTestRules test = new JOSMTestRules().platform().main().projection().timeout(20000);
     32    public JOSMTestRules test = new JOSMTestRules().platform().main().projection().fakeImagery().timeout(20000);
    3233
    3334    /**
    3435     * Test action without layer.
    public class DownloadWmsAlongTrackActionTest {  
    4445     */
    4546    @Test
    4647    public void testTMSLayer() throws Exception {
    47         // Create new TMS layer and clear cache
    48         TMSLayer layer = new TMSLayer(new ImageryInfo("OSM TMS", "https://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png", "tms", null, null));
     48        final TileSourceRule tileSourceRule = this.test.getTileSourceRule();
     49
     50        TMSLayer layer = new TMSLayer(
     51            tileSourceRule.getSourcesList().get(0).getImageryInfo(tileSourceRule.port())
     52        );
    4953        try {
    5054            MainApplication.getLayerManager().addLayer(layer);
    5155            TMSLayer.getCache().clear();