diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry')
2 files changed, 0 insertions, 213 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 deleted file mode 100644 index 81d10a5f15..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java +++ /dev/null @@ -1,148 +0,0 @@ -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.Point; -import com.mapbox.geojson.Polygon; -import com.mapbox.mapboxsdk.geometry.LatLng; -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.GeoJsonSource; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; -import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; -import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils; -import org.junit.Test; - -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.matcher.ViewMatchers.isRoot; -import static com.mapbox.geojson.Feature.fromGeometry; -import static com.mapbox.geojson.FeatureCollection.fromFeatures; -import static com.mapbox.geojson.GeometryCollection.fromGeometries; -import static com.mapbox.geojson.LineString.fromLngLats; -import static com.mapbox.geojson.MultiLineString.fromLineString; -import static com.mapbox.geojson.MultiPolygon.fromPolygon; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; -import static org.junit.Assert.assertFalse; - -/** - * Instrumentation test to validate java geojson conversion to c++ - */ -public class GeoJsonConversionTest extends EspressoTest { - - // Regression test for #12343 - @Test - @UiThreadTest - public void testEmptyFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList())))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testPointFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0)))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testMultiPointFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testPolygonFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList())))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testMultiPolygonFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testLineStringFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - @Test - @UiThreadTest - public void testMultiLineStringFeatureCollection() { - validateTestSetup(); - mapboxMap.getStyle().addSource( - new GeoJsonSource("test-id", - fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - } - - - @Test - public void testNegativeNumberPropertyConversion() { - validateTestSetup(); - onView(isRoot()).perform(new MapboxMapAction((uiController, mapboxMap) -> { - LatLng latLng = new LatLng(); - Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())); - - JsonArray foregroundJsonArray = new JsonArray(); - foregroundJsonArray.add(0f); - foregroundJsonArray.add(-3f); - feature.addProperty("property", foregroundJsonArray); - - GeoJsonSource source = new GeoJsonSource("source", feature); - mapboxMap.getStyle().addSource(source); - - SymbolLayer layer = new SymbolLayer("layer", "source") - .withProperties( - PropertyFactory.iconOffset(Expression.get("property")), - PropertyFactory.iconImage("zoo-15") - ); - mapboxMap.getStyle().addLayer(layer); - - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); - - assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng)).isEmpty()); - }, mapboxMap)); - } -}
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java deleted file mode 100644 index 607d7cd635..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/LatLngBoundsTest.java +++ /dev/null @@ -1,65 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.geometry; - -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.geometry.LatLngBounds; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; -import com.mapbox.mapboxsdk.testapp.activity.BaseTest; -import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity; -import com.mapbox.mapboxsdk.testapp.utils.TestConstants; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; - -/** - * Instrumentation test to validate integration of LatLngBounds - */ -public class LatLngBoundsTest extends BaseTest { - - private static final double MAP_BEARING = 50; - - @Override - protected Class getActivityClass() { - return QueryRenderedFeaturesBoxHighlightActivity.class; - } - - @Test - public void testLatLngBounds() { - // regression test for #9322 - validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { - LatLngBounds bounds = new LatLngBounds.Builder() - .include(new LatLng(48.8589506, 2.2773457)) - .include(new LatLng(47.2383171, -1.6309316)) - .build(); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); - }); - } - - @Test - public void testLatLngBoundsBearing() { - // regression test for #12549 - validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { - LatLngBounds bounds = new LatLngBounds.Builder() - .include(new LatLng(48.8589506, 2.2773457)) - .include(new LatLng(47.2383171, -1.6309316)) - .build(); - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); - mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(MAP_BEARING)); - assertEquals( - "Initial bearing should match for latlngbounds", - mapboxMap.getCameraPosition().bearing, - MAP_BEARING, - TestConstants.BEARING_DELTA - ); - - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0)); - assertEquals("Bearing should match after resetting latlngbounds", - mapboxMap.getCameraPosition().bearing, - MAP_BEARING, - TestConstants.BEARING_DELTA); - }); - } - -}
\ No newline at end of file |