Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Improve test stability #14853

Merged
merged 1 commit into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@
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;
Expand Down Expand Up @@ -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"));
Expand All @@ -54,8 +50,8 @@ public void testEmptyFeatureCollection() {
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"));
Expand All @@ -66,8 +62,8 @@ public void testPointFeatureCollection() {
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"));
Expand All @@ -78,8 +74,8 @@ public void testMultiPointFeatureCollection() {
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"));
Expand All @@ -90,8 +86,8 @@ public void testPolygonFeatureCollection() {
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"));
Expand All @@ -102,8 +98,8 @@ public void testMultiPolygonFeatureCollection() {
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"));
Expand All @@ -114,8 +110,8 @@ public void testLineStringFeatureCollection() {
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"));
Expand Down Expand Up @@ -149,18 +145,4 @@ public void testNegativeNumberPropertyConversion() {
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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ImageMissingTest {
}
}

if (!latch.await(5, TimeUnit.SECONDS)) {
if (!latch.await(10, TimeUnit.SECONDS)) {
throw TimeoutException()
}
}
Expand All @@ -53,7 +53,7 @@ class ImageMissingTest {
}
}

if (!latch.await(5, TimeUnit.SECONDS)) {
if (!latch.await(10, TimeUnit.SECONDS)) {
throw TimeoutException()
}
}
Expand Down