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;
|
15 | 15 | import org.openstreetmap.josm.gui.layer.TMSLayer; |
16 | 16 | import org.openstreetmap.josm.gui.layer.gpx.DownloadWmsAlongTrackAction.PrecacheWmsTask; |
17 | 17 | import org.openstreetmap.josm.testutils.JOSMTestRules; |
| 18 | import org.openstreetmap.josm.testutils.TileSourceRule; |
18 | 19 | |
19 | 20 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; |
20 | 21 | |
… |
… |
public class DownloadWmsAlongTrackActionTest {
|
28 | 29 | */ |
29 | 30 | @Rule |
30 | 31 | @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); |
32 | 33 | |
33 | 34 | /** |
34 | 35 | * Test action without layer. |
… |
… |
public class DownloadWmsAlongTrackActionTest {
|
44 | 45 | */ |
45 | 46 | @Test |
46 | 47 | 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 | ); |
49 | 53 | try { |
50 | 54 | MainApplication.getLayerManager().addLayer(layer); |
51 | 55 | TMSLayer.getCache().clear(); |