summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun Van Nuland <tobrun.van.nuland@gmail.com>2017-04-25 14:07:02 +0200
committerTobrun Van Nuland <tobrun.van.nuland@gmail.com>2017-04-25 14:07:02 +0200
commitb4a953567b183c072ae0cf2e54b8170dfada7dee (patch)
tree2d0de2e74f42456d030c5d3546ad6de529d626c4
parent716fe352ea50ebedf3583784881ba3c8aad9b0ec (diff)
downloadqtlocation-mapboxgl-upstream/tvn-test-extrusions.tar.gz
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java809
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java123
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java129
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java88
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java83
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java237
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java236
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java157
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java236
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java43
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java42
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java59
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java43
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java214
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java135
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/FillExtrusionTest.java (renamed from platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java)30
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java227
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java243
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java15
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java1328
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java760
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java723
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java188
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java1293
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java446
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java61
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java310
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java3815
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs392
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java24
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_fill_extrusion_layer.xml7
-rw-r--r--platform/android/build.gradle2
-rw-r--r--platform/android/gradle/wrapper/gradle-wrapper.properties4
m---------platform/ios/vendor/SMCalloutView0
35 files changed, 34 insertions, 12495 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
deleted file mode 100644
index a813b7f368..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
+++ /dev/null
@@ -1,809 +0,0 @@
-package com.mapbox.mapboxsdk.maps;
-
-import android.graphics.Color;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.annotations.Polygon;
-import com.mapbox.mapboxsdk.annotations.PolygonOptions;
-import com.mapbox.mapboxsdk.annotations.Polyline;
-import com.mapbox.mapboxsdk.annotations.PolylineOptions;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static junit.framework.TestCase.assertFalse;
-import static junit.framework.TestCase.assertNotNull;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-/**
- * This test is responsible for testing the public API.
- * <p>
- * Methods executed on MapboxMap are called from a ViewAction to ensure correct synchronisation
- * with the application UI-thread.
- * </p>
- */
-public class MapboxMapTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- public void testSanity() {
- validateTestSetup();
- assertNotNull("mapboxMap should not be null", mapboxMap);
- }
-
- //
- // Style wide transition options
- //
-
- @Test
- public void testTransitionDuration() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- long transitionDuration = 600;
- mapboxMap.setTransitionDuration(transitionDuration);
- assertEquals("TransitionDuration should match", transitionDuration, mapboxMap.getTransitionDuration(), 0);
- }
- }));
- }
-
- @Test
- public void testTransitionDelay() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- long transitionDelay = 50;
- mapboxMap.setTransitionDelay(transitionDelay);
- assertEquals("TransitionDelay should match", transitionDelay, mapboxMap.getTransitionDelay(), 0);
- }
- }));
- }
-
- //
- // CameraForLatLngBounds
- //
- @Test
- public void testCameraForLatLngBounds() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- // set
- mapboxMap.setLatLngBoundsForCameraTarget(
- new LatLngBounds.Builder().include(new LatLng()).include(new LatLng(1, 1)).build());
- // reset
- mapboxMap.setLatLngBoundsForCameraTarget(null);
- }
- }));
- }
-
- //
- // MinZoomLevel
- //
-
- @Test
- public void testMinZoom() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setMinZoomPreference(10);
- assertEquals("MinZoom should match", 10, mapboxMap.getMinZoomLevel(), 10);
- }
- }));
- }
-
- @Test
- public void testMaxZoom() {
- validateTestSetup();
- final double zoom = 10;
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setMaxZoomPreference(zoom);
- assertEquals("MaxZoom should match", zoom, mapboxMap.getMaxZoomLevel(), 10);
- }
- }));
- }
-
- @Test
- @Ignore
- public void testInitialZoomLevels() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertEquals("MaxZoom should match", MapboxConstants.MAXIMUM_ZOOM, mapboxMap.getMaxZoomLevel(),
- TestConstants.ZOOM_DELTA);
- assertEquals("MinZoom should match", MapboxConstants.MINIMUM_ZOOM, mapboxMap.getMinZoomLevel(),
- TestConstants.ZOOM_DELTA);
- }
- }));
- }
-
- //
- // TrackingSettings
- //
-
- @Test
- public void testTrackingSettings() {
- validateTestSetup();
- assertNotNull("TrackingSettings should not be null", mapboxMap.getTrackingSettings());
- }
-
- //
- // InfoWindow
- //
-
- @Test
- public void testConcurrentInfoWindowEnabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(true);
- assertTrue("ConcurrentWindows should be true", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows());
- }
- }));
- }
-
- @Test
- public void testConcurrentInfoWindowDisabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setAllowConcurrentMultipleOpenInfoWindows(false);
- assertFalse("ConcurrentWindows should be false", mapboxMap.isAllowConcurrentMultipleOpenInfoWindows());
- }
- }));
- }
-
- @Test
- public void testInfoWindowAdapter() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MapboxMap.InfoWindowAdapter infoWindowAdapter = new MapboxMap.InfoWindowAdapter() {
- @Nullable
- @Override
- public View getInfoWindow(@NonNull Marker marker) {
- return null;
- }
- };
- mapboxMap.setInfoWindowAdapter(infoWindowAdapter);
- assertEquals("InfoWindowAdpter should be the same", infoWindowAdapter, mapboxMap.getInfoWindowAdapter());
- }
- }));
- }
-
- //
- // Location
- //
-
- @Test
- @Ignore /* disabled due to enabling permissions during test #7177 */
- public void testMyLocationEnabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setMyLocationEnabled(true);
- assertTrue("MyLocationEnabled should be true", mapboxMap.isMyLocationEnabled());
- }
- }));
- }
-
- @Test
- @Ignore /* can't create handler inside thread that not called Looper.prepare() */
- public void testMyLocationDisabled() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.setMyLocationEnabled(false);
- assertFalse("MyLocationEnabled should be false", mapboxMap.isMyLocationEnabled());
- }
- }));
- }
-
- //
- // setters/getters interfaces
- //
-
- @Test
- public void testFpsListener() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MapboxMap.OnFpsChangedListener fpsChangedListener = new MapboxMap.OnFpsChangedListener() {
- @Override
- public void onFpsChanged(double fps) {
-
- }
- };
- mapboxMap.setOnFpsChangedListener(fpsChangedListener);
- assertEquals("FpsListener should match", fpsChangedListener, mapboxMap.getOnFpsChangedListener());
- }
- }));
- }
-
- @Test
- public void testInfoWindowClickListener() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MapboxMap.OnInfoWindowClickListener clickListener = new MapboxMap.OnInfoWindowClickListener() {
- @Override
- public boolean onInfoWindowClick(@NonNull Marker marker) {
- return false;
- }
- };
- mapboxMap.setOnInfoWindowClickListener(clickListener);
- assertEquals("InfoWidowClickListener should match", clickListener, mapboxMap.getOnInfoWindowClickListener());
- }
- }));
- }
-
- @Test
- public void testInfoWindowCloseListener() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MapboxMap.OnInfoWindowCloseListener listener = new MapboxMap.OnInfoWindowCloseListener() {
- @Override
- public void onInfoWindowClose(Marker marker) {
-
- }
- };
- mapboxMap.setOnInfoWindowCloseListener(listener);
- assertEquals("InfoWindowCloseListener should match", listener, mapboxMap.getOnInfoWindowCloseListener());
- }
- }));
- }
-
- @Test
- public void testInfoWindowLongClickListener() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MapboxMap.OnInfoWindowLongClickListener listener = new MapboxMap.OnInfoWindowLongClickListener() {
- @Override
- public void onInfoWindowLongClick(Marker marker) {
-
- }
- };
- mapboxMap.setOnInfoWindowLongClickListener(listener);
- assertEquals("InfoWindowLongClickListener should match", listener,
- mapboxMap.getOnInfoWindowLongClickListener());
- }
- }));
- }
-
- //
- // Annotations
- //
-
- @Test
- public void testAddMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- assertTrue("Marker should be contained", mapboxMap.getMarkers().contains(marker));
- }
- }));
- }
-
- @Test(expected = InvalidMarkerPositionException.class)
- public void testAddMarkerInvalidPosition() {
- new MarkerOptions().getMarker();
- }
-
- @Test
- public void testAddMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().position(new LatLng()).title("a");
- MarkerOptions markerOptions2 = new MarkerOptions().position(new LatLng()).title("b");
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 2", 2, mapboxMap.getMarkers().size());
- assertTrue(mapboxMap.getMarkers().contains(markers.get(0)));
- assertTrue(mapboxMap.getMarkers().contains(markers.get(1)));
- }
- }));
- }
-
- @Test
- public void testAddMarkersEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 0", 0, mapboxMap.getMarkers().size());
- }
- }));
- }
-
- @Test
- public void testAddMarkersSingleMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions = new MarkerOptions().title("a").position(new LatLng());
- markerList.add(markerOptions);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- assertEquals("Markers size should be 1", 1, mapboxMap.getMarkers().size());
- assertTrue(mapboxMap.getMarkers().contains(markers.get(0)));
- }
- }));
- }
-
- @Test
- public void testAddPolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolygonOptions polygonOptions = new PolygonOptions().add(new LatLng());
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- assertTrue("Polygon should be contained", mapboxMap.getPolygons().contains(polygon));
- }
- }));
- }
-
- @Test
- public void testAddEmptyPolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolygonOptions polygonOptions = new PolygonOptions();
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygon));
- }
- }));
- }
-
- @Test
- public void testAddPolygons() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<PolygonOptions> polygonList = new ArrayList<>();
- PolygonOptions polygonOptions1 = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng());
- PolygonOptions polygonOptions2 = new PolygonOptions().fillColor(Color.WHITE).add(new LatLng());
- PolygonOptions polygonOptions3 = new PolygonOptions();
- polygonList.add(polygonOptions1);
- polygonList.add(polygonOptions2);
- polygonList.add(polygonOptions3);
- mapboxMap.addPolygons(polygonList);
- assertEquals("Polygons size should be 2", 2, mapboxMap.getPolygons().size());
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions1.getPolygon()));
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions2.getPolygon()));
- assertTrue("Polygon should be ignored", !mapboxMap.getPolygons().contains(polygonOptions3.getPolygon()));
- }
- }));
- }
-
- @Test
- public void addPolygonsEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.addPolygons(new ArrayList<PolygonOptions>());
- assertEquals("Polygons size should be 0", 0, mapboxMap.getPolygons().size());
- }
- }));
- }
-
- @Test
- public void addPolygonsSingle() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<PolygonOptions> polygonList = new ArrayList<>();
- PolygonOptions polygonOptions = new PolygonOptions().fillColor(Color.BLACK).add(new LatLng());
- polygonList.add(polygonOptions);
- mapboxMap.addPolygons(polygonList);
- assertEquals("Polygons size should be 1", 1, mapboxMap.getPolygons().size());
- assertTrue(mapboxMap.getPolygons().contains(polygonOptions.getPolygon()));
- }
- }));
- }
-
- @Test
- public void testAddPolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolylineOptions polylineOptions = new PolylineOptions().add(new LatLng());
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- assertTrue("Polyline should be contained", mapboxMap.getPolylines().contains(polyline));
- }
- }));
- }
-
- @Test
- public void testAddEmptyPolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolylineOptions polylineOptions = new PolylineOptions();
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polyline));
- }
- }));
- }
-
- @Test
- public void testAddPolylines() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<PolylineOptions> polylineList = new ArrayList<>();
- PolylineOptions polygonOptions1 = new PolylineOptions().color(Color.BLACK).add(new LatLng());
- PolylineOptions polygonOptions2 = new PolylineOptions().color(Color.WHITE).add(new LatLng());
- PolylineOptions polygonOptions3 = new PolylineOptions();
- polylineList.add(polygonOptions1);
- polylineList.add(polygonOptions2);
- polylineList.add(polygonOptions3);
- mapboxMap.addPolylines(polylineList);
- assertEquals("Polygons size should be 2", 2, mapboxMap.getPolylines().size());
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions1.getPolyline()));
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions2.getPolyline()));
- assertTrue("Polyline should be ignored", !mapboxMap.getPolylines().contains(polygonOptions3.getPolyline()));
- }
- }));
- }
-
- @Test
- public void testAddPolylinesEmpty() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- mapboxMap.addPolylines(new ArrayList<PolylineOptions>());
- assertEquals("Polygons size should be 0", 0, mapboxMap.getPolylines().size());
- }
- }));
- }
-
- @Test
- public void testAddPolylinesSingle() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<PolylineOptions> polylineList = new ArrayList<>();
- PolylineOptions polygonOptions = new PolylineOptions().color(Color.BLACK).add(new LatLng());
- polylineList.add(polygonOptions);
- mapboxMap.addPolylines(polylineList);
- assertEquals("Polygons size should be 1", 1, mapboxMap.getPolylines().size());
- assertTrue(mapboxMap.getPolylines().contains(polygonOptions.getPolyline()));
- }
- }));
- }
-
- @Test
- public void testRemoveMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.removeMarker(marker);
- assertTrue("Markers should be empty", mapboxMap.getMarkers().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemovePolygon() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolygonOptions polygonOptions = new PolygonOptions();
- Polygon polygon = mapboxMap.addPolygon(polygonOptions);
- mapboxMap.removePolygon(polygon);
- assertTrue("Polygons should be empty", mapboxMap.getPolylines().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemovePolyline() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- PolylineOptions polylineOptions = new PolylineOptions();
- Polyline polyline = mapboxMap.addPolyline(polylineOptions);
- mapboxMap.removePolyline(polyline);
- assertTrue("Polylines should be empty", mapboxMap.getPolylines().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemoveAnnotation() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.removeAnnotation(marker);
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemoveAnnotationById() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- mapboxMap.addMarker(markerOptions);
- // id will always be 0 in unit tests
- mapboxMap.removeAnnotation(0);
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemoveAnnotations() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- mapboxMap.addMarkers(markerList);
- mapboxMap.removeAnnotations();
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }
- }));
- }
-
- @Test
- public void testClear() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- mapboxMap.addMarkers(markerList);
- mapboxMap.clear();
- assertTrue("Annotations should be empty", mapboxMap.getAnnotations().isEmpty());
- }
- }));
- }
-
- @Test
- public void testRemoveAnnotationsByList() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- List<BaseMarkerOptions> markerList = new ArrayList<>();
- MarkerOptions markerOptions1 = new MarkerOptions().title("a").position(new LatLng());
- MarkerOptions markerOptions2 = new MarkerOptions().title("b").position(new LatLng());
- markerList.add(markerOptions1);
- markerList.add(markerOptions2);
- List<Marker> markers = mapboxMap.addMarkers(markerList);
- Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng()).title("c"));
- mapboxMap.removeAnnotations(markers);
- assertTrue("Annotations should not be empty", mapboxMap.getAnnotations().size() == 1);
- assertTrue("Marker should be contained", mapboxMap.getAnnotations().contains(marker));
- }
- }));
- }
-
- @Test
- public void testGetAnnotationById() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker initialMarker = mapboxMap.addMarker(markerOptions);
- Marker retrievedMarker = (Marker) mapboxMap.getAnnotation(0);
- assertEquals("Markers should match", initialMarker, retrievedMarker);
- }
- }));
- }
-
- @Test
- public void testGetAnnotations() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertNotNull("Annotations should be non null", mapboxMap.getAnnotations());
- }
- }));
- }
-
- @Test
- public void testGetMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertNotNull("Markers should be non null", mapboxMap.getMarkers());
- }
- }));
- }
-
- @Test
- public void testGetPolygons() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertNotNull("Polygons should be non null", mapboxMap.getPolygons());
- }
- }));
- }
-
- @Test
- public void testGetPolylines() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertNotNull("Polylines should be non null", mapboxMap.getPolylines());
- }
- }));
- }
-
- @Test
- public void testGetSelectedMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- assertNotNull("Selected markers should be non null", mapboxMap.getSelectedMarkers());
- }
- }));
- }
-
- @Test
- public void testSelectMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker);
- assertTrue("Marker should be contained", mapboxMap.getSelectedMarkers().contains(marker));
- }
- }));
- }
-
- @Test
- public void testDeselectMarker() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker);
- mapboxMap.deselectMarker(marker);
- assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty());
- }
- }));
- }
-
- @Test
- public void testDeselectMarkers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- MarkerOptions markerOptions = new MarkerOptions().position(new LatLng());
- Marker marker1 = mapboxMap.addMarker(markerOptions);
- Marker marker2 = mapboxMap.addMarker(markerOptions);
- mapboxMap.selectMarker(marker1);
- mapboxMap.selectMarker(marker2);
- mapboxMap.deselectMarkers();
- assertTrue("Selected markers should be empty", mapboxMap.getSelectedMarkers().isEmpty());
- }
- }));
- }
-
- private class MapboxMapAction implements ViewAction {
-
- private InvokeViewAction invokeViewAction;
-
- MapboxMapAction(InvokeViewAction invokeViewAction) {
- this.invokeViewAction = invokeViewAction;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- invokeViewAction.onViewAction(uiController, view);
- }
- }
-
- interface InvokeViewAction {
- void onViewAction(UiController uiController, View view);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
deleted file mode 100644
index 2f638ff651..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.annotations.MarkerOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.junit.Assert.assertEquals;
-
-public class MarkerTest extends BaseActivityTest {
-
- private Marker marker;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void addMarkerTest() {
- validateTestSetup();
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
-
- MarkerOptions options = new MarkerOptions();
- options.setPosition(new LatLng());
- options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.setTitle(TestConstants.TEXT_MARKER_TITLE);
-
- onView(withId(R.id.mapView)).perform(new AddMarkerAction(mapboxMap, options));
- assertEquals("Markers sze should be 1, ", 1, mapboxMap.getMarkers().size());
- assertEquals("Marker id should be 0", 0, marker.getId());
- assertEquals("Marker target should match", new LatLng(), marker.getPosition());
- assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet());
- assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle());
- mapboxMap.clear();
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
- }
-
- @Test
- @Ignore
- public void showInfoWindowTest() {
- validateTestSetup();
-
- final MarkerOptions options = new MarkerOptions();
- options.setPosition(new LatLng());
- options.setSnippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.setTitle(TestConstants.TEXT_MARKER_TITLE);
-
- onView(withId(R.id.mapView)).perform(new AddMarkerAction(mapboxMap, options));
- onView(withId(R.id.mapView)).perform(new ShowInfoWindowAction(mapboxMap));
- onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed()));
- onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed()));
- }
-
- private class AddMarkerAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private MarkerOptions options;
-
- AddMarkerAction(MapboxMap map, MarkerOptions markerOptions) {
- mapboxMap = map;
- options = markerOptions;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- marker = mapboxMap.addMarker(options);
- }
- }
-
- private class ShowInfoWindowAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- ShowInfoWindowAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.selectMarker(marker);
-
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
deleted file mode 100644
index bee20c3150..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.annotations.Marker;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.annotation.MarkerViewActivity;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.junit.Assert.assertEquals;
-
-public class MarkerViewTest extends BaseActivityTest {
-
- private Marker marker;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void addMarkerViewTest() {
- validateTestSetup();
- assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
-
- TextMarkerViewOptions options = new TextMarkerViewOptions();
- options.text(TestConstants.TEXT_MARKER_TEXT);
- options.position(new LatLng());
- options.snippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.title(TestConstants.TEXT_MARKER_TITLE);
-
- onView(withId(R.id.mapView)).perform(new AddTextMarkerViewAction(mapboxMap, options));
- assertEquals("Markers sze should be 1, ", 1, mapboxMap.getMarkers().size());
- assertEquals("Marker id should be 0", 0, marker.getId());
- assertEquals("Marker target should match", new LatLng(), marker.getPosition());
- assertEquals("Marker snippet should match", TestConstants.TEXT_MARKER_SNIPPET, marker.getSnippet());
- assertEquals("Marker target should match", TestConstants.TEXT_MARKER_TITLE, marker.getTitle());
- onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed()));
- }
-
- @Test
- @Ignore
- public void showInfoWindowTest() {
- validateTestSetup();
-
- final TextMarkerViewOptions options = new TextMarkerViewOptions();
- options.position(new LatLng());
- options.text(TestConstants.TEXT_MARKER_TEXT);
- options.snippet(TestConstants.TEXT_MARKER_SNIPPET);
- options.title(TestConstants.TEXT_MARKER_TITLE);
-
- onView(withId(R.id.mapView)).perform(new AddTextMarkerViewAction(mapboxMap, options));
- onView(withText(TestConstants.TEXT_MARKER_TEXT)).check(matches(isDisplayed()));
- onView(withId(R.id.mapView)).perform(new ShowInfoWindowAction(mapboxMap));
- onView(withText(TestConstants.TEXT_MARKER_TITLE)).check(matches(isDisplayed()));
- onView(withText(TestConstants.TEXT_MARKER_SNIPPET)).check(matches(isDisplayed()));
- }
-
- private class AddTextMarkerViewAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private TextMarkerViewOptions options;
-
- AddTextMarkerViewAction(MapboxMap map, TextMarkerViewOptions markerOptions) {
- mapboxMap = map;
- options = markerOptions;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getMarkerViewManager().addMarkerViewAdapter(
- new MarkerViewActivity.TextAdapter(view.getContext(), mapboxMap));
- marker = mapboxMap.addMarker(options);
- uiController.loopMainThreadForAtLeast(250);
- }
- }
-
- private class ShowInfoWindowAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- ShowInfoWindowAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.selectMarker(marker);
- uiController.loopMainThreadForAtLeast(250);
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
deleted file mode 100644
index 325568bec4..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.graphics.Color;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.annotations.Polygon;
-import com.mapbox.mapboxsdk.annotations.PolygonOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-public class PolygonTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private Polygon polygon;
-
- @Test
- @Ignore
- /** native crash **/
- public void addPolygonTest() {
- validateTestSetup();
- LatLng latLngOne = new LatLng();
- LatLng latLngTwo = new LatLng(1, 0);
- LatLng latLngThree = new LatLng(1, 1);
-
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
-
- final PolygonOptions options = new PolygonOptions();
- options.strokeColor(Color.BLUE);
- options.fillColor(Color.RED);
- options.add(latLngOne);
- options.add(latLngTwo);
- options.add(latLngThree);
-
- onView(withId(R.id.mapView)).perform(new AddPolygonAction(mapboxMap, options));
-
- assertEquals("Polygons should be 1", 1, mapboxMap.getPolygons().size());
- assertEquals("Polygon id should be 0", 0, polygon.getId());
- assertEquals("Polygon points size should match", 3, polygon.getPoints().size());
- assertEquals("Polygon stroke color should match", Color.BLUE, polygon.getStrokeColor());
- assertEquals("Polygon target should match", Color.RED, polygon.getFillColor());
- mapboxMap.clear();
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
- }
-
- private class AddPolygonAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private PolygonOptions options;
-
- AddPolygonAction(MapboxMap map, PolygonOptions polygonOptions) {
- mapboxMap = map;
- options = polygonOptions;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- polygon = mapboxMap.addPolygon(options);
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
deleted file mode 100644
index 91553f7042..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.annotations;
-
-import android.graphics.Color;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.annotations.Polyline;
-import com.mapbox.mapboxsdk.annotations.PolylineOptions;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-public class PolylineTest extends BaseActivityTest {
-
- private Polyline polyline;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Ignore
- @Test
- public void addPolylineTest() {
- validateTestSetup();
- LatLng latLngOne = new LatLng();
- LatLng latLngTwo = new LatLng(1, 0);
-
- assertEquals("Polygons should be empty", 0, mapboxMap.getPolygons().size());
-
- final PolylineOptions options = new PolylineOptions();
- options.color(Color.BLUE);
- options.add(latLngOne);
- options.add(latLngTwo);
-
- onView(withId(R.id.mapView)).perform(new AddPolyLineAction(mapboxMap, options));
-
- assertEquals("Polylines should be 1", 1, mapboxMap.getPolylines().size());
- assertEquals("Polyline id should be 0", 0, polyline.getId());
- assertEquals("Polyline points size should match", 2, polyline.getPoints().size());
- assertEquals("Polyline stroke color should match", Color.BLUE, polyline.getColor());
- mapboxMap.clear();
- assertEquals("Polyline should be empty", 0, mapboxMap.getPolylines().size());
- }
-
- private class AddPolyLineAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private PolylineOptions options;
-
- AddPolyLineAction(MapboxMap map, PolylineOptions polylineOptions) {
- mapboxMap = map;
- options = polylineOptions;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- polyline = mapboxMap.addPolyline(options);
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
deleted file mode 100644
index af1a146ca2..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
+++ /dev/null
@@ -1,237 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import android.graphics.PointF;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-public class CameraAnimateTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void testAnimateToCameraPositionTarget() {
- validateTestSetup();
-
- /*TODO remove zoom #6474*/
- float zoom = 1.0f;
- LatLng moveTarget = new LatLng(1, 1);
-
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(zoom).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.newLatLng(moveTarget)));
- cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToCameraPositionTargetZoom() {
- validateTestSetup();
-
- final float moveZoom = 15.5f;
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToCameraPosition() {
- validateTestSetup();
-
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
- final float moveZoom = 15.5f;
- final float moveTilt = 45.5f;
- final float moveBearing = 12.5f;
-
- onView(withId(R.id.mapView)).perform(
- new AnimateCameraAction(mapboxMap, CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(moveTarget)
- .zoom(moveZoom)
- .tilt(moveTilt)
- .bearing(moveBearing)
- .build()))
- );
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA);
- assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToBounds() {
- validateTestSetup();
-
- final LatLng centerBounds = new LatLng(1, 1);
- LatLng cornerOne = new LatLng();
- LatLng cornerTwo = new LatLng(2, 2);
-
- final LatLngBounds.Builder builder = new LatLngBounds.Builder();
- builder.include(cornerOne);
- builder.include(cornerTwo);
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngBounds(builder.build(), 0)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match center bounds",
- cameraPosition.target.getLatitude(),
- centerBounds.getLatitude(),
- TestConstants.LAT_LNG_DELTA);
-
- assertEquals("Moved camera position longitude should match center bounds",
- cameraPosition.target.getLongitude(),
- centerBounds.getLongitude(),
- TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToMoveBy() {
- validateTestSetup();
-
- final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
- final LatLng moveTarget = new LatLng(2, 2);
- final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget);
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.scrollBy(
- moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- }
-
- @Test
- @Ignore
- public void testAnimateToZoomIn() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.zoomIn()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToZoomOut() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 10.0f;
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)));
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.zoomOut()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToZoomBy() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
- final float zoomBy = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.zoomBy(zoomBy)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testAnimateToZoomTo() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- final float zoomTo = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new AnimateCameraAction(mapboxMap, CameraUpdateFactory.zoomTo(zoomTo)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo,
- TestConstants.ZOOM_DELTA);
- }
-
- private class AnimateCameraAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private CameraUpdate cameraUpdate;
-
- AnimateCameraAction(MapboxMap map, CameraUpdate update) {
- mapboxMap = map;
- cameraUpdate = update;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.animateCamera(cameraUpdate);
- uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME);
- }
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
deleted file mode 100644
index 4fae894039..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import android.graphics.PointF;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-public class CameraEaseTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void testEaseToCameraPositionTarget() {
- validateTestSetup();
-
- /*TODO remove zoom #6474*/
- float zoom = 1.0f;
- LatLng moveTarget = new LatLng(1, 1);
-
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(zoom).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.newLatLng(moveTarget)));
- cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToCameraPositionTargetZoom() {
- validateTestSetup();
-
- final float moveZoom = 15.5f;
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToCameraPosition() {
- validateTestSetup();
-
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
- final float moveZoom = 15.5f;
- final float moveTilt = 45.5f;
- final float moveBearing = 12.5f;
-
- onView(withId(R.id.mapView)).perform(
- new EaseCameraAction(mapboxMap, CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(moveTarget)
- .zoom(moveZoom)
- .tilt(moveTilt)
- .bearing(moveBearing)
- .build()))
- );
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA);
- assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToBounds() {
- validateTestSetup();
-
- final LatLng centerBounds = new LatLng(1, 1);
- LatLng cornerOne = new LatLng();
- LatLng cornerTwo = new LatLng(2, 2);
-
- final LatLngBounds.Builder builder = new LatLngBounds.Builder();
- builder.include(cornerOne);
- builder.include(cornerTwo);
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngBounds(builder.build(), 0)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match center bounds",
- cameraPosition.target.getLatitude(),
- centerBounds.getLatitude(),
- TestConstants.LAT_LNG_DELTA);
-
- assertEquals("Moved camera position longitude should match center bounds",
- cameraPosition.target.getLongitude(),
- centerBounds.getLongitude(),
- TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToMoveBy() {
- validateTestSetup();
-
- final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
- final LatLng moveTarget = new LatLng(2, 2);
- final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget);
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.scrollBy(
- moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- }
-
- @Test
- @Ignore
- public void testEaseToZoomIn() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.zoomIn()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToZoomOut() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 10.0f;
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)));
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.zoomOut()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", 9, cameraPosition.zoom, TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToZoomBy() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
- final float zoomBy = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.zoomBy(zoomBy)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testEaseToZoomTo() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- final float zoomTo = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new EaseCameraAction(mapboxMap, CameraUpdateFactory.zoomTo(zoomTo)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo,
- TestConstants.ZOOM_DELTA);
- }
-
- private class EaseCameraAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private CameraUpdate cameraUpdate;
-
- EaseCameraAction(MapboxMap map, CameraUpdate update) {
- mapboxMap = map;
- cameraUpdate = update;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.easeCamera(cameraUpdate);
- uiController.loopMainThreadForAtLeast(TestConstants.ANIMATION_TEST_TIME);
- }
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java
deleted file mode 100644
index 883e76653d..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import android.support.test.espresso.Espresso;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapViewUtils;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-/**
- * Tests camera transformations that aren't part of our public API
- */
-public class CameraInternalApiTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void testBearing() {
- validateTestSetup();
-
- CameraPosition initialPosition = new
- CameraPosition.Builder().target(new LatLng()).zoom(1).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new BearingAction(mapboxMap));
- assertEquals("Bearing should match", 45.1f, MapViewUtils.getDirection(mapboxMap), TestConstants.BEARING_DELTA);
- }
-
- @Test
- @Ignore
- public void testTilt() {
- validateTestSetup();
-
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(1).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new TiltAction(mapboxMap));
- assertEquals("Tilt should match", 40.0f, MapViewUtils.getTilt(mapboxMap), TestConstants.TILT_DELTA);
- }
-
- @Test
- @Ignore
- public void testLatLng() {
- validateTestSetup();
-
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(1).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new LatLngAction(mapboxMap));
- LatLng centerCoordinate = MapViewUtils.getLatLng(mapboxMap);
- assertEquals("Latitude should match", 1.1f, centerCoordinate.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Longitude should match", 2.2f, centerCoordinate.getLongitude(), TestConstants.LAT_LNG_DELTA);
- }
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
- private class BearingAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- BearingAction(MapboxMap mapboxMap) {
- this.mapboxMap = mapboxMap;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- MapViewUtils.setDirection(mapboxMap, -45.1f);
- }
- }
-
- private class TiltAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- TiltAction(MapboxMap mapboxMap) {
- this.mapboxMap = mapboxMap;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- MapViewUtils.setTilt(mapboxMap, 40.0f);
- }
- }
-
- private class LatLngAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- LatLngAction(MapboxMap mapboxMap) {
- this.mapboxMap = mapboxMap;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- MapViewUtils.setLatLng(mapboxMap, new LatLng(1.1, 2.2));
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
deleted file mode 100644
index ea8398fc8e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.camera;
-
-import android.graphics.PointF;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-
-public class CameraMoveTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore
- public void testMoveToCameraPositionTarget() {
- validateTestSetup();
-
- /*TODO remove zoom #6474*/
- float zoom = 1.0f;
- LatLng moveTarget = new LatLng(1, 1);
-
- CameraPosition initialPosition = new CameraPosition.Builder().target(
- new LatLng()).zoom(zoom).bearing(0).tilt(0).build();
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Default camera position should match default", cameraPosition, initialPosition);
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.newLatLng(moveTarget)));
- cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToCameraPositionTargetZoom() {
- validateTestSetup();
-
- final float moveZoom = 15.5f;
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(moveTarget, moveZoom)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToCameraPosition() {
- validateTestSetup();
-
- final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
- final float moveZoom = 15.5f;
- final float moveTilt = 45.5f;
- final float moveBearing = 12.5f;
-
- onView(withId(R.id.mapView)).perform(
- new MoveCameraAction(mapboxMap, CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(moveTarget)
- .zoom(moveZoom)
- .tilt(moveTilt)
- .bearing(moveBearing)
- .build()))
- );
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.zoom, moveZoom, TestConstants.ZOOM_DELTA);
- assertEquals("Moved zoom should match", cameraPosition.tilt, moveTilt, TestConstants.TILT_DELTA);
- assertEquals("Moved bearing should match", cameraPosition.bearing, moveBearing, TestConstants.BEARING_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToBounds() {
- validateTestSetup();
-
- final LatLng centerBounds = new LatLng(1, 1);
- LatLng cornerOne = new LatLng();
- LatLng cornerTwo = new LatLng(2, 2);
-
- final LatLngBounds.Builder builder = new LatLngBounds.Builder();
- builder.include(cornerOne);
- builder.include(cornerTwo);
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngBounds(builder.build(), 0)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match center bounds",
- cameraPosition.target.getLatitude(),
- centerBounds.getLatitude(),
- TestConstants.LAT_LNG_DELTA);
-
- assertEquals("Moved camera position longitude should match center bounds",
- cameraPosition.target.getLongitude(),
- centerBounds.getLongitude(),
- TestConstants.LAT_LNG_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToMoveBy() {
- validateTestSetup();
-
- final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
- final LatLng moveTarget = new LatLng(2, 2);
- final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget);
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.scrollBy(
- moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y)));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera position latitude should match", cameraPosition.target.getLatitude(),
- moveTarget.getLatitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- assertEquals("Moved camera position longitude should match", cameraPosition.target.getLongitude(),
- moveTarget.getLongitude(), TestConstants.LAT_LNG_DELTA_LARGE);
- }
-
- @Test
- @Ignore
- public void testMoveToZoomIn() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.zoomIn()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + 1,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToZoomOut() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 10.0f;
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
- CameraUpdateFactory.newLatLngZoom(new LatLng(), zoom)));
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.zoomOut()));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom - 1,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToZoomBy() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- float zoom = 1.0f;
- final float zoomBy = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.zoomBy(zoomBy)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoom + zoomBy,
- TestConstants.ZOOM_DELTA);
- }
-
- @Test
- @Ignore
- public void testMoveToZoomTo() {
- validateTestSetup();
-
- /*TODO fix zoom #6474*/
- final float zoomTo = 2.45f;
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap, CameraUpdateFactory.zoomTo(zoomTo)));
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Moved camera zoom should match moved camera zoom", cameraPosition.zoom, zoomTo,
- TestConstants.ZOOM_DELTA);
- }
-
- private class MoveCameraAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private CameraUpdate cameraUpdate;
-
- MoveCameraAction(MapboxMap map, CameraUpdate update) {
- mapboxMap = map;
- cameraUpdate = update;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.moveCamera(cameraUpdate);
- uiController.loopMainThreadForAtLeast(100);
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java
deleted file mode 100644
index 5ef93c72b3..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.feature;
-
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxCountActivity;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-
-/**
- * Instrumentation test to validate if clicking on the blue rectangle from
- * QueryRenderedFeaturesBoxSymbolCountActivity shows a Toast that 149 features were found.
- */
-public class QueryRenderedFeaturesBoxCountTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return QueryRenderedFeaturesBoxCountActivity.class;
- }
-
- @Test
- @Ignore
- public void testCountFeatures() {
- // click on box to query map
- onView(withId(R.id.selection_box)).perform(click());
-
- // validate if toast is shown
- onView(withText("149 features in box"))
- .inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView()))))
- .check(matches(isDisplayed()));
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java
deleted file mode 100644
index 307700e847..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.feature;
-
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-
-/**
- * Instrumentation test to validate if clicking box on screen highlights features.
- */
-public class QueryRenderedFeaturesHighlightTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return QueryRenderedFeaturesBoxHighlightActivity.class;
- }
-
- @Test
- @Ignore
- public void testCountFeatures() {
- // click on box to query map
- onView(withId(R.id.selection_box)).perform(click());
-
- // validate if toast is shown
- onView(withText("50 features in box"))
- .inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView()))))
- .check(matches(isDisplayed()));
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java
deleted file mode 100644
index 8e6987b712..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.feature;
-
-import android.graphics.PointF;
-import android.support.test.espresso.ViewAction;
-import android.support.test.espresso.action.CoordinatesProvider;
-import android.support.test.espresso.action.GeneralClickAction;
-import android.support.test.espresso.action.Press;
-import android.support.test.espresso.action.Tap;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesPropertiesActivity;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-
-/**
- * Instrumentation test to validate if clicking center of screen returns the correct features.
- */
-public class QueryRenderedFeaturesPropertiesTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return QueryRenderedFeaturesPropertiesActivity.class;
- }
-
- @Test
- @Ignore
- public void testCountFeatures() {
- LatLng centerScreen = mapboxMap.getCameraPosition().target;
- PointF centerPixel = mapboxMap.getProjection().toScreenLocation(centerScreen);
- onView(withId(R.id.mapView)).perform(clickXY(centerPixel.x, centerPixel.y));
- onView(withText("Found 4 features")).check(matches(isDisplayed()));
- }
-
- private static ViewAction clickXY(final float x, final float y) {
- return new GeneralClickAction(
- Tap.SINGLE,
- new CoordinatesProvider() {
- @Override
- public float[] calculateCoordinates(View view) {
- final int[] screenPos = new int[2];
- view.getLocationOnScreen(screenPos);
- final float screenX = screenPos[0] + x;
- final float screenY = screenPos[1] + y;
- return new float[] {screenX, screenY};
- }
- },
- Press.FINGER);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java
deleted file mode 100644
index a31c3db89e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.feature;
-
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxSymbolCountActivity;
-
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.RootMatchers.withDecorView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.not;
-
-/**
- * Instrumentation test to validate if clicking on the blue rectangle from
- * QueryRenderedFeaturesBoxSymbolCountActivity shows a Toast that 2 symbols were found.
- */
-public class QueryRenderedSymbolBoxCountTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return QueryRenderedFeaturesBoxSymbolCountActivity.class;
- }
-
- @Test
- @Ignore
- public void testCountSymbols() {
- // click on box to query map
- onView(withId(R.id.selection_box)).perform(click());
-
- // validate if toast is shown
- onView(withText("2 features in box"))
- .inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView()))))
- .check(matches(isDisplayed()));
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
deleted file mode 100644
index d37c6db2d5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.net.Uri;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.espresso.intent.Intents;
-import android.text.Html;
-import android.text.SpannableStringBuilder;
-import android.text.TextUtils;
-import android.text.style.URLSpan;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.sources.Source;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onData;
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.intent.Intents.intended;
-import static android.support.test.espresso.intent.Intents.intending;
-import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction;
-import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static android.support.test.espresso.matcher.ViewMatchers.withText;
-import static org.hamcrest.CoreMatchers.allOf;
-import static org.hamcrest.CoreMatchers.anything;
-import static org.hamcrest.core.IsNot.not;
-
-public class AttributionTest extends BaseActivityTest {
-
- private URLSpan[] urlSpans;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Before
- public void beforeTest() {
- super.beforeTest();
- Intents.init();
- }
-
- @Test
- public void testDisabled() {
- validateTestSetup();
-
- // Default
- onView(withId(R.id.attributionView)).check(matches(isDisplayed()));
-
- // Disabled
- onView(withId(R.id.attributionView))
- .perform(new DisableAction(mapboxMap))
- .check(matches(not(isDisplayed())));
- }
-
- @Test
- public void testMapboxStreetsMapboxAttributionLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = allOf(hasAction(Intent.ACTION_VIEW), hasData(Uri.parse(urlSpans[0].getURL())));
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(0).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- public void testMapboxStreetsOpenStreetMapAttributionLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = allOf(hasAction(Intent.ACTION_VIEW), hasData(Uri.parse(urlSpans[1].getURL())));
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(1).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- public void testImproveMapLink() {
- validateTestSetup();
- if (urlSpans == null) {
- buildUrlSpans();
- }
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // test for trigger url intent
- Matcher<Intent> expectedIntent = hasAction(Intent.ACTION_VIEW);
- intending(expectedIntent).respondWith(new Instrumentation.ActivityResult(0, null));
-
- // click item and test for url
- onData(anything()).inAdapterView(withId(R.id.select_dialog_listview)).atPosition(2).perform(click());
- intended(expectedIntent);
- }
-
- @Test
- public void testTelemetryDialog() {
- validateTestSetup();
-
- // click on View to open dialog
- onView(withId(R.id.attributionView)).perform(click());
- onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
-
- // click on item to open second dialog
- onView(withText(R.string.mapbox_telemetrySettings)).perform(click());
- onView(withText(R.string.mapbox_attributionTelemetryTitle)).check(matches(isDisplayed()));
- }
-
- @After
- public void afterTest() {
- super.afterTest();
- Intents.release();
- }
-
- private void buildUrlSpans() {
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- for (Source source : mapboxMap.getSources()) {
- String attributionSource = source.getAttribution();
- if (!TextUtils.isEmpty(attributionSource)) {
- SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource);
- urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class);
- }
- }
- }
- }));
- }
-
- private class DisableAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- DisableAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getUiSettings().setAttributionEnabled(false);
- }
- }
-
- private class MapboxMapAction implements ViewAction {
-
- private InvokeViewAction invokeViewAction;
-
- MapboxMapAction(InvokeViewAction invokeViewAction) {
- this.invokeViewAction = invokeViewAction;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- invokeViewAction.onViewAction(uiController, view);
- }
- }
-
- interface InvokeViewAction {
- void onViewAction(UiController uiController, View view);
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
deleted file mode 100644
index f15605042b..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdate;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-
-import org.hamcrest.Matcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.action.ViewActions.click;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.hamcrest.Matchers.not;
-import static org.junit.Assert.assertEquals;
-
-public class CompassViewTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- public void testDefault() {
- validateTestSetup();
- onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
- }
-
- @Test
- public void testVisible() {
- validateTestSetup();
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
- CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .bearing(45)
- .zoom(1)
- .target(new LatLng())
- .build()
- )
- )
- );
- waitLoop();
- onView(withId(R.id.compassView)).check(matches(isDisplayed()));
- }
-
- @Test
- @Ignore // 10-31-2016 click action is not working
- public void testClick() {
- validateTestSetup();
-
- onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
- CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .bearing(45)
- .zoom(1)
- .target(new LatLng())
- .build()
- )
- )
- );
-
- waitLoop();
- onView(withId(R.id.compassView)).perform(click());
- onView(withId(R.id.mapView)).perform(new WaitAction(3000));
- onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
-
- CameraPosition cameraPosition = mapboxMap.getCameraPosition();
- assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA);
- }
-
- private class WaitAction implements ViewAction {
-
- private long waitTime;
-
- WaitAction(long waitTime) {
- this.waitTime = waitTime;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- uiController.loopMainThreadForAtLeast(waitTime);
- }
- }
-
- private class MoveCameraAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private CameraUpdate cameraUpdate;
-
- MoveCameraAction(MapboxMap map, CameraUpdate update) {
- mapboxMap = map;
- cameraUpdate = update;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.moveCamera(cameraUpdate);
- }
- }
-}
-
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/FillExtrusionTest.java
index 0c189aa316..1b613966f7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/FillExtrusionTest.java
@@ -4,10 +4,12 @@ import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.view.View;
+import com.mapbox.mapboxsdk.maps.MapViewUtils;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
+import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionActivity;
import org.hamcrest.Matcher;
import org.junit.Test;
@@ -18,33 +20,24 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.not;
-public class LogoTest extends BaseActivityTest {
+public class FillExtrusionTest extends BaseActivityTest {
@Override
protected Class getActivityClass() {
- return EspressoTestActivity.class;
+ return FillExtrusionActivity.class;
}
@Test
- public void testDefault() {
+ public void testRotate() {
validateTestSetup();
- onView(withId(R.id.logoView)).check(matches(isDisplayed()));
+ onView(withId(R.id.mapView)).perform(new RotateAction(mapboxMap));
}
- @Test
- public void testDisabled() {
- validateTestSetup();
-
- onView(withId(R.id.logoView))
- .perform(new DisableAction(mapboxMap))
- .check(matches(not(isDisplayed())));
- }
-
- private class DisableAction implements ViewAction {
+ private class RotateAction implements ViewAction {
private MapboxMap mapboxMap;
- DisableAction(MapboxMap map) {
+ RotateAction(MapboxMap map) {
mapboxMap = map;
}
@@ -60,7 +53,12 @@ public class LogoTest extends BaseActivityTest {
@Override
public void perform(UiController uiController, View view) {
- mapboxMap.getUiSettings().setLogoEnabled(false);
+ int i = 0;
+ while(i < 360){
+ MapViewUtils.setDirection(mapboxMap, i);
+ i += 5;
+ uiController.loopMainThreadForAtLeast(20);
+ }
}
}
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java
deleted file mode 100644
index efd67db356..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.maps.widgets;
-
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.camera.CameraPosition;
-import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
-import com.mapbox.mapboxsdk.constants.MyBearingTracking;
-import com.mapbox.mapboxsdk.constants.MyLocationTracking;
-import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.location.LocationSource;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.maps.widgets.MyLocationView;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-import org.hamcrest.Description;
-import org.hamcrest.Matcher;
-import org.hamcrest.TypeSafeMatcher;
-import org.junit.Ignore;
-import org.junit.Test;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.hamcrest.Matchers.not;
-
-/**
- * Experimental MyLocationView tests,
- * requires application to be granted with runtime location permissions.
- * <p>
- * Tests for enabling and disabling the {@link MyLocationView}.
- * Tests for enabling tracking modes and if the correct default images are shown when toggling
- * {@link com.mapbox.mapboxsdk.maps.TrackingSettings#setMyLocationTrackingMode(int)} &
- * {@link com.mapbox.mapboxsdk.maps.TrackingSettings#setMyBearingTrackingMode(int)}.
- * </p>
- */
-public class MyLocationViewTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- @Test
- @Ignore // requires runtime permissions, disabled for CI
- public void testEnabled() {
- validateTestSetup();
- onView(withId(R.id.userLocationView)).check(matches(not(isDisplayed())));
- onView(withId(R.id.mapView)).perform(new ToggleLocationAction(mapboxMap, true));
- onView(withId(R.id.userLocationView)).check(matches(isDisplayed()));
- onView(withId(R.id.mapView)).perform(new ToggleLocationAction(mapboxMap, false));
- onView(withId(R.id.userLocationView)).check(matches(not(isDisplayed())));
- }
-
- @Test
- @Ignore
- // requires runtime permissions, disabled for CI + issue with android.support.test.espresso.AppNotIdleException:
- // Looped for 5049 iterations over 60 SECONDS.
- public void testTracking() {
- validateTestSetup();
- onView(withId(R.id.userLocationView)).check(matches(not(isDisplayed())));
- onView(withId(R.id.mapView)).perform(new EnableLocationTrackingAction(mapboxMap));
- onView(withId(R.id.userLocationView)).check(matches(isDisplayed()));
- onView(withId(R.id.userLocationView)).check(matches(new DrawableMatcher(mapboxMap,
- R.drawable.mapbox_mylocation_icon_default, false)));
- onView(withId(R.id.mapView)).perform(new EnableCompassBearingTrackingAction(mapboxMap));
- onView(withId(R.id.userLocationView)).check(matches(new DrawableMatcher(mapboxMap,
- R.drawable.mapbox_mylocation_icon_bearing, true)));
- }
-
- private class ToggleLocationAction implements ViewAction {
-
- private MapboxMap mapboxMap;
- private boolean isEnabled;
-
- ToggleLocationAction(MapboxMap map, boolean enable) {
- mapboxMap = map;
- isEnabled = enable;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- if (isEnabled) {
- // move camera above user location
- mapboxMap.moveCamera(
- CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(new LatLng(LocationSource.getLocationEngine(view.getContext()).getLastLocation()))
- .build()
- )
- );
- }
-
- // show loction on screen
- mapboxMap.setMyLocationEnabled(isEnabled);
- }
- }
-
- private class EnableLocationTrackingAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- EnableLocationTrackingAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getTrackingSettings().setMyLocationTrackingMode(MyLocationTracking.TRACKING_FOLLOW);
- }
- }
-
- private class EnableCompassBearingTrackingAction implements ViewAction {
-
- private MapboxMap mapboxMap;
-
- EnableCompassBearingTrackingAction(MapboxMap map) {
- mapboxMap = map;
- }
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- @Override
- public void perform(UiController uiController, View view) {
- mapboxMap.getTrackingSettings().setMyBearingTrackingMode(MyBearingTracking.COMPASS);
- // wait for next compass update cycle
- uiController.loopMainThreadForAtLeast(500);
- }
- }
-
- private class DrawableMatcher extends TypeSafeMatcher<View> {
-
- private MapboxMap mapboxMap;
- private boolean isBearingDrawable;
- private final int expectedId;
-
- DrawableMatcher(MapboxMap mapboxMap, int expectedId, boolean isBearingDrawable) {
- super(MyLocationView.class);
- this.mapboxMap = mapboxMap;
- this.expectedId = expectedId;
- this.isBearingDrawable = isBearingDrawable;
- }
-
- @Override
- protected boolean matchesSafely(View target) {
- Drawable currentDrawable = isBearingDrawable
- ? mapboxMap.getMyLocationViewSettings().getForegroundBearingDrawable() :
- mapboxMap.getMyLocationViewSettings().getForegroundDrawable();
-
- Resources resources = target.getContext().getResources();
- Drawable expectedDrawable = resources.getDrawable(expectedId);
- return areDrawablesIdentical(currentDrawable, expectedDrawable);
- }
-
- @Override
- public void describeTo(Description description) {
- description.appendText("trying to match MyLocationView drawable to " + expectedId);
- }
-
- boolean areDrawablesIdentical(Drawable drawableA, Drawable drawableB) {
- Drawable.ConstantState stateA = drawableA.getConstantState();
- Drawable.ConstantState stateB = drawableB.getConstantState();
- return (stateA != null && stateB != null && stateA.equals(stateB))
- || getBitmap(drawableA).sameAs(getBitmap(drawableB));
- }
-
- Bitmap getBitmap(Drawable drawable) {
- Bitmap result;
- if (drawable instanceof BitmapDrawable) {
- result = ((BitmapDrawable) drawable).getBitmap();
- } else {
- int width = drawable.getIntrinsicWidth();
- int height = drawable.getIntrinsicHeight();
- // Some drawables have no intrinsic width - e.g. solid colours.
- if (width <= 0) {
- width = 1;
- }
- if (height <= 0) {
- height = 1;
- }
-
- result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(result);
- drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
- drawable.draw(canvas);
- }
- return result;
- }
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
deleted file mode 100644
index 851660f06e..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for BackgroundLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class BackgroundLayerTest extends BaseActivityTest {
-
- private BackgroundLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- Timber.i("Retrieving layer");
- layer = mapboxMap.getLayerAs("background");
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testBackgroundColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundColorTransition(options);
- assertEquals(layer.getBackgroundColorTransition(), options);
- }
-
- @Test
- public void testBackgroundColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(backgroundColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getBackgroundColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testBackgroundColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- backgroundColor(
- zoom(
- exponential(
- stop(2, backgroundColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getBackgroundColor());
- assertNotNull(layer.getBackgroundColor().getFunction());
- assertEquals(CameraFunction.class, layer.getBackgroundColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getBackgroundColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getBackgroundColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testBackgroundColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(backgroundColor(Color.RED));
- assertEquals(layer.getBackgroundColorAsInt(), Color.RED);
- }
-
- @Test
- public void testBackgroundPatternTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundPatternTransition(options);
- assertEquals(layer.getBackgroundPatternTransition(), options);
- }
-
- @Test
- public void testBackgroundPatternAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-pattern");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(backgroundPattern("pedestrian-polygon"));
- assertEquals((String) layer.getBackgroundPattern().getValue(), (String) "pedestrian-polygon");
- }
-
- @Test
- public void testBackgroundPatternAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-pattern");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- backgroundPattern(
- zoom(
- interval(
- stop(2, backgroundPattern("pedestrian-polygon"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getBackgroundPattern());
- assertNotNull(layer.getBackgroundPattern().getFunction());
- assertEquals(CameraFunction.class, layer.getBackgroundPattern().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getBackgroundPattern().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getBackgroundPattern().getFunction().getStops()).size());
- }
-
- @Test
- public void testBackgroundOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setBackgroundOpacityTransition(options);
- assertEquals(layer.getBackgroundOpacityTransition(), options);
- }
-
- @Test
- public void testBackgroundOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(backgroundOpacity(0.3f));
- assertEquals((Float) layer.getBackgroundOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testBackgroundOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("background-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- backgroundOpacity(
- zoom(
- exponential(
- stop(2, backgroundOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getBackgroundOpacity());
- assertNotNull(layer.getBackgroundOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getBackgroundOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getBackgroundOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java
deleted file mode 100644
index 3d56752150..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-
-/**
- * Base Test class for Style tests
- */
-public class BaseStyleTest extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return RuntimeStyleTestActivity.class;
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
deleted file mode 100644
index bf31a935f8..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
+++ /dev/null
@@ -1,1328 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for CircleLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class CircleLayerTest extends BaseActivityTest {
-
- private CircleLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new CircleLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- public void testCircleRadiusTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radiusTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleRadiusTransition(options);
- assertEquals(layer.getCircleRadiusTransition(), options);
- }
-
- @Test
- public void testCircleRadiusAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleRadius(0.3f));
- assertEquals((Float) layer.getCircleRadius().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testCircleRadiusAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleRadius(
- zoom(
- exponential(
- stop(2, circleRadius(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleRadius());
- assertNotNull(layer.getCircleRadius().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleRadius().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleRadiusAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleRadius(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleRadius());
- assertNotNull(layer.getCircleRadius().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleRadius().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleRadiusAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleRadius(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, circleRadius(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleRadius());
- assertNotNull(layer.getCircleRadius().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleRadiusAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleRadius(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, circleRadius(0.3f))
- )
- ).withDefaultValue(circleRadius(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleRadius());
- assertNotNull(layer.getCircleRadius().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleRadius().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleRadius().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleRadius().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getCircleRadius().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testCircleRadiusAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-radius");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleRadius(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, circleRadius(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(circleRadius(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleRadius());
- assertNotNull(layer.getCircleRadius().getFunction());
- assertEquals(CompositeFunction.class, layer.getCircleRadius().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleRadius().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleRadius().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getCircleRadius().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleRadius().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testCircleColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleColorTransition(options);
- assertEquals(layer.getCircleColorTransition(), options);
- }
-
- @Test
- public void testCircleColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getCircleColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testCircleColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleColor(
- zoom(
- exponential(
- stop(2, circleColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleColor());
- assertNotNull(layer.getCircleColor().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleColor());
- assertNotNull(layer.getCircleColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, circleColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleColor());
- assertNotNull(layer.getCircleColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", circleColor(Color.RED))
- )
- ).withDefaultValue(circleColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleColor());
- assertNotNull(layer.getCircleColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testCircleColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleColor(Color.RED));
- assertEquals(layer.getCircleColorAsInt(), Color.RED);
- }
-
- @Test
- public void testCircleBlurTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleBlurTransition(options);
- assertEquals(layer.getCircleBlurTransition(), options);
- }
-
- @Test
- public void testCircleBlurAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleBlur(0.3f));
- assertEquals((Float) layer.getCircleBlur().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testCircleBlurAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleBlur(
- zoom(
- exponential(
- stop(2, circleBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleBlur());
- assertNotNull(layer.getCircleBlur().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleBlur().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleBlurAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleBlur(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleBlur());
- assertNotNull(layer.getCircleBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleBlurAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleBlur(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, circleBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleBlur());
- assertNotNull(layer.getCircleBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleBlurAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleBlur(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, circleBlur(0.3f))
- )
- ).withDefaultValue(circleBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleBlur());
- assertNotNull(layer.getCircleBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleBlur().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleBlur().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getCircleBlur().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testCircleBlurAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleBlur(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, circleBlur(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(circleBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleBlur());
- assertNotNull(layer.getCircleBlur().getFunction());
- assertEquals(CompositeFunction.class, layer.getCircleBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleBlur().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getCircleBlur().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleBlur().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testCircleOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleOpacityTransition(options);
- assertEquals(layer.getCircleOpacityTransition(), options);
- }
-
- @Test
- public void testCircleOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleOpacity(0.3f));
- assertEquals((Float) layer.getCircleOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testCircleOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleOpacity(
- zoom(
- exponential(
- stop(2, circleOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleOpacity());
- assertNotNull(layer.getCircleOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleOpacity());
- assertNotNull(layer.getCircleOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, circleOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleOpacity());
- assertNotNull(layer.getCircleOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, circleOpacity(0.3f))
- )
- ).withDefaultValue(circleOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleOpacity());
- assertNotNull(layer.getCircleOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getCircleOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testCircleOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, circleOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(circleOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleOpacity());
- assertNotNull(layer.getCircleOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getCircleOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getCircleOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testCircleTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleTranslateTransition(options);
- assertEquals(layer.getCircleTranslateTransition(), options);
- }
-
- @Test
- public void testCircleTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getCircleTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testCircleTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleTranslate(
- zoom(
- exponential(
- stop(2, circleTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleTranslate());
- assertNotNull(layer.getCircleTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getCircleTranslateAnchor().getValue(), (String) CIRCLE_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testCircleTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleTranslateAnchor(
- zoom(
- interval(
- stop(2, circleTranslateAnchor(CIRCLE_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleTranslateAnchor());
- assertNotNull(layer.getCircleTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getCircleTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testCirclePitchScaleAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-pitch-scale");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circlePitchScale(CIRCLE_PITCH_SCALE_MAP));
- assertEquals((String) layer.getCirclePitchScale().getValue(), (String) CIRCLE_PITCH_SCALE_MAP);
- }
-
- @Test
- public void testCirclePitchScaleAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-pitch-scale");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circlePitchScale(
- zoom(
- interval(
- stop(2, circlePitchScale(CIRCLE_PITCH_SCALE_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCirclePitchScale());
- assertNotNull(layer.getCirclePitchScale().getFunction());
- assertEquals(CameraFunction.class, layer.getCirclePitchScale().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getCirclePitchScale().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getCirclePitchScale().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleStrokeWidthTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeWidthTransition(options);
- assertEquals(layer.getCircleStrokeWidthTransition(), options);
- }
-
- @Test
- public void testCircleStrokeWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleStrokeWidth(0.3f));
- assertEquals((Float) layer.getCircleStrokeWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testCircleStrokeWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeWidth(
- zoom(
- exponential(
- stop(2, circleStrokeWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeWidth());
- assertNotNull(layer.getCircleStrokeWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleStrokeWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleStrokeWidthAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeWidth(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeWidth());
- assertNotNull(layer.getCircleStrokeWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeWidthAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeWidth(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, circleStrokeWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeWidth());
- assertNotNull(layer.getCircleStrokeWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeWidthAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeWidth(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, circleStrokeWidth(0.3f))
- )
- ).withDefaultValue(circleStrokeWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeWidth());
- assertNotNull(layer.getCircleStrokeWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeWidth().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testCircleStrokeWidthAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeWidth(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, circleStrokeWidth(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(circleStrokeWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeWidth());
- assertNotNull(layer.getCircleStrokeWidth().getFunction());
- assertEquals(CompositeFunction.class, layer.getCircleStrokeWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeWidth().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getCircleStrokeWidth().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeWidth().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testCircleStrokeColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeColorTransition(options);
- assertEquals(layer.getCircleStrokeColorTransition(), options);
- }
-
- @Test
- public void testCircleStrokeColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleStrokeColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getCircleStrokeColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testCircleStrokeColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeColor(
- zoom(
- exponential(
- stop(2, circleStrokeColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeColor());
- assertNotNull(layer.getCircleStrokeColor().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleStrokeColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleStrokeColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleStrokeColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeColor());
- assertNotNull(layer.getCircleStrokeColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, circleStrokeColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeColor());
- assertNotNull(layer.getCircleStrokeColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", circleStrokeColor(Color.RED))
- )
- ).withDefaultValue(circleStrokeColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeColor());
- assertNotNull(layer.getCircleStrokeColor().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleStrokeColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getCircleStrokeColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testCircleStrokeColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleStrokeColor(Color.RED));
- assertEquals(layer.getCircleStrokeColorAsInt(), Color.RED);
- }
-
- @Test
- public void testCircleStrokeOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setCircleStrokeOpacityTransition(options);
- assertEquals(layer.getCircleStrokeOpacityTransition(), options);
- }
-
- @Test
- public void testCircleStrokeOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(circleStrokeOpacity(0.3f));
- assertEquals((Float) layer.getCircleStrokeOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testCircleStrokeOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeOpacity(
- zoom(
- exponential(
- stop(2, circleStrokeOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeOpacity());
- assertNotNull(layer.getCircleStrokeOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testCircleStrokeOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeOpacity());
- assertNotNull(layer.getCircleStrokeOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, circleStrokeOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeOpacity());
- assertNotNull(layer.getCircleStrokeOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testCircleStrokeOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, circleStrokeOpacity(0.3f))
- )
- ).withDefaultValue(circleStrokeOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeOpacity());
- assertNotNull(layer.getCircleStrokeOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getCircleStrokeOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testCircleStrokeOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("circle-stroke-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- circleStrokeOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, circleStrokeOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(circleStrokeOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getCircleStrokeOpacity());
- assertNotNull(layer.getCircleStrokeOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getCircleStrokeOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getCircleStrokeOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getCircleStrokeOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getCircleStrokeOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getCircleStrokeOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
deleted file mode 100644
index fec9a6c119..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillExtrusionLayerTest.java
+++ /dev/null
@@ -1,760 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for FillExtrusionLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class FillExtrusionLayerTest extends BaseActivityTest {
-
- private FillExtrusionLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new FillExtrusionLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- public void testFillExtrusionOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionOpacityTransition(options);
- assertEquals(layer.getFillExtrusionOpacityTransition(), options);
- }
-
- @Test
- public void testFillExtrusionOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionOpacity(0.3f));
- assertEquals((Float) layer.getFillExtrusionOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testFillExtrusionOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionOpacity(
- zoom(
- exponential(
- stop(2, fillExtrusionOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionOpacity());
- assertNotNull(layer.getFillExtrusionOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionColorTransition(options);
- assertEquals(layer.getFillExtrusionColorTransition(), options);
- }
-
- @Test
- public void testFillExtrusionColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillExtrusionColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testFillExtrusionColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionColor(
- zoom(
- exponential(
- stop(2, fillExtrusionColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionColor());
- assertNotNull(layer.getFillExtrusionColor().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionColor());
- assertNotNull(layer.getFillExtrusionColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, fillExtrusionColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionColor());
- assertNotNull(layer.getFillExtrusionColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", fillExtrusionColor(Color.RED))
- )
- ).withDefaultValue(fillExtrusionColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionColor());
- assertNotNull(layer.getFillExtrusionColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillExtrusionColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillExtrusionColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testFillExtrusionColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionColor(Color.RED));
- assertEquals(layer.getFillExtrusionColorAsInt(), Color.RED);
- }
-
- @Test
- public void testFillExtrusionTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionTranslateTransition(options);
- assertEquals(layer.getFillExtrusionTranslateTransition(), options);
- }
-
- @Test
- public void testFillExtrusionTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getFillExtrusionTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testFillExtrusionTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionTranslate(
- zoom(
- exponential(
- stop(2, fillExtrusionTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionTranslate());
- assertNotNull(layer.getFillExtrusionTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getFillExtrusionTranslateAnchor().getValue(), (String) FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testFillExtrusionTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionTranslateAnchor(
- zoom(
- interval(
- stop(2, fillExtrusionTranslateAnchor(FILL_EXTRUSION_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionTranslateAnchor());
- assertNotNull(layer.getFillExtrusionTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getFillExtrusionTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getFillExtrusionTranslateAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionPatternTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionPatternTransition(options);
- assertEquals(layer.getFillExtrusionPatternTransition(), options);
- }
-
- @Test
- public void testFillExtrusionPatternAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-pattern");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionPattern("pedestrian-polygon"));
- assertEquals((String) layer.getFillExtrusionPattern().getValue(), (String) "pedestrian-polygon");
- }
-
- @Test
- public void testFillExtrusionPatternAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-pattern");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionPattern(
- zoom(
- interval(
- stop(2, fillExtrusionPattern("pedestrian-polygon"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionPattern());
- assertNotNull(layer.getFillExtrusionPattern().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionPattern().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getFillExtrusionPattern().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getFillExtrusionPattern().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionHeightTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-heightTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionHeightTransition(options);
- assertEquals(layer.getFillExtrusionHeightTransition(), options);
- }
-
- @Test
- public void testFillExtrusionHeightAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionHeight(0.3f));
- assertEquals((Float) layer.getFillExtrusionHeight().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testFillExtrusionHeightAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionHeight(
- zoom(
- exponential(
- stop(2, fillExtrusionHeight(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionHeight());
- assertNotNull(layer.getFillExtrusionHeight().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionHeight().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionHeightAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionHeight(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionHeight());
- assertNotNull(layer.getFillExtrusionHeight().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionHeightAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionHeight(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, fillExtrusionHeight(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionHeight());
- assertNotNull(layer.getFillExtrusionHeight().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionHeightAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionHeight(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, fillExtrusionHeight(0.3f))
- )
- ).withDefaultValue(fillExtrusionHeight(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionHeight());
- assertNotNull(layer.getFillExtrusionHeight().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionHeight().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionHeight().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testFillExtrusionHeightAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionHeight(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, fillExtrusionHeight(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(fillExtrusionHeight(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionHeight());
- assertNotNull(layer.getFillExtrusionHeight().getFunction());
- assertEquals(CompositeFunction.class, layer.getFillExtrusionHeight().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionHeight().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionHeight().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionHeight().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionHeight().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testFillExtrusionBaseTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-baseTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillExtrusionBaseTransition(options);
- assertEquals(layer.getFillExtrusionBaseTransition(), options);
- }
-
- @Test
- public void testFillExtrusionBaseAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillExtrusionBase(0.3f));
- assertEquals((Float) layer.getFillExtrusionBase().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testFillExtrusionBaseAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionBase(
- zoom(
- exponential(
- stop(2, fillExtrusionBase(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionBase());
- assertNotNull(layer.getFillExtrusionBase().getFunction());
- assertEquals(CameraFunction.class, layer.getFillExtrusionBase().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillExtrusionBaseAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionBase(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionBase());
- assertNotNull(layer.getFillExtrusionBase().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionBaseAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionBase(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, fillExtrusionBase(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionBase());
- assertNotNull(layer.getFillExtrusionBase().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillExtrusionBaseAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionBase(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, fillExtrusionBase(0.3f))
- )
- ).withDefaultValue(fillExtrusionBase(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionBase());
- assertNotNull(layer.getFillExtrusionBase().getFunction());
- assertEquals(SourceFunction.class, layer.getFillExtrusionBase().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getFillExtrusionBase().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testFillExtrusionBaseAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-extrusion-base");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillExtrusionBase(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, fillExtrusionBase(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(fillExtrusionBase(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillExtrusionBase());
- assertNotNull(layer.getFillExtrusionBase().getFunction());
- assertEquals(CompositeFunction.class, layer.getFillExtrusionBase().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillExtrusionBase().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillExtrusionBase().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getFillExtrusionBase().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillExtrusionBase().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
deleted file mode 100644
index b6b6578839..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
+++ /dev/null
@@ -1,723 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.FillLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for FillLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class FillLayerTest extends BaseActivityTest {
-
- private FillLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new FillLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- public void testFillAntialiasAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-antialias");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillAntialias(true));
- assertEquals((Boolean) layer.getFillAntialias().getValue(), (Boolean) true);
- }
-
- @Test
- public void testFillAntialiasAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-antialias");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillAntialias(
- zoom(
- interval(
- stop(2, fillAntialias(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillAntialias());
- assertNotNull(layer.getFillAntialias().getFunction());
- assertEquals(CameraFunction.class, layer.getFillAntialias().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getFillAntialias().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getFillAntialias().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillOpacityTransition(options);
- assertEquals(layer.getFillOpacityTransition(), options);
- }
-
- @Test
- public void testFillOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillOpacity(0.3f));
- assertEquals((Float) layer.getFillOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testFillOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOpacity(
- zoom(
- exponential(
- stop(2, fillOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOpacity());
- assertNotNull(layer.getFillOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getFillOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillOpacity());
- assertNotNull(layer.getFillOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, fillOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOpacity());
- assertNotNull(layer.getFillOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, fillOpacity(0.3f))
- )
- ).withDefaultValue(fillOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOpacity());
- assertNotNull(layer.getFillOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getFillOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testFillOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, fillOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(fillOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOpacity());
- assertNotNull(layer.getFillOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getFillOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getFillOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getFillOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getFillOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testFillColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillColorTransition(options);
- assertEquals(layer.getFillColorTransition(), options);
- }
-
- @Test
- public void testFillColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testFillColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillColor(
- zoom(
- exponential(
- stop(2, fillColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillColor());
- assertNotNull(layer.getFillColor().getFunction());
- assertEquals(CameraFunction.class, layer.getFillColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillColor());
- assertNotNull(layer.getFillColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, fillColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillColor());
- assertNotNull(layer.getFillColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", fillColor(Color.RED))
- )
- ).withDefaultValue(fillColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillColor());
- assertNotNull(layer.getFillColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testFillColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillColor(Color.RED));
- assertEquals(layer.getFillColorAsInt(), Color.RED);
- }
-
- @Test
- public void testFillOutlineColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillOutlineColorTransition(options);
- assertEquals(layer.getFillOutlineColorTransition(), options);
- }
-
- @Test
- public void testFillOutlineColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillOutlineColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getFillOutlineColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testFillOutlineColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOutlineColor(
- zoom(
- exponential(
- stop(2, fillOutlineColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOutlineColor());
- assertNotNull(layer.getFillOutlineColor().getFunction());
- assertEquals(CameraFunction.class, layer.getFillOutlineColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillOutlineColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillOutlineColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOutlineColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getFillOutlineColor());
- assertNotNull(layer.getFillOutlineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillOutlineColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOutlineColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, fillOutlineColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOutlineColor());
- assertNotNull(layer.getFillOutlineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testFillOutlineColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillOutlineColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", fillOutlineColor(Color.RED))
- )
- ).withDefaultValue(fillOutlineColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getFillOutlineColor());
- assertNotNull(layer.getFillOutlineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getFillOutlineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getFillOutlineColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getFillOutlineColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getFillOutlineColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testFillOutlineColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-outline-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillOutlineColor(Color.RED));
- assertEquals(layer.getFillOutlineColorAsInt(), Color.RED);
- }
-
- @Test
- public void testFillTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillTranslateTransition(options);
- assertEquals(layer.getFillTranslateTransition(), options);
- }
-
- @Test
- public void testFillTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getFillTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testFillTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillTranslate(
- zoom(
- exponential(
- stop(2, fillTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillTranslate());
- assertNotNull(layer.getFillTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getFillTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getFillTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getFillTranslateAnchor().getValue(), (String) FILL_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testFillTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillTranslateAnchor(
- zoom(
- interval(
- stop(2, fillTranslateAnchor(FILL_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillTranslateAnchor());
- assertNotNull(layer.getFillTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getFillTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getFillTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getFillTranslateAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testFillPatternTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setFillPatternTransition(options);
- assertEquals(layer.getFillPatternTransition(), options);
- }
-
- @Test
- public void testFillPatternAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-pattern");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(fillPattern("pedestrian-polygon"));
- assertEquals((String) layer.getFillPattern().getValue(), (String) "pedestrian-polygon");
- }
-
- @Test
- public void testFillPatternAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("fill-pattern");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- fillPattern(
- zoom(
- interval(
- stop(2, fillPattern("pedestrian-polygon"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getFillPattern());
- assertNotNull(layer.getFillPattern().getFunction());
- assertEquals(CameraFunction.class, layer.getFillPattern().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getFillPattern().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size());
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
deleted file mode 100644
index be2fc9ab9c..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.content.res.Resources;
-import android.support.annotation.RawRes;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.style.layers.Layer;
-import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.services.commons.geojson.Feature;
-import com.mapbox.services.commons.geojson.FeatureCollection;
-import com.mapbox.services.commons.geojson.Point;
-
-import org.hamcrest.Matcher;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.fail;
-
-/**
- * Tests for {@link GeoJsonSource}
- */
-@RunWith(AndroidJUnit4.class)
-public class GeoJsonSourceTests extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return RuntimeStyleTestActivity.class;
- }
-
- @Test
- public void testFeatureCollection() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- GeoJsonSource source = new GeoJsonSource("source", FeatureCollection
- .fromJson(readRawResource(rule.getActivity().getResources(), R.raw.test_feature_collection)));
- mapboxMap.addSource(source);
-
- mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
- }
-
- });
- }
-
- @Test
- public void testPointGeometry() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- GeoJsonSource source = new GeoJsonSource("source", Point.fromCoordinates(new double[] {0d, 0d}));
- mapboxMap.addSource(source);
-
- mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
- }
-
- });
- }
-
- @Test
- public void testFeatureProperties() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- GeoJsonSource source = new GeoJsonSource("source",
- readRawResource(rule.getActivity().getResources(), R.raw.test_feature_properties));
- mapboxMap.addSource(source);
-
- mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
- }
-
- });
- }
-
- @Test
- public void testPointFeature() {
- testFeatureFromResource(R.raw.test_point_feature);
- }
-
- @Test
- public void testLineStringFeature() {
- testFeatureFromResource(R.raw.test_line_string_feature);
- }
-
- @Test
- public void testPolygonFeature() {
- testFeatureFromResource(R.raw.test_polygon_feature);
- }
-
- @Test
- public void testPolygonWithHoleFeature() {
- testFeatureFromResource(R.raw.test_polygon_with_hole_feature);
- }
-
- @Test
- public void testMultiPointFeature() {
- testFeatureFromResource(R.raw.test_multi_point_feature);
- }
-
- @Test
- public void testMultiLineStringFeature() {
- testFeatureFromResource(R.raw.test_multi_line_string_feature);
- }
-
- @Test
- public void testMultiPolygonFeature() {
- testFeatureFromResource(R.raw.test_multi_polygon_feature);
- }
-
- protected void testFeatureFromResource(final @RawRes int resource) {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- GeoJsonSource source = new GeoJsonSource("source");
- mapboxMap.addSource(source);
- Layer layer = new CircleLayer("layer", source.getId());
- mapboxMap.addLayer(layer);
-
- source.setGeoJson(Feature.fromJson(
- readRawResource(rule.getActivity().getResources(), resource)));
-
- mapboxMap.removeLayer(layer);
- mapboxMap.removeSource(source);
- }
-
- });
- }
-
- private String readRawResource(Resources resources, @RawRes int rawResource) {
- InputStream is = resources.openRawResource(rawResource);
- Writer writer = new StringWriter();
- char[] buffer = new char[1024];
- try {
- try {
- Reader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- int numRead;
- while ((numRead = reader.read(buffer)) != -1) {
- writer.write(buffer, 0, numRead);
- }
- } finally {
- is.close();
- }
- } catch (IOException err) {
- fail(err.getMessage());
- }
-
- return writer.toString();
- }
-
- public abstract class BaseViewAction implements ViewAction {
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
deleted file mode 100644
index 1c23dd366b..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
+++ /dev/null
@@ -1,1293 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.LineLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for LineLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class LineLayerTest extends BaseActivityTest {
-
- private LineLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new LineLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- public void testLineCapAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-cap");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineCap(LINE_CAP_BUTT));
- assertEquals((String) layer.getLineCap().getValue(), (String) LINE_CAP_BUTT);
- }
-
- @Test
- public void testLineCapAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-cap");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineCap(
- zoom(
- interval(
- stop(2, lineCap(LINE_CAP_BUTT))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineCap());
- assertNotNull(layer.getLineCap().getFunction());
- assertEquals(CameraFunction.class, layer.getLineCap().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getLineCap().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineJoinAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-join");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineJoin(LINE_JOIN_BEVEL));
- assertEquals((String) layer.getLineJoin().getValue(), (String) LINE_JOIN_BEVEL);
- }
-
- @Test
- public void testLineJoinAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-join");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineJoin(
- zoom(
- interval(
- stop(2, lineJoin(LINE_JOIN_BEVEL))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineJoin());
- assertNotNull(layer.getLineJoin().getFunction());
- assertEquals(CameraFunction.class, layer.getLineJoin().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getLineJoin().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineMiterLimitAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-miter-limit");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineMiterLimit(0.3f));
- assertEquals((Float) layer.getLineMiterLimit().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineMiterLimitAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-miter-limit");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineMiterLimit(
- zoom(
- exponential(
- stop(2, lineMiterLimit(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineMiterLimit());
- assertNotNull(layer.getLineMiterLimit().getFunction());
- assertEquals(CameraFunction.class, layer.getLineMiterLimit().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineMiterLimit().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineRoundLimitAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-round-limit");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineRoundLimit(0.3f));
- assertEquals((Float) layer.getLineRoundLimit().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineRoundLimitAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-round-limit");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineRoundLimit(
- zoom(
- exponential(
- stop(2, lineRoundLimit(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineRoundLimit());
- assertNotNull(layer.getLineRoundLimit().getFunction());
- assertEquals(CameraFunction.class, layer.getLineRoundLimit().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineRoundLimit().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineRoundLimit().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineOpacityTransition(options);
- assertEquals(layer.getLineOpacityTransition(), options);
- }
-
- @Test
- public void testLineOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineOpacity(0.3f));
- assertEquals((Float) layer.getLineOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOpacity(
- zoom(
- exponential(
- stop(2, lineOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOpacity());
- assertNotNull(layer.getLineOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getLineOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getLineOpacity());
- assertNotNull(layer.getLineOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getLineOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, lineOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOpacity());
- assertNotNull(layer.getLineOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, lineOpacity(0.3f))
- )
- ).withDefaultValue(lineOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOpacity());
- assertNotNull(layer.getLineOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getLineOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getLineOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testLineOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, lineOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(lineOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOpacity());
- assertNotNull(layer.getLineOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getLineOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getLineOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testLineColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineColorTransition(options);
- assertEquals(layer.getLineColorTransition(), options);
- }
-
- @Test
- public void testLineColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getLineColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testLineColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineColor(
- zoom(
- exponential(
- stop(2, lineColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineColor());
- assertNotNull(layer.getLineColor().getFunction());
- assertEquals(CameraFunction.class, layer.getLineColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getLineColor());
- assertNotNull(layer.getLineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getLineColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, lineColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineColor());
- assertNotNull(layer.getLineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", lineColor(Color.RED))
- )
- ).withDefaultValue(lineColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineColor());
- assertNotNull(layer.getLineColor().getFunction());
- assertEquals(SourceFunction.class, layer.getLineColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getLineColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getLineColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testLineColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineColor(Color.RED));
- assertEquals(layer.getLineColorAsInt(), Color.RED);
- }
-
- @Test
- public void testLineTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineTranslateTransition(options);
- assertEquals(layer.getLineTranslateTransition(), options);
- }
-
- @Test
- public void testLineTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getLineTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testLineTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineTranslate(
- zoom(
- exponential(
- stop(2, lineTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineTranslate());
- assertNotNull(layer.getLineTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getLineTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getLineTranslateAnchor().getValue(), (String) LINE_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testLineTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineTranslateAnchor(
- zoom(
- interval(
- stop(2, lineTranslateAnchor(LINE_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineTranslateAnchor());
- assertNotNull(layer.getLineTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getLineTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getLineTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getLineTranslateAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineWidthTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineWidthTransition(options);
- assertEquals(layer.getLineWidthTransition(), options);
- }
-
- @Test
- public void testLineWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineWidth(0.3f));
- assertEquals((Float) layer.getLineWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineWidth(
- zoom(
- exponential(
- stop(2, lineWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineWidth());
- assertNotNull(layer.getLineWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getLineWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineGapWidthTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineGapWidthTransition(options);
- assertEquals(layer.getLineGapWidthTransition(), options);
- }
-
- @Test
- public void testLineGapWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineGapWidth(0.3f));
- assertEquals((Float) layer.getLineGapWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineGapWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineGapWidth(
- zoom(
- exponential(
- stop(2, lineGapWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineGapWidth());
- assertNotNull(layer.getLineGapWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getLineGapWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineGapWidthAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineGapWidth(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getLineGapWidth());
- assertNotNull(layer.getLineGapWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getLineGapWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineGapWidthAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineGapWidth(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, lineGapWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineGapWidth());
- assertNotNull(layer.getLineGapWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineGapWidthAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineGapWidth(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, lineGapWidth(0.3f))
- )
- ).withDefaultValue(lineGapWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineGapWidth());
- assertNotNull(layer.getLineGapWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getLineGapWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineGapWidth().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getLineGapWidth().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getLineGapWidth().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testLineGapWidthAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-gap-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineGapWidth(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, lineGapWidth(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(lineGapWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineGapWidth());
- assertNotNull(layer.getLineGapWidth().getFunction());
- assertEquals(CompositeFunction.class, layer.getLineGapWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineGapWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineGapWidth().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getLineGapWidth().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineGapWidth().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testLineOffsetTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offsetTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineOffsetTransition(options);
- assertEquals(layer.getLineOffsetTransition(), options);
- }
-
- @Test
- public void testLineOffsetAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineOffset(0.3f));
- assertEquals((Float) layer.getLineOffset().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineOffsetAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOffset(
- zoom(
- exponential(
- stop(2, lineOffset(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOffset());
- assertNotNull(layer.getLineOffset().getFunction());
- assertEquals(CameraFunction.class, layer.getLineOffset().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineOffsetAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOffset(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getLineOffset());
- assertNotNull(layer.getLineOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getLineOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineOffsetAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOffset(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, lineOffset(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOffset());
- assertNotNull(layer.getLineOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineOffsetAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOffset(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, lineOffset(0.3f))
- )
- ).withDefaultValue(lineOffset(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOffset());
- assertNotNull(layer.getLineOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getLineOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineOffset().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getLineOffset().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getLineOffset().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testLineOffsetAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineOffset(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, lineOffset(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(lineOffset(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineOffset());
- assertNotNull(layer.getLineOffset().getFunction());
- assertEquals(CompositeFunction.class, layer.getLineOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineOffset().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineOffset().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getLineOffset().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineOffset().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testLineBlurTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineBlurTransition(options);
- assertEquals(layer.getLineBlurTransition(), options);
- }
-
- @Test
- public void testLineBlurAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineBlur(0.3f));
- assertEquals((Float) layer.getLineBlur().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testLineBlurAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineBlur(
- zoom(
- exponential(
- stop(2, lineBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineBlur());
- assertNotNull(layer.getLineBlur().getFunction());
- assertEquals(CameraFunction.class, layer.getLineBlur().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size());
- }
-
- @Test
- public void testLineBlurAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineBlur(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getLineBlur());
- assertNotNull(layer.getLineBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getLineBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineBlurAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineBlur(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, lineBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineBlur());
- assertNotNull(layer.getLineBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testLineBlurAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineBlur(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, lineBlur(0.3f))
- )
- ).withDefaultValue(lineBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineBlur());
- assertNotNull(layer.getLineBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getLineBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getLineBlur().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getLineBlur().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getLineBlur().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testLineBlurAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineBlur(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, lineBlur(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(lineBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getLineBlur());
- assertNotNull(layer.getLineBlur().getFunction());
- assertEquals(CompositeFunction.class, layer.getLineBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getLineBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getLineBlur().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getLineBlur().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getLineBlur().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testLineDasharrayTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-dasharrayTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLineDasharrayTransition(options);
- assertEquals(layer.getLineDasharrayTransition(), options);
- }
-
- @Test
- public void testLineDasharrayAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-dasharray");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(lineDasharray(new Float[]{}));
- assertEquals((Float[]) layer.getLineDasharray().getValue(), (Float[]) new Float[]{});
- }
-
- @Test
- public void testLineDasharrayAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-dasharray");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- lineDasharray(
- zoom(
- interval(
- stop(2, lineDasharray(new Float[]{}))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLineDasharray());
- assertNotNull(layer.getLineDasharray().getFunction());
- assertEquals(CameraFunction.class, layer.getLineDasharray().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getLineDasharray().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getLineDasharray().getFunction().getStops()).size());
- }
-
- @Test
- public void testLinePatternTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-patternTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setLinePatternTransition(options);
- assertEquals(layer.getLinePatternTransition(), options);
- }
-
- @Test
- public void testLinePatternAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-pattern");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(linePattern("pedestrian-polygon"));
- assertEquals((String) layer.getLinePattern().getValue(), (String) "pedestrian-polygon");
- }
-
- @Test
- public void testLinePatternAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("line-pattern");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- linePattern(
- zoom(
- interval(
- stop(2, linePattern("pedestrian-polygon"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getLinePattern());
- assertNotNull(layer.getLinePattern().getFunction());
- assertEquals(CameraFunction.class, layer.getLinePattern().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getLinePattern().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size());
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
deleted file mode 100644
index 2a0d3401fb..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
+++ /dev/null
@@ -1,446 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.RasterLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for RasterLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class RasterLayerTest extends BaseActivityTest {
-
- private RasterLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new RasterLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testRasterOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterOpacityTransition(options);
- assertEquals(layer.getRasterOpacityTransition(), options);
- }
-
- @Test
- public void testRasterOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterOpacity(0.3f));
- assertEquals((Float) layer.getRasterOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterOpacity(
- zoom(
- exponential(
- stop(2, rasterOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterOpacity());
- assertNotNull(layer.getRasterOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterHueRotateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-hue-rotateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterHueRotateTransition(options);
- assertEquals(layer.getRasterHueRotateTransition(), options);
- }
-
- @Test
- public void testRasterHueRotateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-hue-rotate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterHueRotate(0.3f));
- assertEquals((Float) layer.getRasterHueRotate().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterHueRotateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-hue-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterHueRotate(
- zoom(
- exponential(
- stop(2, rasterHueRotate(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterHueRotate());
- assertNotNull(layer.getRasterHueRotate().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterHueRotate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterHueRotate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterHueRotate().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterBrightnessMinTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-minTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterBrightnessMinTransition(options);
- assertEquals(layer.getRasterBrightnessMinTransition(), options);
- }
-
- @Test
- public void testRasterBrightnessMinAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-min");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterBrightnessMin(0.3f));
- assertEquals((Float) layer.getRasterBrightnessMin().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterBrightnessMinAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-min");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterBrightnessMin(
- zoom(
- exponential(
- stop(2, rasterBrightnessMin(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterBrightnessMin());
- assertNotNull(layer.getRasterBrightnessMin().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterBrightnessMin().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterBrightnessMin().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMin().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterBrightnessMaxTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-maxTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterBrightnessMaxTransition(options);
- assertEquals(layer.getRasterBrightnessMaxTransition(), options);
- }
-
- @Test
- public void testRasterBrightnessMaxAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-max");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterBrightnessMax(0.3f));
- assertEquals((Float) layer.getRasterBrightnessMax().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterBrightnessMaxAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-brightness-max");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterBrightnessMax(
- zoom(
- exponential(
- stop(2, rasterBrightnessMax(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterBrightnessMax());
- assertNotNull(layer.getRasterBrightnessMax().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterBrightnessMax().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterBrightnessMax().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterBrightnessMax().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterSaturationTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-saturationTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterSaturationTransition(options);
- assertEquals(layer.getRasterSaturationTransition(), options);
- }
-
- @Test
- public void testRasterSaturationAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-saturation");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterSaturation(0.3f));
- assertEquals((Float) layer.getRasterSaturation().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterSaturationAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-saturation");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterSaturation(
- zoom(
- exponential(
- stop(2, rasterSaturation(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterSaturation());
- assertNotNull(layer.getRasterSaturation().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterSaturation().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterSaturation().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterSaturation().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterContrastTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-contrastTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterContrastTransition(options);
- assertEquals(layer.getRasterContrastTransition(), options);
- }
-
- @Test
- public void testRasterContrastAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-contrast");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterContrast(0.3f));
- assertEquals((Float) layer.getRasterContrast().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterContrastAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-contrast");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterContrast(
- zoom(
- exponential(
- stop(2, rasterContrast(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterContrast());
- assertNotNull(layer.getRasterContrast().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterContrast().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterContrast().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterContrast().getFunction().getStops()).size());
- }
-
- @Test
- public void testRasterFadeDurationTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-fade-durationTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setRasterFadeDurationTransition(options);
- assertEquals(layer.getRasterFadeDurationTransition(), options);
- }
-
- @Test
- public void testRasterFadeDurationAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-fade-duration");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(rasterFadeDuration(0.3f));
- assertEquals((Float) layer.getRasterFadeDuration().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testRasterFadeDurationAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("raster-fade-duration");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- rasterFadeDuration(
- zoom(
- exponential(
- stop(2, rasterFadeDuration(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getRasterFadeDuration());
- assertNotNull(layer.getRasterFadeDuration().getFunction());
- assertEquals(CameraFunction.class, layer.getRasterFadeDuration().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getRasterFadeDuration().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java
deleted file mode 100644
index c95c959644..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleBackgroundLayerTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.ActivityInstrumentationTestCase2;
-
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
-import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
-import com.mapbox.mapboxsdk.style.layers.Property;
-import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Basic smoke tests for BackgroundLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleBackgroundLayerTest
- extends ActivityInstrumentationTestCase2<RuntimeStyleTestActivity> {
-
- public RuntimeStyleBackgroundLayerTest() {
- super(RuntimeStyleTestActivity.class);
- }
-
- @Before
- public void setUp() throws Exception {
- super.setUp();
- injectInstrumentation(InstrumentationRegistry.getInstrumentation());
- }
-
- @Test
- public void testSetVisibility() {
- getActivity().mapView.getMapAsync(new OnMapReadyCallback() {
- @Override
- public void onMapReady(MapboxMap mapboxMap) {
- Timber.i("visibility");
- BackgroundLayer layer = mapboxMap.getLayerAs("background");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), Property.VISIBLE);
-
- // Set
- layer.setProperties(PropertyFactory.visibility(Property.NONE));
- assertEquals(layer.getVisibility().getValue(), Property.NONE);
- }
- });
- }
-
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
deleted file mode 100644
index 354f5def6f..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
+++ /dev/null
@@ -1,310 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.graphics.PointF;
-import android.support.test.espresso.Espresso;
-import android.support.test.espresso.UiController;
-import android.support.test.espresso.ViewAction;
-import android.support.test.runner.AndroidJUnit4;
-import android.view.View;
-
-import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
-import com.mapbox.mapboxsdk.style.layers.CircleLayer;
-import com.mapbox.mapboxsdk.style.layers.FillLayer;
-import com.mapbox.mapboxsdk.style.layers.Layer;
-import com.mapbox.mapboxsdk.style.layers.Property;
-import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
-import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException;
-import com.mapbox.mapboxsdk.style.sources.Source;
-import com.mapbox.mapboxsdk.style.sources.VectorSource;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-
-import junit.framework.Assert;
-
-import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-import timber.log.Timber;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- * Basic smoke tests for Layer and Source
- */
-@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTests extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return RuntimeStyleTestActivity.class;
- }
-
- @Test
- public void testListLayers() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getLayers();
- assertNotNull(layers);
- assertTrue(layers.size() > 0);
- for (Layer layer : layers) {
- assertNotNull(layer);
- }
- }
-
- });
- }
-
- @Test
- public void testGetAddRemoveLayer() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new AddRemoveLayerAction());
- }
-
- @Test
- public void testAddLayerAbove() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getLayers();
- Source source = mapboxMap.getSources().get(0);
-
- // Test inserting with invalid above-id
- try {
- mapboxMap.addLayerAbove(new CircleLayer("invalid-id-layer-test", source.getId()), "no-such-layer-here-man");
- fail("Should have thrown exception");
- } catch (CannotAddLayerException ex) {
- // Yeah
- assertNotNull(ex.getMessage());
- }
-
- // Insert as last
- CircleLayer last = new CircleLayer("this is the last one", source.getId());
- mapboxMap.addLayerAbove(last, layers.get(layers.size() - 1).getId());
- layers = mapboxMap.getLayers();
- assertEquals(last.getId(), layers.get(layers.size() - 1).getId());
-
- // Insert
- CircleLayer second = new CircleLayer("this is the second one", source.getId());
- mapboxMap.addLayerAbove(second, layers.get(0).getId());
- layers = mapboxMap.getLayers();
- assertEquals(second.getId(), layers.get(1).getId());
- }
- });
- }
-
- @Test
- public void testRemoveLayerAt() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- // Remove by index
- Layer firstLayer = mapboxMap.getLayers().get(0);
- Layer removed = mapboxMap.removeLayerAt(0);
- assertNotNull(removed);
- assertNotNull(removed.getId());
- assertEquals(firstLayer.getId(), removed.getId());
-
- // Test remove by index bounds checks
- Timber.i("Remove layer at index > size");
- assertNull(mapboxMap.removeLayerAt(Integer.MAX_VALUE));
- }
- });
- }
-
- public void testAddLayerAt() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
- @Override
- public void perform(UiController uiController, View view) {
- List<Layer> layers = mapboxMap.getLayers();
- Source source = mapboxMap.getSources().get(0);
-
- // Test inserting out of range
- try {
- mapboxMap.addLayerAt(new CircleLayer("invalid-id-layer-test", source.getId()), layers.size());
- fail("Should have thrown exception");
- } catch (CannotAddLayerException ex) {
- // Yeah
- assertNotNull(ex.getMessage());
- }
-
- // Insert at current last position
- CircleLayer last = new CircleLayer("this is the last one", source.getId());
- mapboxMap.addLayerAt(last, layers.size() - 1);
- layers = mapboxMap.getLayers();
- assertEquals(last.getId(), layers.get(layers.size() - 2).getId());
-
- // Insert at start
- CircleLayer second = new CircleLayer("this is the first one", source.getId());
- mapboxMap.addLayerAt(second, 0);
- layers = mapboxMap.getLayers();
- assertEquals(second.getId(), layers.get(0).getId());
- }
- });
- }
-
-
- @Test
- public void testListSources() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- List<Source> sources = mapboxMap.getSources();
- assertNotNull(sources);
- assertTrue(sources.size() > 0);
- for (Source source : sources) {
- assertNotNull(source);
- }
- }
-
- });
- }
-
- @Test
- public void testAddRemoveSource() {
- validateTestSetup();
- mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
- mapboxMap.removeSource("my-source");
-
- onView(withId(R.id.mapView)).perform(new AddRemoveSourceAction());
- }
-
- /**
- * https://github.com/mapbox/mapbox-gl-native/issues/7973
- */
- @Test
- public void testQueryRenderedFeaturesInputHandling() {
- validateTestSetup();
- onView(withId(R.id.mapView)).perform(new BaseViewAction() {
-
- @Override
- public void perform(UiController uiController, View view) {
- String[] layerIds = new String[600];
- for (int i = 0; i < layerIds.length; i++) {
- layerIds[i] = "layer-" + i;
- }
- mapboxMap.queryRenderedFeatures(new PointF(100, 100), layerIds);
- }
-
- });
- }
-
- private class AddRemoveLayerAction extends BaseViewAction {
-
- @Override
- public void perform(UiController uiController, View view) {
- // Get initial
- assertNotNull(mapboxMap.getLayer("building"));
-
- // Remove
- Layer building = mapboxMap.removeLayer("building");
- assertNotNull(building);
- assertNull(mapboxMap.getLayer("building"));
-
- // Add
- FillLayer layer = new FillLayer("building", "composite");
- layer.setSourceLayer("building");
- mapboxMap.addLayer(layer);
- assertNotNull(mapboxMap.getLayer("building"));
-
- // Assure the reference still works
- layer.setProperties(PropertyFactory.visibility(Property.VISIBLE));
-
- // Remove, preserving the reference
- mapboxMap.removeLayer(layer);
-
- // Property setters should still work
- layer.setProperties(PropertyFactory.fillColor(Color.RED));
-
- // Re-add the reference...
- mapboxMap.addLayer(layer);
-
- // Ensure it's there
- Assert.assertNotNull(mapboxMap.getLayer(layer.getId()));
-
- // Test adding a duplicate layer
- try {
- mapboxMap.addLayer(new FillLayer("building", "composite"));
- fail("Should not have been allowed to add a layer with a duplicate id");
- } catch (CannotAddLayerException cannotAddLayerException) {
- // OK
- }
- }
- }
-
- private class AddRemoveSourceAction extends BaseViewAction {
-
- @Override
- public void perform(UiController uiController, View view) {
- // Add initial source
- mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
-
- // Remove
- Source mySource = mapboxMap.removeSource("my-source");
- assertNotNull(mySource);
- assertNull(mapboxMap.getLayer("my-source"));
-
- // Add
- Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.addSource(source);
-
- // Remove, preserving the reference
- mapboxMap.removeSource(source);
-
- // Re-add the reference...
- mapboxMap.addSource(source);
-
- // Ensure it's there
- Assert.assertNotNull(mapboxMap.getSource(source.getId()));
-
- // Test adding a duplicate source
- try {
- Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.addSource(source2);
- fail("Should not have been allowed to add a source with a duplicate id");
- } catch (CannotAddSourceException cannotAddSourceException) {
- // OK
- }
- }
- }
-
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
- public abstract class BaseViewAction implements ViewAction {
-
- @Override
- public Matcher<View> getConstraints() {
- return isDisplayed();
- }
-
- @Override
- public String getDescription() {
- return getClass().getSimpleName();
- }
-
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
deleted file mode 100644
index 75c8b57787..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.support.test.runner.AndroidJUnit4;
-
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTimingTestActivity;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Basic smoke tests for adding Layer and Source as early as possible (in onCreate)
- */
-@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTimingTests extends BaseActivityTest {
-
- @Override
- protected Class getActivityClass() {
- return RuntimeStyleTimingTestActivity.class;
- }
-
- @Test
- public void testGetAddRemoveLayer() {
- validateTestSetup();
- // We're good if it didn't crash
- }
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
deleted file mode 100644
index 737a66713a..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
+++ /dev/null
@@ -1,3815 +0,0 @@
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for SymbolLayer
- */
-@RunWith(AndroidJUnit4.class)
-public class SymbolLayerTest extends BaseActivityTest {
-
- private SymbolLayer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new SymbolLayer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-
- @Test
- public void testSymbolPlacementAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-placement");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT));
- assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT);
- }
-
- @Test
- public void testSymbolPlacementAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-placement");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- symbolPlacement(
- zoom(
- interval(
- stop(2, symbolPlacement(SYMBOL_PLACEMENT_POINT))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getSymbolPlacement());
- assertNotNull(layer.getSymbolPlacement().getFunction());
- assertEquals(CameraFunction.class, layer.getSymbolPlacement().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getSymbolPlacement().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getSymbolPlacement().getFunction().getStops()).size());
- }
-
- @Test
- public void testSymbolSpacingAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-spacing");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(symbolSpacing(0.3f));
- assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testSymbolSpacingAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-spacing");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- symbolSpacing(
- zoom(
- exponential(
- stop(2, symbolSpacing(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getSymbolSpacing());
- assertNotNull(layer.getSymbolSpacing().getFunction());
- assertEquals(CameraFunction.class, layer.getSymbolSpacing().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getSymbolSpacing().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).size());
- }
-
- @Test
- public void testSymbolAvoidEdgesAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-avoid-edges");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(symbolAvoidEdges(true));
- assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true);
- }
-
- @Test
- public void testSymbolAvoidEdgesAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("symbol-avoid-edges");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- symbolAvoidEdges(
- zoom(
- interval(
- stop(2, symbolAvoidEdges(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getSymbolAvoidEdges());
- assertNotNull(layer.getSymbolAvoidEdges().getFunction());
- assertEquals(CameraFunction.class, layer.getSymbolAvoidEdges().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getSymbolAvoidEdges().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getSymbolAvoidEdges().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconAllowOverlapAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-allow-overlap");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconAllowOverlap(true));
- assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true);
- }
-
- @Test
- public void testIconAllowOverlapAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-allow-overlap");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconAllowOverlap(
- zoom(
- interval(
- stop(2, iconAllowOverlap(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconAllowOverlap());
- assertNotNull(layer.getIconAllowOverlap().getFunction());
- assertEquals(CameraFunction.class, layer.getIconAllowOverlap().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconAllowOverlap().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconAllowOverlap().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconIgnorePlacementAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-ignore-placement");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconIgnorePlacement(true));
- assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true);
- }
-
- @Test
- public void testIconIgnorePlacementAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-ignore-placement");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconIgnorePlacement(
- zoom(
- interval(
- stop(2, iconIgnorePlacement(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconIgnorePlacement());
- assertNotNull(layer.getIconIgnorePlacement().getFunction());
- assertEquals(CameraFunction.class, layer.getIconIgnorePlacement().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconIgnorePlacement().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconIgnorePlacement().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconOptionalAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-optional");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconOptional(true));
- assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true);
- }
-
- @Test
- public void testIconOptionalAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-optional");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOptional(
- zoom(
- interval(
- stop(2, iconOptional(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOptional());
- assertNotNull(layer.getIconOptional().getFunction());
- assertEquals(CameraFunction.class, layer.getIconOptional().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconOptional().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconOptional().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconRotationAlignmentAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotation-alignment");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP));
- assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP);
- }
-
- @Test
- public void testIconRotationAlignmentAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotation-alignment");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotationAlignment(
- zoom(
- interval(
- stop(2, iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconRotationAlignment());
- assertNotNull(layer.getIconRotationAlignment().getFunction());
- assertEquals(CameraFunction.class, layer.getIconRotationAlignment().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconRotationAlignment().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconRotationAlignment().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconSizeAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconSize(0.3f));
- assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconSizeAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconSize(
- zoom(
- exponential(
- stop(2, iconSize(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconSize());
- assertNotNull(layer.getIconSize().getFunction());
- assertEquals(CameraFunction.class, layer.getIconSize().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconSizeAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconSize(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconSize());
- assertNotNull(layer.getIconSize().getFunction());
- assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconSize().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconSizeAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconSize(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, iconSize(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconSize());
- assertNotNull(layer.getIconSize().getFunction());
- assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconSizeAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconSize(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, iconSize(0.3f))
- )
- ).withDefaultValue(iconSize(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconSize());
- assertNotNull(layer.getIconSize().getFunction());
- assertEquals(SourceFunction.class, layer.getIconSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconSize().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconSize().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getIconSize().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testIconSizeAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconSize(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, iconSize(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(iconSize(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconSize());
- assertNotNull(layer.getIconSize().getFunction());
- assertEquals(CompositeFunction.class, layer.getIconSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconSize().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconSize().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconSize().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testIconTextFitAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-text-fit");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE));
- assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE);
- }
-
- @Test
- public void testIconTextFitAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-text-fit");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconTextFit(
- zoom(
- interval(
- stop(2, iconTextFit(ICON_TEXT_FIT_NONE))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconTextFit());
- assertNotNull(layer.getIconTextFit().getFunction());
- assertEquals(CameraFunction.class, layer.getIconTextFit().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconTextFit().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconTextFit().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconTextFitPaddingAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-text-fit-padding");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconTextFitPadding(new Float[]{0f,0f,0f,0f}));
- assertEquals((Float[]) layer.getIconTextFitPadding().getValue(), (Float[]) new Float[]{0f,0f,0f,0f});
- }
-
- @Test
- public void testIconTextFitPaddingAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-text-fit-padding");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconTextFitPadding(
- zoom(
- exponential(
- stop(2, iconTextFitPadding(new Float[]{0f,0f,0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconTextFitPadding());
- assertNotNull(layer.getIconTextFitPadding().getFunction());
- assertEquals(CameraFunction.class, layer.getIconTextFitPadding().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconTextFitPadding().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconImageAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-image");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconImage("undefined"));
- assertEquals((String) layer.getIconImage().getValue(), (String) "undefined");
- }
-
- @Test
- public void testIconImageAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-image");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconImage(
- zoom(
- interval(
- stop(2, iconImage("undefined"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconImage());
- assertNotNull(layer.getIconImage().getFunction());
- assertEquals(CameraFunction.class, layer.getIconImage().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconImage().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconImageAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-image");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconImage(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconImage());
- assertNotNull(layer.getIconImage().getFunction());
- assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconImage().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconImageAsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-image");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconImage(
- property(
- "FeaturePropertyA",
- interval(
- stop(1, iconImage("undefined"))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconImage());
- assertNotNull(layer.getIconImage().getFunction());
- assertEquals(SourceFunction.class, layer.getIconImage().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconImage().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.getIconImage().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconRotateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconRotate(0.3f));
- assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconRotateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotate(
- zoom(
- exponential(
- stop(2, iconRotate(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconRotate());
- assertNotNull(layer.getIconRotate().getFunction());
- assertEquals(CameraFunction.class, layer.getIconRotate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconRotateAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotate(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconRotate());
- assertNotNull(layer.getIconRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconRotate().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconRotateAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotate(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, iconRotate(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconRotate());
- assertNotNull(layer.getIconRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconRotateAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotate(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, iconRotate(0.3f))
- )
- ).withDefaultValue(iconRotate(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconRotate());
- assertNotNull(layer.getIconRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getIconRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconRotate().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconRotate().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getIconRotate().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testIconRotateAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconRotate(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, iconRotate(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(iconRotate(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconRotate());
- assertNotNull(layer.getIconRotate().getFunction());
- assertEquals(CompositeFunction.class, layer.getIconRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconRotate().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconRotate().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getIconRotate().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconRotate().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testIconPaddingAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-padding");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconPadding(0.3f));
- assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconPaddingAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-padding");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconPadding(
- zoom(
- exponential(
- stop(2, iconPadding(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconPadding());
- assertNotNull(layer.getIconPadding().getFunction());
- assertEquals(CameraFunction.class, layer.getIconPadding().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconPadding().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconKeepUprightAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-keep-upright");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconKeepUpright(true));
- assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true);
- }
-
- @Test
- public void testIconKeepUprightAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-keep-upright");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconKeepUpright(
- zoom(
- interval(
- stop(2, iconKeepUpright(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconKeepUpright());
- assertNotNull(layer.getIconKeepUpright().getFunction());
- assertEquals(CameraFunction.class, layer.getIconKeepUpright().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconKeepUpright().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconKeepUpright().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconOffsetAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-offset");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconOffset(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testIconOffsetAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOffset(
- zoom(
- exponential(
- stop(2, iconOffset(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOffset());
- assertNotNull(layer.getIconOffset().getFunction());
- assertEquals(CameraFunction.class, layer.getIconOffset().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconOffset().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconOffset().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconOffsetAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOffset(property("FeaturePropertyA", Stops.<Float[]>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconOffset());
- assertNotNull(layer.getIconOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconOffsetAsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOffset(
- property(
- "FeaturePropertyA",
- interval(
- stop(1, iconOffset(new Float[]{0f,0f}))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOffset());
- assertNotNull(layer.getIconOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getIconOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOffset().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.getIconOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextPitchAlignmentAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-pitch-alignment");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP));
- assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP);
- }
-
- @Test
- public void testTextPitchAlignmentAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-pitch-alignment");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textPitchAlignment(
- zoom(
- interval(
- stop(2, textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextPitchAlignment());
- assertNotNull(layer.getTextPitchAlignment().getFunction());
- assertEquals(CameraFunction.class, layer.getTextPitchAlignment().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextPitchAlignment().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextPitchAlignment().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextRotationAlignmentAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotation-alignment");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP));
- assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP);
- }
-
- @Test
- public void testTextRotationAlignmentAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotation-alignment");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotationAlignment(
- zoom(
- interval(
- stop(2, textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextRotationAlignment());
- assertNotNull(layer.getTextRotationAlignment().getFunction());
- assertEquals(CameraFunction.class, layer.getTextRotationAlignment().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextRotationAlignment().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextRotationAlignment().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextFieldAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textField(""));
- assertEquals((String) layer.getTextField().getValue(), (String) "");
- }
-
- @Test
- public void testTextFieldAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textField(
- zoom(
- interval(
- stop(2, textField(""))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextField());
- assertNotNull(layer.getTextField().getFunction());
- assertEquals(CameraFunction.class, layer.getTextField().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextField().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextFieldAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textField(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextField());
- assertNotNull(layer.getTextField().getFunction());
- assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextField().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextFieldAsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-field");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textField(
- property(
- "FeaturePropertyA",
- interval(
- stop(1, textField(""))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextField());
- assertNotNull(layer.getTextField().getFunction());
- assertEquals(SourceFunction.class, layer.getTextField().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextField().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextFontAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-font");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}));
- assertEquals((String[]) layer.getTextFont().getValue(), (String[]) new String[]{"Open Sans Regular", "Arial Unicode MS Regular"});
- }
-
- @Test
- public void testTextFontAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-font");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textFont(
- zoom(
- interval(
- stop(2, textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"}))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextFont());
- assertNotNull(layer.getTextFont().getFunction());
- assertEquals(CameraFunction.class, layer.getTextFont().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextFont().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextFont().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextSizeAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textSize(0.3f));
- assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextSizeAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textSize(
- zoom(
- exponential(
- stop(2, textSize(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextSize());
- assertNotNull(layer.getTextSize().getFunction());
- assertEquals(CameraFunction.class, layer.getTextSize().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextSizeAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textSize(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextSize());
- assertNotNull(layer.getTextSize().getFunction());
- assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextSize().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextSizeAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textSize(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, textSize(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextSize());
- assertNotNull(layer.getTextSize().getFunction());
- assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextSizeAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textSize(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, textSize(0.3f))
- )
- ).withDefaultValue(textSize(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextSize());
- assertNotNull(layer.getTextSize().getFunction());
- assertEquals(SourceFunction.class, layer.getTextSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextSize().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextSize().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getTextSize().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testTextSizeAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-size");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textSize(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, textSize(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(textSize(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextSize());
- assertNotNull(layer.getTextSize().getFunction());
- assertEquals(CompositeFunction.class, layer.getTextSize().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextSize().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextSize().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextSize().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testTextMaxWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-max-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textMaxWidth(0.3f));
- assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextMaxWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-max-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textMaxWidth(
- zoom(
- exponential(
- stop(2, textMaxWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextMaxWidth());
- assertNotNull(layer.getTextMaxWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getTextMaxWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextLineHeightAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-line-height");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textLineHeight(0.3f));
- assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextLineHeightAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-line-height");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textLineHeight(
- zoom(
- exponential(
- stop(2, textLineHeight(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextLineHeight());
- assertNotNull(layer.getTextLineHeight().getFunction());
- assertEquals(CameraFunction.class, layer.getTextLineHeight().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextLineHeight().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextLetterSpacingAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-letter-spacing");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textLetterSpacing(0.3f));
- assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextLetterSpacingAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-letter-spacing");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textLetterSpacing(
- zoom(
- exponential(
- stop(2, textLetterSpacing(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextLetterSpacing());
- assertNotNull(layer.getTextLetterSpacing().getFunction());
- assertEquals(CameraFunction.class, layer.getTextLetterSpacing().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextJustifyAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-justify");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT));
- assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT);
- }
-
- @Test
- public void testTextJustifyAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-justify");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textJustify(
- zoom(
- interval(
- stop(2, textJustify(TEXT_JUSTIFY_LEFT))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextJustify());
- assertNotNull(layer.getTextJustify().getFunction());
- assertEquals(CameraFunction.class, layer.getTextJustify().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextJustify().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER));
- assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER);
- }
-
- @Test
- public void testTextAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textAnchor(
- zoom(
- interval(
- stop(2, textAnchor(TEXT_ANCHOR_CENTER))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextAnchor());
- assertNotNull(layer.getTextAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getTextAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextMaxAngleAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-max-angle");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textMaxAngle(0.3f));
- assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextMaxAngleAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-max-angle");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textMaxAngle(
- zoom(
- exponential(
- stop(2, textMaxAngle(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextMaxAngle());
- assertNotNull(layer.getTextMaxAngle().getFunction());
- assertEquals(CameraFunction.class, layer.getTextMaxAngle().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextMaxAngle().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextRotateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textRotate(0.3f));
- assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextRotateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotate(
- zoom(
- exponential(
- stop(2, textRotate(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextRotate());
- assertNotNull(layer.getTextRotate().getFunction());
- assertEquals(CameraFunction.class, layer.getTextRotate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextRotateAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotate(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextRotate());
- assertNotNull(layer.getTextRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextRotate().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextRotateAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotate(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, textRotate(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextRotate());
- assertNotNull(layer.getTextRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextRotateAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotate(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, textRotate(0.3f))
- )
- ).withDefaultValue(textRotate(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextRotate());
- assertNotNull(layer.getTextRotate().getFunction());
- assertEquals(SourceFunction.class, layer.getTextRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextRotate().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextRotate().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getTextRotate().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testTextRotateAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-rotate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textRotate(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, textRotate(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(textRotate(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextRotate());
- assertNotNull(layer.getTextRotate().getFunction());
- assertEquals(CompositeFunction.class, layer.getTextRotate().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextRotate().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextRotate().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextRotate().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testTextPaddingAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-padding");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textPadding(0.3f));
- assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextPaddingAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-padding");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textPadding(
- zoom(
- exponential(
- stop(2, textPadding(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextPadding());
- assertNotNull(layer.getTextPadding().getFunction());
- assertEquals(CameraFunction.class, layer.getTextPadding().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextPadding().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextKeepUprightAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-keep-upright");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textKeepUpright(true));
- assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true);
- }
-
- @Test
- public void testTextKeepUprightAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-keep-upright");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textKeepUpright(
- zoom(
- interval(
- stop(2, textKeepUpright(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextKeepUpright());
- assertNotNull(layer.getTextKeepUpright().getFunction());
- assertEquals(CameraFunction.class, layer.getTextKeepUpright().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextKeepUpright().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextKeepUpright().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextTransformAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-transform");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textTransform(TEXT_TRANSFORM_NONE));
- assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE);
- }
-
- @Test
- public void testTextTransformAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-transform");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textTransform(
- zoom(
- interval(
- stop(2, textTransform(TEXT_TRANSFORM_NONE))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextTransform());
- assertNotNull(layer.getTextTransform().getFunction());
- assertEquals(CameraFunction.class, layer.getTextTransform().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextTransform().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextTransformAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-transform");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textTransform(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextTransform());
- assertNotNull(layer.getTextTransform().getFunction());
- assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextTransform().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextTransformAsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-transform");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textTransform(
- property(
- "FeaturePropertyA",
- interval(
- stop(1, textTransform(TEXT_TRANSFORM_NONE))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextTransform());
- assertNotNull(layer.getTextTransform().getFunction());
- assertEquals(SourceFunction.class, layer.getTextTransform().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextTransform().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextOffsetAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-offset");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textOffset(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testTextOffsetAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOffset(
- zoom(
- exponential(
- stop(2, textOffset(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOffset());
- assertNotNull(layer.getTextOffset().getFunction());
- assertEquals(CameraFunction.class, layer.getTextOffset().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextOffset().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextOffset().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextOffsetAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOffset(property("FeaturePropertyA", Stops.<Float[]>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextOffset());
- assertNotNull(layer.getTextOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextOffsetAsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-offset");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOffset(
- property(
- "FeaturePropertyA",
- interval(
- stop(1, textOffset(new Float[]{0f,0f}))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOffset());
- assertNotNull(layer.getTextOffset().getFunction());
- assertEquals(SourceFunction.class, layer.getTextOffset().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOffset().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.getTextOffset().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextAllowOverlapAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-allow-overlap");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textAllowOverlap(true));
- assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true);
- }
-
- @Test
- public void testTextAllowOverlapAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-allow-overlap");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textAllowOverlap(
- zoom(
- interval(
- stop(2, textAllowOverlap(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextAllowOverlap());
- assertNotNull(layer.getTextAllowOverlap().getFunction());
- assertEquals(CameraFunction.class, layer.getTextAllowOverlap().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextAllowOverlap().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextAllowOverlap().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextIgnorePlacementAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-ignore-placement");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textIgnorePlacement(true));
- assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true);
- }
-
- @Test
- public void testTextIgnorePlacementAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-ignore-placement");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textIgnorePlacement(
- zoom(
- interval(
- stop(2, textIgnorePlacement(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextIgnorePlacement());
- assertNotNull(layer.getTextIgnorePlacement().getFunction());
- assertEquals(CameraFunction.class, layer.getTextIgnorePlacement().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextIgnorePlacement().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextIgnorePlacement().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextOptionalAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-optional");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textOptional(true));
- assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true);
- }
-
- @Test
- public void testTextOptionalAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-optional");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOptional(
- zoom(
- interval(
- stop(2, textOptional(true))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOptional());
- assertNotNull(layer.getTextOptional().getFunction());
- assertEquals(CameraFunction.class, layer.getTextOptional().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextOptional().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextOptional().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconOpacityTransition(options);
- assertEquals(layer.getIconOpacityTransition(), options);
- }
-
- @Test
- public void testIconOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconOpacity(0.3f));
- assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOpacity(
- zoom(
- exponential(
- stop(2, iconOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOpacity());
- assertNotNull(layer.getIconOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getIconOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconOpacity());
- assertNotNull(layer.getIconOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, iconOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOpacity());
- assertNotNull(layer.getIconOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, iconOpacity(0.3f))
- )
- ).withDefaultValue(iconOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOpacity());
- assertNotNull(layer.getIconOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getIconOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getIconOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testIconOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, iconOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(iconOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconOpacity());
- assertNotNull(layer.getIconOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getIconOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getIconOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testIconColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconColorTransition(options);
- assertEquals(layer.getIconColorTransition(), options);
- }
-
- @Test
- public void testIconColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testIconColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconColor(
- zoom(
- exponential(
- stop(2, iconColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconColor());
- assertNotNull(layer.getIconColor().getFunction());
- assertEquals(CameraFunction.class, layer.getIconColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconColor());
- assertNotNull(layer.getIconColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, iconColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconColor());
- assertNotNull(layer.getIconColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", iconColor(Color.RED))
- )
- ).withDefaultValue(iconColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconColor());
- assertNotNull(layer.getIconColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testIconColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconColor(Color.RED));
- assertEquals(layer.getIconColorAsInt(), Color.RED);
- }
-
- @Test
- public void testIconHaloColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloColorTransition(options);
- assertEquals(layer.getIconHaloColorTransition(), options);
- }
-
- @Test
- public void testIconHaloColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testIconHaloColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloColor(
- zoom(
- exponential(
- stop(2, iconHaloColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloColor());
- assertNotNull(layer.getIconHaloColor().getFunction());
- assertEquals(CameraFunction.class, layer.getIconHaloColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconHaloColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconHaloColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconHaloColor());
- assertNotNull(layer.getIconHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconHaloColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, iconHaloColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloColor());
- assertNotNull(layer.getIconHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconHaloColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", iconHaloColor(Color.RED))
- )
- ).withDefaultValue(iconHaloColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloColor());
- assertNotNull(layer.getIconHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconHaloColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getIconHaloColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testIconHaloColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconHaloColor(Color.RED));
- assertEquals(layer.getIconHaloColorAsInt(), Color.RED);
- }
-
- @Test
- public void testIconHaloWidthTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloWidthTransition(options);
- assertEquals(layer.getIconHaloWidthTransition(), options);
- }
-
- @Test
- public void testIconHaloWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconHaloWidth(0.3f));
- assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconHaloWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloWidth(
- zoom(
- exponential(
- stop(2, iconHaloWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloWidth());
- assertNotNull(layer.getIconHaloWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getIconHaloWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconHaloWidthAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloWidth(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconHaloWidth());
- assertNotNull(layer.getIconHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloWidthAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloWidth(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, iconHaloWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloWidth());
- assertNotNull(layer.getIconHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloWidthAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloWidth(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, iconHaloWidth(0.3f))
- )
- ).withDefaultValue(iconHaloWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloWidth());
- assertNotNull(layer.getIconHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloWidth().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getIconHaloWidth().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testIconHaloWidthAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloWidth(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, iconHaloWidth(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(iconHaloWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloWidth());
- assertNotNull(layer.getIconHaloWidth().getFunction());
- assertEquals(CompositeFunction.class, layer.getIconHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconHaloWidth().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getIconHaloWidth().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloWidth().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testIconHaloBlurTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconHaloBlurTransition(options);
- assertEquals(layer.getIconHaloBlurTransition(), options);
- }
-
- @Test
- public void testIconHaloBlurAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconHaloBlur(0.3f));
- assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testIconHaloBlurAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloBlur(
- zoom(
- exponential(
- stop(2, iconHaloBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloBlur());
- assertNotNull(layer.getIconHaloBlur().getFunction());
- assertEquals(CameraFunction.class, layer.getIconHaloBlur().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconHaloBlurAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloBlur(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getIconHaloBlur());
- assertNotNull(layer.getIconHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloBlurAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloBlur(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, iconHaloBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloBlur());
- assertNotNull(layer.getIconHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testIconHaloBlurAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloBlur(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, iconHaloBlur(0.3f))
- )
- ).withDefaultValue(iconHaloBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloBlur());
- assertNotNull(layer.getIconHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getIconHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconHaloBlur().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getIconHaloBlur().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testIconHaloBlurAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconHaloBlur(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, iconHaloBlur(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(iconHaloBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getIconHaloBlur());
- assertNotNull(layer.getIconHaloBlur().getFunction());
- assertEquals(CompositeFunction.class, layer.getIconHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getIconHaloBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getIconHaloBlur().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getIconHaloBlur().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getIconHaloBlur().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testIconTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setIconTranslateTransition(options);
- assertEquals(layer.getIconTranslateTransition(), options);
- }
-
- @Test
- public void testIconTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testIconTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconTranslate(
- zoom(
- exponential(
- stop(2, iconTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconTranslate());
- assertNotNull(layer.getIconTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getIconTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getIconTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testIconTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testIconTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("icon-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- iconTranslateAnchor(
- zoom(
- interval(
- stop(2, iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getIconTranslateAnchor());
- assertNotNull(layer.getIconTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getIconTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getIconTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getIconTranslateAnchor().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextOpacityTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacityTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextOpacityTransition(options);
- assertEquals(layer.getTextOpacityTransition(), options);
- }
-
- @Test
- public void testTextOpacityAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textOpacity(0.3f));
- assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextOpacityAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOpacity(
- zoom(
- exponential(
- stop(2, textOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOpacity());
- assertNotNull(layer.getTextOpacity().getFunction());
- assertEquals(CameraFunction.class, layer.getTextOpacity().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextOpacityAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOpacity(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextOpacity());
- assertNotNull(layer.getTextOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextOpacityAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOpacity(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, textOpacity(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOpacity());
- assertNotNull(layer.getTextOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextOpacityAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOpacity(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, textOpacity(0.3f))
- )
- ).withDefaultValue(textOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOpacity());
- assertNotNull(layer.getTextOpacity().getFunction());
- assertEquals(SourceFunction.class, layer.getTextOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextOpacity().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextOpacity().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getTextOpacity().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testTextOpacityAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-opacity");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textOpacity(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, textOpacity(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(textOpacity(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextOpacity());
- assertNotNull(layer.getTextOpacity().getFunction());
- assertEquals(CompositeFunction.class, layer.getTextOpacity().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextOpacity().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextOpacity().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getTextOpacity().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextOpacity().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testTextColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextColorTransition(options);
- assertEquals(layer.getTextColorTransition(), options);
- }
-
- @Test
- public void testTextColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testTextColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textColor(
- zoom(
- exponential(
- stop(2, textColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextColor());
- assertNotNull(layer.getTextColor().getFunction());
- assertEquals(CameraFunction.class, layer.getTextColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextColor());
- assertNotNull(layer.getTextColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, textColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextColor());
- assertNotNull(layer.getTextColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", textColor(Color.RED))
- )
- ).withDefaultValue(textColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextColor());
- assertNotNull(layer.getTextColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testTextColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textColor(Color.RED));
- assertEquals(layer.getTextColorAsInt(), Color.RED);
- }
-
- @Test
- public void testTextHaloColorTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-colorTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloColorTransition(options);
- assertEquals(layer.getTextHaloColorTransition(), options);
- }
-
- @Test
- public void testTextHaloColorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)"));
- assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)");
- }
-
- @Test
- public void testTextHaloColorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloColor(
- zoom(
- exponential(
- stop(2, textHaloColor("rgba(0, 0, 0, 1)"))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloColor());
- assertNotNull(layer.getTextHaloColor().getFunction());
- assertEquals(CameraFunction.class, layer.getTextHaloColor().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextHaloColor().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextHaloColorAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloColor(property("FeaturePropertyA", Stops.<String>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextHaloColor());
- assertNotNull(layer.getTextHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextHaloColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloColorAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloColor(
- property(
- "FeaturePropertyA",
- exponential(
- stop(Color.RED, textHaloColor(Color.RED))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloColor());
- assertNotNull(layer.getTextHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextHaloColor().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloColorAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloColor(
- property(
- "FeaturePropertyA",
- categorical(
- stop("valueA", textHaloColor(Color.RED))
- )
- ).withDefaultValue(textHaloColor(Color.GREEN))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloColor());
- assertNotNull(layer.getTextHaloColor().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloColor().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloColor().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextHaloColor().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getValue());
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.getTextHaloColor().getFunction()).getDefaultValue().getColorInt());
- }
-
- @Test
- public void testTextHaloColorAsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-color");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textHaloColor(Color.RED));
- assertEquals(layer.getTextHaloColorAsInt(), Color.RED);
- }
-
- @Test
- public void testTextHaloWidthTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-widthTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloWidthTransition(options);
- assertEquals(layer.getTextHaloWidthTransition(), options);
- }
-
- @Test
- public void testTextHaloWidthAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textHaloWidth(0.3f));
- assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextHaloWidthAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloWidth(
- zoom(
- exponential(
- stop(2, textHaloWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloWidth());
- assertNotNull(layer.getTextHaloWidth().getFunction());
- assertEquals(CameraFunction.class, layer.getTextHaloWidth().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextHaloWidthAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloWidth(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextHaloWidth());
- assertNotNull(layer.getTextHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloWidthAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloWidth(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, textHaloWidth(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloWidth());
- assertNotNull(layer.getTextHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloWidthAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloWidth(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, textHaloWidth(0.3f))
- )
- ).withDefaultValue(textHaloWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloWidth());
- assertNotNull(layer.getTextHaloWidth().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloWidth().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getTextHaloWidth().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testTextHaloWidthAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-width");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloWidth(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, textHaloWidth(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(textHaloWidth(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloWidth());
- assertNotNull(layer.getTextHaloWidth().getFunction());
- assertEquals(CompositeFunction.class, layer.getTextHaloWidth().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloWidth().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextHaloWidth().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getTextHaloWidth().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloWidth().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testTextHaloBlurTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blurTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextHaloBlurTransition(options);
- assertEquals(layer.getTextHaloBlurTransition(), options);
- }
-
- @Test
- public void testTextHaloBlurAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textHaloBlur(0.3f));
- assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f);
- }
-
- @Test
- public void testTextHaloBlurAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloBlur(
- zoom(
- exponential(
- stop(2, textHaloBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloBlur());
- assertNotNull(layer.getTextHaloBlur().getFunction());
- assertEquals(CameraFunction.class, layer.getTextHaloBlur().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextHaloBlurAsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloBlur(property("FeaturePropertyA", Stops.<Float>identity()))
- );
-
- // Verify
- assertNotNull(layer.getTextHaloBlur());
- assertNotNull(layer.getTextHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloBlurAsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloBlur(
- property(
- "FeaturePropertyA",
- exponential(
- stop(0.3f, textHaloBlur(0.3f))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloBlur());
- assertNotNull(layer.getTextHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass());
- }
-
- @Test
- public void testTextHaloBlurAsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloBlur(
- property(
- "FeaturePropertyA",
- categorical(
- stop(1.0f, textHaloBlur(0.3f))
- )
- ).withDefaultValue(textHaloBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloBlur());
- assertNotNull(layer.getTextHaloBlur().getFunction());
- assertEquals(SourceFunction.class, layer.getTextHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextHaloBlur().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue());
- assertEquals(0.3f, ((SourceFunction) layer.getTextHaloBlur().getFunction()).getDefaultValue().getValue());
- }
-
- @Test
- public void testTextHaloBlurAsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-halo-blur");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textHaloBlur(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, textHaloBlur(0.9f))
- ).withBase(0.5f)
- ).withDefaultValue(textHaloBlur(0.3f))
- )
- );
-
- // Verify
- assertNotNull(layer.getTextHaloBlur());
- assertNotNull(layer.getTextHaloBlur().getFunction());
- assertEquals(CompositeFunction.class, layer.getTextHaloBlur().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextHaloBlur().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.getTextHaloBlur().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.getTextHaloBlur().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, Float>, Float> stops =
- (ExponentialStops<Stop.CompositeValue<Float, Float>, Float>) layer.getTextHaloBlur().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, Float>, Float> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-
- @Test
- public void testTextTranslateTransition() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-translateTransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.setTextTranslateTransition(options);
- assertEquals(layer.getTextTranslateTransition(), options);
- }
-
- @Test
- public void testTextTranslateAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-translate");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textTranslate(new Float[]{0f,0f}));
- assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[]{0f,0f});
- }
-
- @Test
- public void testTextTranslateAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-translate");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textTranslate(
- zoom(
- exponential(
- stop(2, textTranslate(new Float[]{0f,0f}))
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextTranslate());
- assertNotNull(layer.getTextTranslate().getFunction());
- assertEquals(CameraFunction.class, layer.getTextTranslate().getFunction().getClass());
- assertEquals(ExponentialStops.class, layer.getTextTranslate().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).size());
- }
-
- @Test
- public void testTextTranslateAnchorAsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-translate-anchor");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP));
- assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP);
- }
-
- @Test
- public void testTextTranslateAnchorAsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("text-translate-anchor");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- textTranslateAnchor(
- zoom(
- interval(
- stop(2, textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP))
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.getTextTranslateAnchor());
- assertNotNull(layer.getTextTranslateAnchor().getFunction());
- assertEquals(CameraFunction.class, layer.getTextTranslateAnchor().getFunction().getClass());
- assertEquals(IntervalStops.class, layer.getTextTranslateAnchor().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.getTextTranslateAnchor().getFunction().getStops()).size());
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
deleted file mode 100644
index 02aedadfa5..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ /dev/null
@@ -1,392 +0,0 @@
-<%
- const type = locals.type;
- const properties = locals.properties;
--%>
-// This file is generated. Edit android/platform/scripts/generate-style-code.js, then run `make android-style-code`.
-
-package com.mapbox.mapboxsdk.testapp.style;
-
-import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
-import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
-import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
-
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
-import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-
-/**
- * Basic smoke tests for <%- camelize(type) %>Layer
- */
-@RunWith(AndroidJUnit4.class)
-public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
-
- private <%- camelize(type) %>Layer layer;
-
- @Override
- protected Class getActivityClass() {
- return EspressoTestActivity.class;
- }
-
- private void setupLayer(){
-<% if (type === 'background') { -%>
- Timber.i("Retrieving layer");
- layer = mapboxMap.getLayerAs("background");
-<% } else { -%>
- if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
- Timber.i("Adding layer");
- layer = new <%- camelize(type) %>Layer("my-layer", "composite");
- layer.setSourceLayer("composite");
- mapboxMap.addLayer(layer);
- // Layer reference is now stale, get new reference
- layer = mapboxMap.getLayerAs("my-layer");
- }
-<% } -%>
- }
-
- @Test
- public void testSetVisibility() {
- validateTestSetup();
- setupLayer();
- Timber.i("Visibility");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getVisibility().getValue(), VISIBLE);
-
- // Set
- layer.setProperties(visibility(NONE));
- assertEquals(layer.getVisibility().getValue(), NONE);
- }
-<% if (!(type === 'background' || type === 'raster')) { -%>
-
- @Test
- public void testSourceLayer() {
- validateTestSetup();
- setupLayer();
- Timber.i("SourceLayer");
- assertNotNull(layer);
-
- // Get initial
- assertEquals(layer.getSourceLayer(), "composite");
-
- // Set
- final String sourceLayer = "test";
- layer.setSourceLayer(sourceLayer);
- assertEquals(layer.getSourceLayer(), sourceLayer);
- }
-<% } -%>
-<% for (const property of properties) { -%>
-<% if (property.transition) { -%>
-
- @Test
- public void test<%- camelize(property.name) %>Transition() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>TransitionOptions");
- assertNotNull(layer);
-
- // Set and Get
- TransitionOptions options = new TransitionOptions(300, 100);
- layer.set<%- camelize(property.name) %>Transition(options);
- assertEquals(layer.get<%- camelize(property.name) %>Transition(), options);
- }
-<% } -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>));
- assertEquals((<%- propertyType(property) %>) layer.get<%- camelize(property.name) %>().getValue(), (<%- propertyType(property) %>) <%- defaultValueJava(property) %>);
- }
-<% if (supportsZoomFunction(property)) { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsCameraFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- zoom(
-<% if (property.function == 'piecewise-constant') { -%>
- interval(
- stop(2, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
- )
-<% } else { -%>
- exponential(
- stop(2, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
- ).withBase(0.5f)
-<% } -%>
- )
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(CameraFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
-<% if (property.function == 'piecewise-constant') { -%>
- assertEquals(IntervalStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- assertEquals(1, ((IntervalStops) layer.get<%- camelize(property.name) %>().getFunction().getStops()).size());
-<% } else { -%>
- assertEquals(ExponentialStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- assertEquals(0.5f, ((ExponentialStops) layer.get<%- camelize(property.name) %>().getFunction().getStops()).getBase(), 0.001);
- assertEquals(1, ((ExponentialStops) layer.get<%- camelize(property.name) %>().getFunction().getStops()).size());
-<% } -%>
- }
-<% } -%>
-<% if (supportsPropertyFunction(property)) { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsIdentitySourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(property("FeaturePropertyA", Stops.<<%- propertyType(property) %>>identity()))
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(SourceFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(IdentityStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- }
-<% if (property.function == 'piecewise-constant') { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- property(
- "FeaturePropertyA",
- interval(
-<% if (property.type == 'color') { -%>
- stop(Color.RED, <%- camelizeWithLeadingLowercase(property.name) %>(Color.RED))
-<% } else {-%>
- stop(1, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
- )
-<% } -%>
- )
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(SourceFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- }
-<% } else if (property.type === 'array') { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsIntervalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- property(
- "FeaturePropertyA",
- interval(
-<% if (property.type == 'color') { -%>
- stop(Color.RED, <%- camelizeWithLeadingLowercase(property.name) %>(Color.RED))
-<% } else {-%>
- stop(1, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
-<% } -%>
- )
- )
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(SourceFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(IntervalStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- }
-<% } else { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsExponentialSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- property(
- "FeaturePropertyA",
- exponential(
-<% if (property.type == 'color') { -%>
- stop(Color.RED, <%- camelizeWithLeadingLowercase(property.name) %>(Color.RED))
-<% } else {-%>
- stop(<%- defaultValueJava(property) %>, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
-<% } -%>
- ).withBase(0.5f)
- )
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(SourceFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- }
-
- @Test
- public void test<%- camelize(property.name) %>AsCategoricalSourceFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- property(
- "FeaturePropertyA",
- categorical(
-<% if (property.type == 'color') { -%>
- stop("valueA", <%- camelizeWithLeadingLowercase(property.name) %>(Color.RED))
- )
- ).withDefaultValue(<%- camelizeWithLeadingLowercase(property.name) %>(Color.GREEN))
-<% } else {-%>
- stop(1.0f, <%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
- )
- ).withDefaultValue(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
-<% } -%>
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(SourceFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(CategoricalStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- assertNotNull(((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getDefaultValue());
- assertNotNull(((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getDefaultValue().getValue());
-<% if (property.type === 'color') { -%>
- assertEquals(Color.GREEN, (int) ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getDefaultValue().getColorInt());
-<% } else { -%>
- assertEquals(<%- defaultValueJava(property) %>, ((SourceFunction) layer.get<%- camelize(property.name) %>().getFunction()).getDefaultValue().getValue());
-<% } -%>
- }
-<% if (property.type !== 'color') { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsCompositeFunction() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set
- layer.setProperties(
- <%- camelizeWithLeadingLowercase(property.name) %>(
- composite(
- "FeaturePropertyA",
- exponential(
- stop(0, 0.3f, <%- camelizeWithLeadingLowercase(property.name) %>(0.9f))
- ).withBase(0.5f)
-<% if (property.type == 'number') { -%>
- ).withDefaultValue(<%- camelizeWithLeadingLowercase(property.name) %>(<%- defaultValueJava(property) %>))
-<% } else { -%>
- )
-<% } -%>
- )
- );
-
- // Verify
- assertNotNull(layer.get<%- camelize(property.name) %>());
- assertNotNull(layer.get<%- camelize(property.name) %>().getFunction());
- assertEquals(CompositeFunction.class, layer.get<%- camelize(property.name) %>().getFunction().getClass());
- assertEquals("FeaturePropertyA", ((CompositeFunction) layer.get<%- camelize(property.name) %>().getFunction()).getProperty());
- assertEquals(ExponentialStops.class, layer.get<%- camelize(property.name) %>().getFunction().getStops().getClass());
- assertEquals(1, ((ExponentialStops) layer.get<%- camelize(property.name) %>().getFunction().getStops()).size());
-
- ExponentialStops<Stop.CompositeValue<Float, <%- propertyType(property) %>>, <%- propertyType(property) %>> stops =
- (ExponentialStops<Stop.CompositeValue<Float, <%- propertyType(property) %>>, <%- propertyType(property) %>>) layer.get<%- camelize(property.name) %>().getFunction().getStops();
- Stop<Stop.CompositeValue<Float, <%- propertyType(property) %>>, <%- propertyType(property) %>> stop = stops.iterator().next();
- assertEquals(0f, stop.in.zoom, 0.001);
- assertEquals(0.3f, stop.in.value, 0.001f);
- assertEquals(0.9f, stop.out, 0.001f);
- }
-<% } -%>
-<% } -%>
-<% } -%>
-<% if (property.type == 'color') { -%>
-
- @Test
- public void test<%- camelize(property.name) %>AsIntConstant() {
- validateTestSetup();
- setupLayer();
- Timber.i("<%- property.name %>");
- assertNotNull(layer);
-
- // Set and Get
- layer.setProperties(<%- camelizeWithLeadingLowercase(property.name) %>(Color.RED));
- assertEquals(layer.get<%- camelize(property.name) %>AsInt(), Color.RED);
- }
-<% } -%>
-<% } -%>
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
index 9a7790c6e5..6b39b5d7ed 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/FillExtrusionActivity.java
@@ -26,6 +26,7 @@ import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionOpa
public class FillExtrusionActivity extends AppCompatActivity {
private MapView mapView;
+ private MapboxMap mapboxMap;
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -38,6 +39,7 @@ public class FillExtrusionActivity extends AppCompatActivity {
@Override
public void onMapReady(@NonNull
final MapboxMap map) {
+ mapboxMap = map;
Polygon domTower = Polygon.fromCoordinates(new double[][][] {
new double[][] {
new double[] {
@@ -66,7 +68,7 @@ public class FillExtrusionActivity extends AppCompatActivity {
GeoJsonSource source = new GeoJsonSource("extrusion-source", domTower);
map.addSource(source);
- map.addLayer(
+ mapboxMap.addLayer(
new FillExtrusionLayer("extrusion-layer", source.getId())
.withProperties(
fillExtrusionHeight(40f),
@@ -75,16 +77,16 @@ public class FillExtrusionActivity extends AppCompatActivity {
)
);
- map.animateCamera(
- CameraUpdateFactory.newCameraPosition(
- new CameraPosition.Builder()
- .target(new LatLng(52.09071040847704, 5.12112557888031))
- .tilt(45.0)
- .zoom(18)
- .build()
- ),
- 10000
- );
+// map.animateCamera(
+// CameraUpdateFactory.newCameraPosition(
+// new CameraPosition.Builder()
+// .target(new LatLng(52.09071040847704, 5.12112557888031))
+// .tilt(45.0)
+// .zoom(18)
+// .build()
+// ),
+// 10000
+// );
}
});
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_fill_extrusion_layer.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_fill_extrusion_layer.xml
index 304841dc69..1a7f716af7 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_fill_extrusion_layer.xml
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_fill_extrusion_layer.xml
@@ -9,9 +9,10 @@
android:id="@id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:mapbox_cameraTargetLat="52.090710"
- app:mapbox_cameraTargetLng="5.121125"
- app:mapbox_cameraZoom="10"
+ app:mapbox_cameraTargetLat="52.09071040847704"
+ app:mapbox_cameraTargetLng="5.12112557888031"
+ app:mapbox_cameraTilt="45.0"
+ app:mapbox_cameraZoom="18"
app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/>
</RelativeLayout>
diff --git a/platform/android/build.gradle b/platform/android/build.gradle
index 120c0219e4..5ad615cf7e 100644
--- a/platform/android/build.gradle
+++ b/platform/android/build.gradle
@@ -3,7 +3,7 @@ buildscript {
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.4.0-alpha6'
classpath 'com.amazonaws:aws-devicefarm-gradle-plugin:1.2'
classpath 'com.stanfy.spoon:spoon-gradle-plugin:1.2.1'
}
diff --git a/platform/android/gradle/wrapper/gradle-wrapper.properties b/platform/android/gradle/wrapper/gradle-wrapper.properties
index c7ad166b13..c1165243f7 100644
--- a/platform/android/gradle/wrapper/gradle-wrapper.properties
+++ b/platform/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Mar 03 10:22:19 EST 2017
+#Mon Apr 24 16:30:27 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
diff --git a/platform/ios/vendor/SMCalloutView b/platform/ios/vendor/SMCalloutView
-Subproject 2aede5d8d1577101bf18405246220e7a710df60
+Subproject d6ecaba377c9f963aef630faf86e3b8f8cdb88d