Ticket #23257: 23257.patch

File 23257.patch, 2.6 KB (added by marcello@…, 14 months ago)

patch

  • test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java

    diff --git a/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java b/test/unit/org/openstreetmap/josm/data/imagery/vectortile/mapbox/MVTTileTest.java
    index 67f0a3783..5d60c9e22 100644
    a b import java.util.stream.Stream;  
    1010
    1111import org.awaitility.Awaitility;
    1212import org.awaitility.Durations;
    13 import org.junit.jupiter.api.BeforeEach;
    1413import org.junit.jupiter.params.ParameterizedTest;
    1514import org.junit.jupiter.params.provider.Arguments;
    1615import org.junit.jupiter.params.provider.MethodSource;
    import org.openstreetmap.josm.data.imagery.TileJobOptions;  
    2524 * Test class for {@link MVTTile}
    2625 */
    2726class MVTTileTest {
    28     private MapboxVectorTileSource tileSource;
    29     private MapboxVectorCachedTileLoader loader;
    30     @BeforeEach
    31     void setup() {
    32         tileSource = new MapboxVectorTileSource(new ImageryInfo("Test Mapillary", "file:/" + TestUtils.getTestDataRoot()
    33           + "pbf/mapillary/{z}/{x}/{y}.mvt"));
    34         loader = new MapboxVectorCachedTileLoader(null,
    35           JCSCacheManager.getCache("testMapillaryCache"), new TileJobOptions(1, 1, Collections
    36           .emptyMap(), 3600));
    37     }
     27    private MapboxVectorCachedTileLoader loader = new MapboxVectorCachedTileLoader(
     28            null, JCSCacheManager.getCache("testMapillaryCache"), new TileJobOptions(1, 1, Collections.emptyMap(), 3600));
     29    private MapboxVectorTileSource tileSource = new MapboxVectorTileSource(
     30            new ImageryInfo("Test Mapillary", "file:/" + TestUtils.getTestDataRoot() + "pbf/mapillary/{z}/{x}/{y}.mvt"));
    3831
    3932    /**
    4033     * Provide arguments for {@link #testMVTTile(BufferedImage, Boolean)}
    class MVTTileTest {  
    5750        assertEquals(image, tile.getImage());
    5851
    5952        TileJob job = loader.createTileLoaderJob(tile);
    60         job.submit();
     53        // we can't use the cache, because we request the same tile many times over
     54        job.submit(true);
    6155        Awaitility.await().atMost(Durations.ONE_SECOND).until(tile::isLoaded);
    6256        if (isLoaded) {
    63             Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> tile.getLayers() != null && tile.getLayers().size() > 1);
     57            Awaitility.await().atMost(Durations.ONE_SECOND).until(() -> tile.getImage() == MVTTile.CLEAR_LOADED);
    6458            assertEquals(2, tile.getLayers().size());
    6559            assertEquals(4096, tile.getExtent());
    6660            // Ensure that we have the clear image set, such that the tile doesn't add to the dataset again