From 73f564c3f09b4396c31070c8811625140a6849ce Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 5 Jun 2019 14:37:00 +0200 Subject: [android] - increase timeout of image missing test, use GeoJsonSource above CustomGeometrySource --- .../testapp/geometry/GeoJsonConversionTest.java | 46 +++++++--------------- .../mapboxsdk/testapp/maps/ImageMissingTest.kt | 4 +- 2 files changed, 16 insertions(+), 34 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java index f30b3aa8cf..81d10a5f15 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java @@ -3,17 +3,13 @@ package com.mapbox.mapboxsdk.testapp.geometry; import android.support.test.annotation.UiThreadTest; import com.google.gson.JsonArray; import com.mapbox.geojson.Feature; -import com.mapbox.geojson.FeatureCollection; import com.mapbox.geojson.Point; import com.mapbox.geojson.Polygon; import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.layers.PropertyFactory; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; -import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import com.mapbox.mapboxsdk.style.sources.GeometryTileProvider; import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils; @@ -42,8 +38,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testEmptyFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList()))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList())))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -54,8 +50,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testPointFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0)))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -66,8 +62,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testMultiPointFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -78,8 +74,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testPolygonFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList()))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList())))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -90,8 +86,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testMultiPolygonFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList())))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList()))))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -102,8 +98,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testLineStringFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -114,8 +110,8 @@ public class GeoJsonConversionTest extends EspressoTest { public void testMultiLineStringFeatureCollection() { validateTestSetup(); mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList())))))) + new GeoJsonSource("test-id", + fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList()))))) ) ); mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); @@ -149,18 +145,4 @@ public class GeoJsonConversionTest extends EspressoTest { assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng)).isEmpty()); }, mapboxMap)); } - - class CustomProvider implements GeometryTileProvider { - - private FeatureCollection featureCollection; - - CustomProvider(FeatureCollection featureCollection) { - this.featureCollection = featureCollection; - } - - @Override - public FeatureCollection getFeaturesForBounds(LatLngBounds bounds, int zoom) { - return featureCollection; - } - } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt index d836185fc4..4de4b1d55b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt @@ -39,7 +39,7 @@ class ImageMissingTest { } } - if (!latch.await(5, TimeUnit.SECONDS)) { + if (!latch.await(10, TimeUnit.SECONDS)) { throw TimeoutException() } } @@ -53,7 +53,7 @@ class ImageMissingTest { } } - if (!latch.await(5, TimeUnit.SECONDS)) { + if (!latch.await(10, TimeUnit.SECONDS)) { throw TimeoutException() } } -- cgit v1.2.1