From e59766f4e805a2cd081fbf30ab2365d05ddda8a3 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Mon, 12 Jun 2017 11:02:36 +0200 Subject: [android] - run MapboxMap invocations to ui thread for instrumentation tests (#9198) --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 5510 ++++++++++++-------- 1 file changed, 3203 insertions(+), 2307 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index 737a66713a..b0854f4a47 100644 --- 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 @@ -3,9 +3,9 @@ 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.espresso.UiController; import android.support.test.runner.AndroidJUnit4; + import timber.log.Timber; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -19,20 +19,16 @@ 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.action.MapboxMapAction; 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 com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; import static org.junit.Assert.*; import static com.mapbox.mapboxsdk.style.layers.Property.*; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*; @@ -53,15 +49,21 @@ public class SymbolLayerTest extends BaseActivityTest { 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"); - } + private void setupLayer() { + Timber.i("Retrieving layer"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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 @@ -69,14 +71,19 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); + } + }); } @Test @@ -84,15 +91,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); + } + }); } @Test @@ -100,11 +112,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); - assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); + // Set and Get + layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); + assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); + } + }); } @Test @@ -112,25 +129,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - assertNotNull(layer); - - // Set - layer.setProperties( - symbolPlacement( - zoom( - interval( - stop(2, symbolPlacement(SYMBOL_PLACEMENT_POINT)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -138,11 +160,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(symbolSpacing(0.3f)); - assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(symbolSpacing(0.3f)); + assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); + } + }); } @Test @@ -150,26 +177,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - assertNotNull(layer); - - // Set - layer.setProperties( - symbolSpacing( - zoom( - exponential( - stop(2, symbolSpacing(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -177,11 +209,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(symbolAvoidEdges(true)); - assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(symbolAvoidEdges(true)); + assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); + } + }); } @Test @@ -189,25 +226,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - assertNotNull(layer); - - // Set - layer.setProperties( - symbolAvoidEdges( - zoom( - interval( - stop(2, symbolAvoidEdges(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -215,11 +257,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconAllowOverlap(true)); - assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(iconAllowOverlap(true)); + assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); + } + }); } @Test @@ -227,25 +274,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconAllowOverlap( - zoom( - interval( - stop(2, iconAllowOverlap(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -253,11 +305,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconIgnorePlacement(true)); - assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(iconIgnorePlacement(true)); + assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); + } + }); } @Test @@ -265,25 +322,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconIgnorePlacement( - zoom( - interval( - stop(2, iconIgnorePlacement(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -291,11 +353,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconOptional(true)); - assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(iconOptional(true)); + assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); + } + }); } @Test @@ -303,25 +370,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOptional( - zoom( - interval( - stop(2, iconOptional(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -329,11 +401,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); + // Set and Get + layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); + } + }); } @Test @@ -341,25 +418,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotationAlignment( - zoom( - interval( - stop(2, iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -367,11 +449,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconSize(0.3f)); - assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconSize(0.3f)); + assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); + } + }); } @Test @@ -379,26 +466,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - zoom( - exponential( - stop(2, iconSize(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -406,19 +498,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconSize(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconSize(property("FeaturePropertyA", Stops.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()); + // 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 @@ -426,26 +523,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconSize(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -453,29 +555,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconSize(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconSize(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -483,34 +591,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getIconSize().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconSize().getFunction().getStops(); + Stop, 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 @@ -518,11 +631,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); - assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); + // Set and Get + layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); + assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); + } + }); } @Test @@ -530,25 +648,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconTextFit( - zoom( - interval( - stop(2, iconTextFit(ICON_TEXT_FIT_NONE)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -556,11 +679,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit-padding"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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}); + // 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 @@ -568,26 +696,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -595,11 +728,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconImage("undefined")); - assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); + // Set and Get + layer.setProperties(iconImage("undefined")); + assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); + } + }); } @Test @@ -607,25 +745,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - zoom( - interval( - stop(2, iconImage("undefined")) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -633,19 +776,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconImage(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconImage(property("FeaturePropertyA", Stops.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()); + // 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 @@ -653,26 +801,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - property( - "FeaturePropertyA", - interval( - stop(1, iconImage("undefined")) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -680,11 +833,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconRotate(0.3f)); - assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconRotate(0.3f)); + assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); + } + }); } @Test @@ -692,26 +850,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - zoom( - exponential( - stop(2, iconRotate(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -719,19 +882,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconRotate(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconRotate(property("FeaturePropertyA", Stops.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()); + // 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 @@ -739,26 +907,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconRotate(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -766,29 +939,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconRotate(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconRotate(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -796,34 +975,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getIconRotate().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconRotate().getFunction().getStops(); + Stop, 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 @@ -831,11 +1015,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconPadding(0.3f)); - assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconPadding(0.3f)); + assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); + } + }); } @Test @@ -843,26 +1032,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconPadding( - zoom( - exponential( - stop(2, iconPadding(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -870,11 +1064,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconKeepUpright(true)); - assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(iconKeepUpright(true)); + assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); + } + }); } @Test @@ -882,25 +1081,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconKeepUpright( - zoom( - interval( - stop(2, iconKeepUpright(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -908,11 +1112,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconOffset(new Float[]{0f,0f})); - assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[]{0f,0f}); + // Set and Get + layer.setProperties(iconOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); + } + }); } @Test @@ -920,26 +1129,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - zoom( - exponential( - stop(2, iconOffset(new Float[]{0f,0f})) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -947,19 +1161,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconOffset(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconOffset(property("FeaturePropertyA", Stops.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()); + // 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 @@ -967,26 +1186,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - property( - "FeaturePropertyA", - interval( - stop(1, iconOffset(new Float[]{0f,0f})) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -994,11 +1218,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); + // Set and Get + layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); + } + }); } @Test @@ -1006,25 +1235,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - assertNotNull(layer); - - // Set - layer.setProperties( - textPitchAlignment( - zoom( - interval( - stop(2, textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1032,11 +1266,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); + // Set and Get + layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); + } + }); } @Test @@ -1044,25 +1283,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - assertNotNull(layer); - - // Set - layer.setProperties( - textRotationAlignment( - zoom( - interval( - stop(2, textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1070,11 +1314,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textField("")); - assertEquals((String) layer.getTextField().getValue(), (String) ""); + // Set and Get + layer.setProperties(textField("")); + assertEquals((String) layer.getTextField().getValue(), (String) ""); + } + }); } @Test @@ -1082,25 +1331,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - zoom( - interval( - stop(2, textField("")) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1108,19 +1362,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textField(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textField(property("FeaturePropertyA", Stops.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()); + // 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 @@ -1128,26 +1387,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - property( - "FeaturePropertyA", - interval( - stop(1, textField("")) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1155,11 +1419,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-font"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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"}); + // 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 @@ -1167,25 +1436,30 @@ public class SymbolLayerTest extends BaseActivityTest { 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"})) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1193,11 +1467,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textSize(0.3f)); - assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textSize(0.3f)); + assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1205,26 +1484,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - zoom( - exponential( - stop(2, textSize(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1232,19 +1516,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textSize(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textSize(property("FeaturePropertyA", Stops.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()); + // 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 @@ -1252,26 +1541,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textSize(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1279,29 +1573,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textSize(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textSize(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -1309,34 +1609,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getTextSize().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextSize().getFunction().getStops(); + Stop, 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 @@ -1344,11 +1649,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textMaxWidth(0.3f)); - assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textMaxWidth(0.3f)); + assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1356,26 +1666,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - zoom( - exponential( - stop(2, textMaxWidth(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1383,11 +1698,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textLineHeight(0.3f)); - assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textLineHeight(0.3f)); + assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1395,26 +1715,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - assertNotNull(layer); - - // Set - layer.setProperties( - textLineHeight( - zoom( - exponential( - stop(2, textLineHeight(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1422,11 +1747,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textLetterSpacing(0.3f)); - assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textLetterSpacing(0.3f)); + assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1434,26 +1764,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - zoom( - exponential( - stop(2, textLetterSpacing(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1461,11 +1796,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); - assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); + // Set and Get + layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); + assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); + } + }); } @Test @@ -1473,25 +1813,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify( - zoom( - interval( - stop(2, textJustify(TEXT_JUSTIFY_LEFT)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1499,11 +1844,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); - assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); + // Set and Get + layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); + assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); + } + }); } @Test @@ -1511,25 +1861,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor( - zoom( - interval( - stop(2, textAnchor(TEXT_ANCHOR_CENTER)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1537,11 +1892,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textMaxAngle(0.3f)); - assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textMaxAngle(0.3f)); + assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1549,26 +1909,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxAngle( - zoom( - exponential( - stop(2, textMaxAngle(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1576,11 +1941,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textRotate(0.3f)); - assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textRotate(0.3f)); + assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1588,26 +1958,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - zoom( - exponential( - stop(2, textRotate(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1615,19 +1990,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textRotate(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textRotate(property("FeaturePropertyA", Stops.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()); + // 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 @@ -1635,26 +2015,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textRotate(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1662,29 +2047,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textRotate(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textRotate(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -1692,34 +2083,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getTextRotate().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextRotate().getFunction().getStops(); + Stop, 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 @@ -1727,11 +2123,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textPadding(0.3f)); - assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textPadding(0.3f)); + assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); + } + }); } @Test @@ -1739,26 +2140,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - assertNotNull(layer); - - // Set - layer.setProperties( - textPadding( - zoom( - exponential( - stop(2, textPadding(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1766,11 +2172,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textKeepUpright(true)); - assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(textKeepUpright(true)); + assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); + } + }); } @Test @@ -1778,25 +2189,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - assertNotNull(layer); - - // Set - layer.setProperties( - textKeepUpright( - zoom( - interval( - stop(2, textKeepUpright(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1804,11 +2220,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); - assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); + // Set and Get + layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); + assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); + } + }); } @Test @@ -1816,25 +2237,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - zoom( - interval( - stop(2, textTransform(TEXT_TRANSFORM_NONE)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1842,19 +2268,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textTransform(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textTransform(property("FeaturePropertyA", Stops.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()); + // 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 @@ -1862,26 +2293,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - property( - "FeaturePropertyA", - interval( - stop(1, textTransform(TEXT_TRANSFORM_NONE)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1889,11 +2325,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textOffset(new Float[]{0f,0f})); - assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[]{0f,0f}); + // Set and Get + layer.setProperties(textOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); + } + }); } @Test @@ -1901,26 +2342,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - zoom( - exponential( - stop(2, textOffset(new Float[]{0f,0f})) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1928,19 +2374,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textOffset(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textOffset(property("FeaturePropertyA", Stops.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()); + // 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 @@ -1948,26 +2399,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - property( - "FeaturePropertyA", - interval( - stop(1, textOffset(new Float[]{0f,0f})) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -1975,11 +2431,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textAllowOverlap(true)); - assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(textAllowOverlap(true)); + assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); + } + }); } @Test @@ -1987,25 +2448,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - assertNotNull(layer); - - // Set - layer.setProperties( - textAllowOverlap( - zoom( - interval( - stop(2, textAllowOverlap(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2013,11 +2479,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textIgnorePlacement(true)); - assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(textIgnorePlacement(true)); + assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); + } + }); } @Test @@ -2025,25 +2496,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - assertNotNull(layer); - - // Set - layer.setProperties( - textIgnorePlacement( - zoom( - interval( - stop(2, textIgnorePlacement(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2051,11 +2527,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textOptional(true)); - assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); + // Set and Get + layer.setProperties(textOptional(true)); + assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); + } + }); } @Test @@ -2063,25 +2544,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOptional( - zoom( - interval( - stop(2, textOptional(true)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2089,12 +2575,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacityTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconOpacityTransition(options); - assertEquals(layer.getIconOpacityTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconOpacityTransition(options); + assertEquals(layer.getIconOpacityTransition(), options); + } + }); } @Test @@ -2102,11 +2593,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconOpacity(0.3f)); - assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconOpacity(0.3f)); + assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); + } + }); } @Test @@ -2114,26 +2610,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - zoom( - exponential( - stop(2, iconOpacity(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2141,19 +2642,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconOpacity(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconOpacity(property("FeaturePropertyA", Stops.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()); + // 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 @@ -2161,26 +2667,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconOpacity(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2188,29 +2699,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconOpacity(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconOpacity(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -2218,34 +2735,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getIconOpacity().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconOpacity().getFunction().getStops(); + Stop, 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 @@ -2253,12 +2775,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-colorTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconColorTransition(options); - assertEquals(layer.getIconColorTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconColorTransition(options); + assertEquals(layer.getIconColorTransition(), options); + } + }); } @Test @@ -2266,11 +2793,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + // Set and Get + layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + } + }); } @Test @@ -2278,26 +2810,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2305,19 +2842,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconColor(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconColor(property("FeaturePropertyA", Stops.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()); + // 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 @@ -2325,26 +2867,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, iconColor(Color.RED)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2352,29 +2899,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", iconColor(Color.RED)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", iconColor(Color.RED)) + ) + ).withDefaultValue(iconColor(Color.GREEN)) ) - ).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()); + } + }); - // 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 @@ -2382,11 +2935,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconColor(Color.RED)); - assertEquals(layer.getIconColorAsInt(), Color.RED); + // Set and Get + layer.setProperties(iconColor(Color.RED)); + assertEquals(layer.getIconColorAsInt(), Color.RED); + } + }); } @Test @@ -2394,12 +2952,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-colorTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloColorTransition(options); - assertEquals(layer.getIconHaloColorTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloColorTransition(options); + assertEquals(layer.getIconHaloColorTransition(), options); + } + }); } @Test @@ -2407,11 +2970,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + // Set and Get + layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + } + }); } @Test @@ -2419,26 +2987,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2446,19 +3019,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconHaloColor(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconHaloColor(property("FeaturePropertyA", Stops.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()); + // 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 @@ -2466,26 +3044,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2493,29 +3076,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", iconHaloColor(Color.RED)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", iconHaloColor(Color.RED)) + ) + ).withDefaultValue(iconHaloColor(Color.GREEN)) ) - ).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()); + } + }); - // 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 @@ -2523,11 +3112,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconHaloColor(Color.RED)); - assertEquals(layer.getIconHaloColorAsInt(), Color.RED); + // Set and Get + layer.setProperties(iconHaloColor(Color.RED)); + assertEquals(layer.getIconHaloColorAsInt(), Color.RED); + } + }); } @Test @@ -2535,12 +3129,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-widthTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloWidthTransition(options); - assertEquals(layer.getIconHaloWidthTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloWidthTransition(options); + assertEquals(layer.getIconHaloWidthTransition(), options); + } + }); } @Test @@ -2548,11 +3147,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconHaloWidth(0.3f)); - assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconHaloWidth(0.3f)); + assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); + } + }); } @Test @@ -2560,26 +3164,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - zoom( - exponential( - stop(2, iconHaloWidth(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2587,19 +3196,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconHaloWidth(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconHaloWidth(property("FeaturePropertyA", Stops.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()); + // 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 @@ -2607,26 +3221,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2634,29 +3253,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconHaloWidth(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconHaloWidth(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -2664,34 +3289,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getIconHaloWidth().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconHaloWidth().getFunction().getStops(); + Stop, 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 @@ -2699,12 +3329,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blurTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloBlurTransition(options); - assertEquals(layer.getIconHaloBlurTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloBlurTransition(options); + assertEquals(layer.getIconHaloBlurTransition(), options); + } + }); } @Test @@ -2712,11 +3347,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconHaloBlur(0.3f)); - assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(iconHaloBlur(0.3f)); + assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); + } + }); } @Test @@ -2724,26 +3364,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - zoom( - exponential( - stop(2, iconHaloBlur(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2751,19 +3396,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - iconHaloBlur(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + iconHaloBlur(property("FeaturePropertyA", Stops.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()); + // 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 @@ -2771,26 +3421,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2798,29 +3453,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, iconHaloBlur(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, iconHaloBlur(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -2828,34 +3489,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getIconHaloBlur().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconHaloBlur().getFunction().getStops(); + Stop, 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 @@ -2863,12 +3529,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translateTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconTranslateTransition(options); - assertEquals(layer.getIconTranslateTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconTranslateTransition(options); + assertEquals(layer.getIconTranslateTransition(), options); + } + }); } @Test @@ -2876,11 +3547,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconTranslate(new Float[]{0f,0f})); - assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[]{0f,0f}); + // Set and Get + layer.setProperties(iconTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); + } + }); } @Test @@ -2888,26 +3564,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslate( - zoom( - exponential( - stop(2, iconTranslate(new Float[]{0f,0f})) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2915,11 +3596,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); + // Set and Get + layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); + } + }); } @Test @@ -2927,25 +3613,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslateAnchor( - zoom( - interval( - stop(2, iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -2953,12 +3644,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacityTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextOpacityTransition(options); - assertEquals(layer.getTextOpacityTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextOpacityTransition(options); + assertEquals(layer.getTextOpacityTransition(), options); + } + }); } @Test @@ -2966,11 +3662,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textOpacity(0.3f)); - assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textOpacity(0.3f)); + assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); + } + }); } @Test @@ -2978,26 +3679,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - zoom( - exponential( - stop(2, textOpacity(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3005,19 +3711,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textOpacity(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textOpacity(property("FeaturePropertyA", Stops.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()); + // 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 @@ -3025,26 +3736,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textOpacity(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3052,29 +3768,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textOpacity(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textOpacity(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -3082,34 +3804,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getTextOpacity().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextOpacity().getFunction().getStops(); + Stop, 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 @@ -3117,12 +3844,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-colorTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextColorTransition(options); - assertEquals(layer.getTextColorTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextColorTransition(options); + assertEquals(layer.getTextColorTransition(), options); + } + }); } @Test @@ -3130,11 +3862,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + // Set and Get + layer.setProperties(textColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + } + }); } @Test @@ -3142,26 +3879,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3169,19 +3911,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textColor(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textColor(property("FeaturePropertyA", Stops.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()); + // 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 @@ -3189,26 +3936,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, textColor(Color.RED)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3216,29 +3968,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", textColor(Color.RED)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", textColor(Color.RED)) + ) + ).withDefaultValue(textColor(Color.GREEN)) ) - ).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()); + } + }); - // 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 @@ -3246,11 +4004,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textColor(Color.RED)); - assertEquals(layer.getTextColorAsInt(), Color.RED); + // Set and Get + layer.setProperties(textColor(Color.RED)); + assertEquals(layer.getTextColorAsInt(), Color.RED); + } + }); } @Test @@ -3258,12 +4021,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-colorTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloColorTransition(options); - assertEquals(layer.getTextHaloColorTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloColorTransition(options); + assertEquals(layer.getTextHaloColorTransition(), options); + } + }); } @Test @@ -3271,11 +4039,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + // Set and Get + layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); + } + }); } @Test @@ -3283,26 +4056,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3310,19 +4088,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textHaloColor(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textHaloColor(property("FeaturePropertyA", Stops.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()); + // 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 @@ -3330,26 +4113,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3357,29 +4145,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - property( - "FeaturePropertyA", - categorical( - stop("valueA", textHaloColor(Color.RED)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor( + property( + "FeaturePropertyA", + categorical( + stop("valueA", textHaloColor(Color.RED)) + ) + ).withDefaultValue(textHaloColor(Color.GREEN)) ) - ).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()); + } + }); - // 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 @@ -3387,11 +4181,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textHaloColor(Color.RED)); - assertEquals(layer.getTextHaloColorAsInt(), Color.RED); + // Set and Get + layer.setProperties(textHaloColor(Color.RED)); + assertEquals(layer.getTextHaloColorAsInt(), Color.RED); + } + }); } @Test @@ -3399,12 +4198,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-widthTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloWidthTransition(options); - assertEquals(layer.getTextHaloWidthTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloWidthTransition(options); + assertEquals(layer.getTextHaloWidthTransition(), options); + } + }); } @Test @@ -3412,11 +4216,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textHaloWidth(0.3f)); - assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textHaloWidth(0.3f)); + assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); + } + }); } @Test @@ -3424,26 +4233,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - zoom( - exponential( - stop(2, textHaloWidth(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3451,19 +4265,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textHaloWidth(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textHaloWidth(property("FeaturePropertyA", Stops.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()); + // 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 @@ -3471,26 +4290,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3498,29 +4322,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textHaloWidth(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textHaloWidth(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -3528,34 +4358,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getTextHaloWidth().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextHaloWidth().getFunction().getStops(); + Stop, 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 @@ -3563,12 +4398,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blurTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloBlurTransition(options); - assertEquals(layer.getTextHaloBlurTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloBlurTransition(options); + assertEquals(layer.getTextHaloBlurTransition(), options); + } + }); } @Test @@ -3576,11 +4416,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textHaloBlur(0.3f)); - assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); + // Set and Get + layer.setProperties(textHaloBlur(0.3f)); + assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); + } + }); } @Test @@ -3588,26 +4433,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - zoom( - exponential( - stop(2, textHaloBlur(0.3f)) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3615,19 +4465,24 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set - layer.setProperties( - textHaloBlur(property("FeaturePropertyA", Stops.identity())) - ); + // Set + layer.setProperties( + textHaloBlur(property("FeaturePropertyA", Stops.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()); + // 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 @@ -3635,26 +4490,31 @@ public class SymbolLayerTest extends BaseActivityTest { 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) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3662,29 +4522,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textHaloBlur(0.3f)) + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textHaloBlur(0.3f)) + ) + ).withDefaultValue(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()); + } + }); - // 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 @@ -3692,34 +4558,39 @@ public class SymbolLayerTest extends BaseActivityTest { 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, Float> stops = - (ExponentialStops, Float>) layer.getTextHaloBlur().getFunction().getStops(); - Stop, 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); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextHaloBlur().getFunction().getStops(); + Stop, 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 @@ -3727,12 +4598,17 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translateTransitionOptions"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextTranslateTransition(options); - assertEquals(layer.getTextTranslateTransition(), options); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextTranslateTransition(options); + assertEquals(layer.getTextTranslateTransition(), options); + } + }); } @Test @@ -3740,11 +4616,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textTranslate(new Float[]{0f,0f})); - assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[]{0f,0f}); + // Set and Get + layer.setProperties(textTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); + } + }); } @Test @@ -3752,26 +4633,31 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - assertNotNull(layer); - - // Set - layer.setProperties( - textTranslate( - zoom( - exponential( - stop(2, textTranslate(new Float[]{0f,0f})) - ).withBase(0.5f) - ) - ) - ); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + // 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 @@ -3779,11 +4665,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate-anchor"); - assertNotNull(layer); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); - // Set and Get - layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); + // Set and Get + layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); + } + }); } @Test @@ -3791,25 +4682,30 @@ public class SymbolLayerTest extends BaseActivityTest { 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()); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + 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()); + } + }); } } -- cgit v1.2.1 From e8657becc56c2aee5b070357092da028e752d461 Mon Sep 17 00:00:00 2001 From: Chris Loer Date: Tue, 11 Jul 2017 11:22:39 -0700 Subject: [core] Update shaders. Implements 'icon-pitch-alignment' (issue #9345) Fixes issue #9456 (map-aligned point label regression) --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index b0854f4a47..fc8c4320a5 100644 --- 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 @@ -1213,6 +1213,54 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testIconPitchAlignmentAsConstant() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-pitch-alignment"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP); + } + }); + } + + @Test + public void testIconPitchAlignmentAsCameraFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-pitch-alignment"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconPitchAlignment( + zoom( + interval( + stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)) + ) + ) + ) + ); + + // Verify + assertNotNull(layer.getIconPitchAlignment()); + assertNotNull(layer.getIconPitchAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size()); + } + }); + } + @Test public void testTextPitchAlignmentAsConstant() { validateTestSetup(); -- cgit v1.2.1 From a8ef2af353de195648578bf0d753703cb6f34905 Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Wed, 26 Jul 2017 13:18:47 -0700 Subject: [core][android][macos][ios] Implement property functions for line-join, text-justify, text-anchor (#9583) --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index fc8c4320a5..e2694af348 100644 --- 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 @@ -1887,6 +1887,63 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testTextJustifyAsIdentitySourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-justify"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextJustifyAsIntervalSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-justify"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify( + property( + "FeaturePropertyA", + interval( + stop(1, textJustify(TEXT_JUSTIFY_LEFT)) + ) + ) + ) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); + } + }); + } + @Test public void testTextAnchorAsConstant() { validateTestSetup(); @@ -1935,6 +1992,63 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testTextAnchorAsIdentitySourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextAnchorAsIntervalSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, textAnchor(TEXT_ANCHOR_CENTER)) + ) + ) + ) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); + } + }); + } + @Test public void testTextMaxAngleAsConstant() { validateTestSetup(); -- cgit v1.2.1 From 2de89a99bc86776c8cadedc0ae9b344fb78b8217 Mon Sep 17 00:00:00 2001 From: Lauren Budorick Date: Mon, 28 Aug 2017 13:32:56 -0700 Subject: Implement icon-anchor property --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index e2694af348..1c9faeb9ea 100644 --- 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 @@ -1213,6 +1213,111 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testIconAnchorAsConstant() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER)); + assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER); + } + }); + } + + @Test + public void testIconAnchorAsCameraFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + zoom( + interval( + stop(2, iconAnchor(ICON_ANCHOR_CENTER)) + ) + ) + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconAnchor().getFunction().getStops()).size()); + } + }); + } + + @Test + public void testIconAnchorAsIdentitySourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testIconAnchorAsIntervalSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("icon-anchor"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, iconAnchor(ICON_ANCHOR_CENTER)) + ) + ) + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); + } + }); + } + @Test public void testIconPitchAlignmentAsConstant() { validateTestSetup(); -- cgit v1.2.1 From 69b52367d35616850b73b03f807ab5c0747c5187 Mon Sep 17 00:00:00 2001 From: Asheem Mamoowala Date: Fri, 25 Aug 2017 16:11:24 -0700 Subject: [core][ios][macos][android]DDS-ify `text-letter-spacing` and `text-max-width` --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 266 +++++++++++++++++++++ 1 file changed, 266 insertions(+) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index 1c9faeb9ea..f8248ae4a7 100644 --- 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 @@ -1846,6 +1846,139 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testTextMaxWidthAsIdentitySourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-max-width"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextMaxWidthAsExponentialSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-max-width"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textMaxWidth(0.3f)) + ).withBase(0.5f) + ) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextMaxWidthAsCategoricalSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-max-width"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textMaxWidth(0.3f)) + ) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); + } + }); + + } + + @Test + public void testTextMaxWidthAsCompositeFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-max-width"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textMaxWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); + + ExponentialStops, Float> stops = + (ExponentialStops, Float>) layer.getTextMaxWidth().getFunction().getStops(); + Stop, 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 testTextLineHeightAsConstant() { validateTestSetup(); @@ -1944,6 +2077,139 @@ public class SymbolLayerTest extends BaseActivityTest { }); } + @Test + public void testTextLetterSpacingAsIdentitySourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-letter-spacing"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextLetterSpacingAsExponentialSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-letter-spacing"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textLetterSpacing(0.3f)) + ).withBase(0.5f) + ) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + } + }); + } + + @Test + public void testTextLetterSpacingAsCategoricalSourceFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-letter-spacing"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textLetterSpacing(0.3f)) + ) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); + } + }); + + } + + @Test + public void testTextLetterSpacingAsCompositeFunction() { + validateTestSetup(); + setupLayer(); + Timber.i("text-letter-spacing"); + invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { + @Override + public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textLetterSpacing(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); + + ExponentialStops, Float> stops = + (ExponentialStops, Float>) layer.getTextLetterSpacing().getFunction().getStops(); + Stop, 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 testTextJustifyAsConstant() { validateTestSetup(); -- cgit v1.2.1 From 1b0a5f633a6a6e826b0ec2b27d6c08712d6dd4cb Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 23 Nov 2017 10:09:05 +0100 Subject: [android] - replace anonymous inner classes with lambda --- .../mapboxsdk/testapp/style/SymbolLayerTest.java | 6527 +++++++++----------- 1 file changed, 3003 insertions(+), 3524 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java') 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 index f8248ae4a7..cb79700430 100644 --- 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 @@ -3,14 +3,10 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; -import android.support.test.espresso.UiController; 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.CompositeFunction; import com.mapbox.mapboxsdk.style.functions.SourceFunction; import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops; import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops; @@ -19,22 +15,90 @@ 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.action.MapboxMapAction; +import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; +import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; import org.junit.Test; import org.junit.runner.RunWith; -import static com.mapbox.mapboxsdk.style.functions.Function.*; +import timber.log.Timber; + +import static com.mapbox.mapboxsdk.style.functions.Function.composite; +import static com.mapbox.mapboxsdk.style.functions.Function.property; +import static com.mapbox.mapboxsdk.style.functions.Function.zoom; import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop; -import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.categorical; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.exponential; +import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ANCHOR_CENTER; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_PITCH_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_ROTATION_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_TEXT_FIT_NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.ICON_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.SYMBOL_PLACEMENT_POINT; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ANCHOR_CENTER; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_JUSTIFY_LEFT; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_PITCH_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_ROTATION_ALIGNMENT_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_TRANSFORM_NONE; +import static com.mapbox.mapboxsdk.style.layers.Property.TEXT_TRANSLATE_ANCHOR_MAP; +import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconHaloWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconKeepUpright; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOffset; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOptional; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconPitchAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotationAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTextFit; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTextFitPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolAvoidEdges; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolPlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.symbolSpacing; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAllowOverlap; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textField; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textFont; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloBlur; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloColor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textHaloWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textIgnorePlacement; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textJustify; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textKeepUpright; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textLetterSpacing; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textLineHeight; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textMaxAngle; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textMaxWidth; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOffset; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOpacity; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textOptional; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textPadding; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textPitchAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textRotate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textRotationAlignment; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textSize; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTransform; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTranslate; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.textTranslateAnchor; +import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility; import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke; -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; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; /** * Basic smoke tests for SymbolLayer @@ -51,17 +115,14 @@ public class SymbolLayerTest extends BaseActivityTest { private void setupLayer() { Timber.i("Retrieving layer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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"); } }); } @@ -71,18 +132,15 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("Visibility"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); - // Get initial - assertEquals(layer.getVisibility().getValue(), VISIBLE); + // Get initial + assertEquals(layer.getVisibility().getValue(), VISIBLE); - // Set - layer.setProperties(visibility(NONE)); - assertEquals(layer.getVisibility().getValue(), NONE); - } + // Set + layer.setProperties(visibility(NONE)); + assertEquals(layer.getVisibility().getValue(), NONE); }); } @@ -91,19 +149,16 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("SourceLayer"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Get initial - assertEquals(layer.getSourceLayer(), "composite"); - - // Set - final String sourceLayer = "test"; - layer.setSourceLayer(sourceLayer); - assertEquals(layer.getSourceLayer(), sourceLayer); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Get initial + assertEquals(layer.getSourceLayer(), "composite"); + + // Set + final String sourceLayer = "test"; + layer.setSourceLayer(sourceLayer); + assertEquals(layer.getSourceLayer(), sourceLayer); }); } @@ -112,15 +167,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); - assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolPlacement(SYMBOL_PLACEMENT_POINT)); + assertEquals((String) layer.getSymbolPlacement().getValue(), (String) SYMBOL_PLACEMENT_POINT); }); } @@ -129,29 +181,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolPlacement( - zoom( - interval( - stop(2, symbolPlacement(SYMBOL_PLACEMENT_POINT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -160,15 +209,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolSpacing(0.3f)); - assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolSpacing(0.3f)); + assertEquals((Float) layer.getSymbolSpacing().getValue(), (Float) 0.3f); }); } @@ -177,30 +223,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolSpacing( - zoom( - exponential( - stop(2, symbolSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -209,15 +252,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(symbolAvoidEdges(true)); - assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(symbolAvoidEdges(true)); + assertEquals((Boolean) layer.getSymbolAvoidEdges().getValue(), (Boolean) true); }); } @@ -226,29 +266,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("symbol-avoid-edges"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - symbolAvoidEdges( - zoom( - interval( - stop(2, symbolAvoidEdges(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -257,15 +294,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconAllowOverlap(true)); - assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconAllowOverlap(true)); + assertEquals((Boolean) layer.getIconAllowOverlap().getValue(), (Boolean) true); }); } @@ -274,29 +308,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAllowOverlap( - zoom( - interval( - stop(2, iconAllowOverlap(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -305,15 +336,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconIgnorePlacement(true)); - assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconIgnorePlacement(true)); + assertEquals((Boolean) layer.getIconIgnorePlacement().getValue(), (Boolean) true); }); } @@ -322,29 +350,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconIgnorePlacement( - zoom( - interval( - stop(2, iconIgnorePlacement(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -353,15 +378,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOptional(true)); - assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOptional(true)); + assertEquals((Boolean) layer.getIconOptional().getValue(), (Boolean) true); }); } @@ -370,29 +392,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOptional( - zoom( - interval( - stop(2, iconOptional(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -401,15 +420,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconRotationAlignment().getValue(), (String) ICON_ROTATION_ALIGNMENT_MAP); }); } @@ -418,29 +434,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotationAlignment( - zoom( - interval( - stop(2, iconRotationAlignment(ICON_ROTATION_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -449,15 +462,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconSize(0.3f)); - assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconSize(0.3f)); + assertEquals((Float) layer.getIconSize().getValue(), (Float) 0.3f); }); } @@ -466,30 +476,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - zoom( - exponential( - stop(2, iconSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -498,23 +505,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconSize(property("FeaturePropertyA", Stops.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()); }); } @@ -523,30 +527,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -555,33 +556,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -591,38 +589,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getIconSize().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconSize().getFunction().getStops(); + Stop, 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); }); } @@ -631,15 +626,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); - assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTextFit(ICON_TEXT_FIT_NONE)); + assertEquals((String) layer.getIconTextFit().getValue(), (String) ICON_TEXT_FIT_NONE); }); } @@ -648,29 +640,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTextFit( - zoom( - interval( - stop(2, iconTextFit(ICON_TEXT_FIT_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -679,15 +668,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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}); }); } @@ -696,30 +682,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-text-fit-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTextFitPadding( - zoom( - exponential( - stop(2, iconTextFitPadding(new Float[] {0f, 0f, 0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -728,15 +711,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconImage("undefined")); - assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconImage("undefined")); + assertEquals((String) layer.getIconImage().getValue(), (String) "undefined"); }); } @@ -745,29 +725,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - zoom( - interval( - stop(2, iconImage("undefined")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -776,23 +753,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconImage(property("FeaturePropertyA", Stops.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()); }); } @@ -801,30 +775,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-image"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconImage( - property( - "FeaturePropertyA", - interval( - stop(1, iconImage("undefined")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -833,15 +804,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconRotate(0.3f)); - assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconRotate(0.3f)); + assertEquals((Float) layer.getIconRotate().getValue(), (Float) 0.3f); }); } @@ -850,30 +818,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - zoom( - exponential( - stop(2, iconRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -882,23 +847,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconRotate(property("FeaturePropertyA", Stops.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()); }); } @@ -907,30 +869,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -939,33 +898,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -975,38 +931,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getIconRotate().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconRotate().getFunction().getStops(); + Stop, 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); }); } @@ -1015,15 +968,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconPadding(0.3f)); - assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconPadding(0.3f)); + assertEquals((Float) layer.getIconPadding().getValue(), (Float) 0.3f); }); } @@ -1032,30 +982,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconPadding( - zoom( - exponential( - stop(2, iconPadding(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1064,15 +1011,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconKeepUpright(true)); - assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconKeepUpright(true)); + assertEquals((Boolean) layer.getIconKeepUpright().getValue(), (Boolean) true); }); } @@ -1081,29 +1025,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconKeepUpright( - zoom( - interval( - stop(2, iconKeepUpright(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1112,15 +1053,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOffset(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconOffset().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -1129,30 +1067,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - zoom( - exponential( - stop(2, iconOffset(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1161,23 +1096,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOffset(property("FeaturePropertyA", Stops.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()); }); } @@ -1186,30 +1118,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOffset( - property( - "FeaturePropertyA", - interval( - stop(1, iconOffset(new Float[] {0f, 0f})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1218,15 +1147,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER)); - assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconAnchor(ICON_ANCHOR_CENTER)); + assertEquals((String) layer.getIconAnchor().getValue(), (String) ICON_ANCHOR_CENTER); }); } @@ -1235,29 +1161,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor( - zoom( - interval( - stop(2, iconAnchor(ICON_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + zoom( + interval( + stop(2, iconAnchor(ICON_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(CameraFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconAnchor().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(CameraFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconAnchor().getFunction().getStops()).size()); }); } @@ -1266,23 +1189,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor(property("FeaturePropertyA", Stops.identity())) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); }); } @@ -1291,30 +1211,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconAnchor( - property( - "FeaturePropertyA", - interval( - stop(1, iconAnchor(ICON_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, iconAnchor(ICON_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getIconAnchor()); - assertNotNull(layer.getIconAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconAnchor()); + assertNotNull(layer.getIconAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getIconAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getIconAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getIconAnchor().getFunction().getStops().getClass()); }); } @@ -1323,15 +1240,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getIconPitchAlignment().getValue(), (String) ICON_PITCH_ALIGNMENT_MAP); }); } @@ -1340,29 +1254,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconPitchAlignment( - zoom( - interval( - stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconPitchAlignment( + zoom( + interval( + stop(2, iconPitchAlignment(ICON_PITCH_ALIGNMENT_MAP)) ) ) - ); - - // Verify - assertNotNull(layer.getIconPitchAlignment()); - assertNotNull(layer.getIconPitchAlignment().getFunction()); - assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass()); - assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass()); - assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size()); - } + ) + ); + + // Verify + assertNotNull(layer.getIconPitchAlignment()); + assertNotNull(layer.getIconPitchAlignment().getFunction()); + assertEquals(CameraFunction.class, layer.getIconPitchAlignment().getFunction().getClass()); + assertEquals(IntervalStops.class, layer.getIconPitchAlignment().getFunction().getStops().getClass()); + assertEquals(1, ((IntervalStops) layer.getIconPitchAlignment().getFunction().getStops()).size()); }); } @@ -1371,15 +1282,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextPitchAlignment().getValue(), (String) TEXT_PITCH_ALIGNMENT_MAP); }); } @@ -1388,29 +1296,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-pitch-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textPitchAlignment( - zoom( - interval( - stop(2, textPitchAlignment(TEXT_PITCH_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1419,15 +1324,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); - assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)); + assertEquals((String) layer.getTextRotationAlignment().getValue(), (String) TEXT_ROTATION_ALIGNMENT_MAP); }); } @@ -1436,29 +1338,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotation-alignment"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotationAlignment( - zoom( - interval( - stop(2, textRotationAlignment(TEXT_ROTATION_ALIGNMENT_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1467,15 +1366,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textField("")); - assertEquals((String) layer.getTextField().getValue(), (String) ""); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textField("")); + assertEquals((String) layer.getTextField().getValue(), (String) ""); }); } @@ -1484,29 +1380,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - zoom( - interval( - stop(2, textField("")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1515,23 +1408,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textField(property("FeaturePropertyA", Stops.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()); }); } @@ -1540,30 +1430,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-field"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textField( - property( - "FeaturePropertyA", - interval( - stop(1, textField("")) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1572,15 +1459,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-font"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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"}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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"}); }); } @@ -1589,29 +1473,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-font"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textFont( - zoom( - interval( - stop(2, textFont(new String[]{"Open Sans Regular", "Arial Unicode MS Regular"})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1620,15 +1501,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textSize(0.3f)); - assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textSize(0.3f)); + assertEquals((Float) layer.getTextSize().getValue(), (Float) 0.3f); }); } @@ -1637,30 +1515,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - zoom( - exponential( - stop(2, textSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1669,23 +1544,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textSize(property("FeaturePropertyA", Stops.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()); }); } @@ -1694,30 +1566,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textSize( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textSize(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1726,33 +1595,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -1762,38 +1628,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-size"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getTextSize().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextSize().getFunction().getStops(); + Stop, 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); }); } @@ -1802,15 +1665,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textMaxWidth(0.3f)); - assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textMaxWidth(0.3f)); + assertEquals((Float) layer.getTextMaxWidth().getValue(), (Float) 0.3f); }); } @@ -1819,30 +1679,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - zoom( - exponential( - stop(2, textMaxWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -1851,23 +1708,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth(property("FeaturePropertyA", Stops.identity())) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); }); } @@ -1876,30 +1730,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textMaxWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textMaxWidth(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); }); } @@ -1908,33 +1759,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textMaxWidth(0.3f)) - ) - ).withDefaultValue(textMaxWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textMaxWidth(0.3f)) + ) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(SourceFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextMaxWidth().getFunction()).getDefaultValue().getValue()); }); } @@ -1944,38 +1792,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxWidth( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textMaxWidth(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textMaxWidth(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextMaxWidth()); - assertNotNull(layer.getTextMaxWidth().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextMaxWidth().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextMaxWidth().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); - - ExponentialStops, Float> stops = - (ExponentialStops, Float>) layer.getTextMaxWidth().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textMaxWidth( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textMaxWidth(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textMaxWidth(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextMaxWidth()); + assertNotNull(layer.getTextMaxWidth().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextMaxWidth().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextMaxWidth().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextMaxWidth().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size()); + + ExponentialStops, Float> stops = + (ExponentialStops, Float>) layer.getTextMaxWidth().getFunction().getStops(); + Stop, 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); }); } @@ -1984,15 +1829,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textLineHeight(0.3f)); - assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textLineHeight(0.3f)); + assertEquals((Float) layer.getTextLineHeight().getValue(), (Float) 0.3f); }); } @@ -2001,30 +1843,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-line-height"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLineHeight( - zoom( - exponential( - stop(2, textLineHeight(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2033,15 +1872,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textLetterSpacing(0.3f)); - assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textLetterSpacing(0.3f)); + assertEquals((Float) layer.getTextLetterSpacing().getValue(), (Float) 0.3f); }); } @@ -2050,30 +1886,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - zoom( - exponential( - stop(2, textLetterSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2082,23 +1915,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing(property("FeaturePropertyA", Stops.identity())) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); }); } @@ -2107,30 +1937,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textLetterSpacing(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + exponential( + stop(0.3f, textLetterSpacing(0.3f)) + ).withBase(0.5f) ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); }); } @@ -2139,33 +1966,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - property( - "FeaturePropertyA", - categorical( - stop(1.0f, textLetterSpacing(0.3f)) - ) - ).withDefaultValue(textLetterSpacing(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(CategoricalStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue()); - assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); - assertEquals(0.3f, ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + property( + "FeaturePropertyA", + categorical( + stop(1.0f, textLetterSpacing(0.3f)) + ) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(SourceFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(CategoricalStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue()); + assertNotNull(((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); + assertEquals(0.3f, ((SourceFunction) layer.getTextLetterSpacing().getFunction()).getDefaultValue().getValue()); }); } @@ -2175,38 +1999,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-letter-spacing"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textLetterSpacing( - composite( - "FeaturePropertyA", - exponential( - stop(0, 0.3f, textLetterSpacing(0.9f)) - ).withBase(0.5f) - ).withDefaultValue(textLetterSpacing(0.3f)) - ) - ); - - // Verify - assertNotNull(layer.getTextLetterSpacing()); - assertNotNull(layer.getTextLetterSpacing().getFunction()); - assertEquals(CompositeFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); - assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); - assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); - - ExponentialStops, Float> stops = - (ExponentialStops, Float>) layer.getTextLetterSpacing().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textLetterSpacing( + composite( + "FeaturePropertyA", + exponential( + stop(0, 0.3f, textLetterSpacing(0.9f)) + ).withBase(0.5f) + ).withDefaultValue(textLetterSpacing(0.3f)) + ) + ); + + // Verify + assertNotNull(layer.getTextLetterSpacing()); + assertNotNull(layer.getTextLetterSpacing().getFunction()); + assertEquals(CompositeFunction.class, layer.getTextLetterSpacing().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((CompositeFunction) layer.getTextLetterSpacing().getFunction()).getProperty()); + assertEquals(ExponentialStops.class, layer.getTextLetterSpacing().getFunction().getStops().getClass()); + assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size()); + + ExponentialStops, Float> stops = + (ExponentialStops, Float>) layer.getTextLetterSpacing().getFunction().getStops(); + Stop, 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); }); } @@ -2215,15 +2036,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); - assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textJustify(TEXT_JUSTIFY_LEFT)); + assertEquals((String) layer.getTextJustify().getValue(), (String) TEXT_JUSTIFY_LEFT); }); } @@ -2232,29 +2050,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify( - zoom( - interval( - stop(2, textJustify(TEXT_JUSTIFY_LEFT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2263,23 +2078,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify(property("FeaturePropertyA", Stops.identity())) - ); - - // Verify - assertNotNull(layer.getTextJustify()); - assertNotNull(layer.getTextJustify().getFunction()); - assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextJustify().getFunction().getStops().getClass()); }); } @@ -2288,30 +2100,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-justify"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textJustify( - property( - "FeaturePropertyA", - interval( - stop(1, textJustify(TEXT_JUSTIFY_LEFT)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textJustify( + property( + "FeaturePropertyA", + interval( + stop(1, textJustify(TEXT_JUSTIFY_LEFT)) ) ) - ); - - // Verify - assertNotNull(layer.getTextJustify()); - assertNotNull(layer.getTextJustify().getFunction()); - assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextJustify()); + assertNotNull(layer.getTextJustify().getFunction()); + assertEquals(SourceFunction.class, layer.getTextJustify().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextJustify().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextJustify().getFunction().getStops().getClass()); }); } @@ -2320,15 +2129,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); - assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textAnchor(TEXT_ANCHOR_CENTER)); + assertEquals((String) layer.getTextAnchor().getValue(), (String) TEXT_ANCHOR_CENTER); }); } @@ -2337,29 +2143,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor( - zoom( - interval( - stop(2, textAnchor(TEXT_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2368,23 +2171,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor(property("FeaturePropertyA", Stops.identity())) - ); - - // Verify - assertNotNull(layer.getTextAnchor()); - assertNotNull(layer.getTextAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); - assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor(property("FeaturePropertyA", Stops.identity())) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IdentityStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); }); } @@ -2393,30 +2193,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAnchor( - property( - "FeaturePropertyA", - interval( - stop(1, textAnchor(TEXT_ANCHOR_CENTER)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textAnchor( + property( + "FeaturePropertyA", + interval( + stop(1, textAnchor(TEXT_ANCHOR_CENTER)) ) ) - ); - - // Verify - assertNotNull(layer.getTextAnchor()); - assertNotNull(layer.getTextAnchor().getFunction()); - assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); - assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); - assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); - } + ) + ); + + // Verify + assertNotNull(layer.getTextAnchor()); + assertNotNull(layer.getTextAnchor().getFunction()); + assertEquals(SourceFunction.class, layer.getTextAnchor().getFunction().getClass()); + assertEquals("FeaturePropertyA", ((SourceFunction) layer.getTextAnchor().getFunction()).getProperty()); + assertEquals(IntervalStops.class, layer.getTextAnchor().getFunction().getStops().getClass()); }); } @@ -2425,15 +2222,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textMaxAngle(0.3f)); - assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textMaxAngle(0.3f)); + assertEquals((Float) layer.getTextMaxAngle().getValue(), (Float) 0.3f); }); } @@ -2442,30 +2236,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-max-angle"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textMaxAngle( - zoom( - exponential( - stop(2, textMaxAngle(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2474,15 +2265,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textRotate(0.3f)); - assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textRotate(0.3f)); + assertEquals((Float) layer.getTextRotate().getValue(), (Float) 0.3f); }); } @@ -2491,30 +2279,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - zoom( - exponential( - stop(2, textRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2523,23 +2308,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textRotate(property("FeaturePropertyA", Stops.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()); }); } @@ -2548,30 +2330,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textRotate( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textRotate(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2580,33 +2359,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -2616,38 +2392,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-rotate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getTextRotate().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextRotate().getFunction().getStops(); + Stop, 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); }); } @@ -2656,15 +2429,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textPadding(0.3f)); - assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textPadding(0.3f)); + assertEquals((Float) layer.getTextPadding().getValue(), (Float) 0.3f); }); } @@ -2673,30 +2443,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-padding"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textPadding( - zoom( - exponential( - stop(2, textPadding(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2705,15 +2472,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textKeepUpright(true)); - assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textKeepUpright(true)); + assertEquals((Boolean) layer.getTextKeepUpright().getValue(), (Boolean) true); }); } @@ -2722,29 +2486,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-keep-upright"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textKeepUpright( - zoom( - interval( - stop(2, textKeepUpright(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2753,15 +2514,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); - assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTransform(TEXT_TRANSFORM_NONE)); + assertEquals((String) layer.getTextTransform().getValue(), (String) TEXT_TRANSFORM_NONE); }); } @@ -2770,29 +2528,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - zoom( - interval( - stop(2, textTransform(TEXT_TRANSFORM_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2801,23 +2556,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textTransform(property("FeaturePropertyA", Stops.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()); }); } @@ -2826,30 +2578,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-transform"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTransform( - property( - "FeaturePropertyA", - interval( - stop(1, textTransform(TEXT_TRANSFORM_NONE)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2858,15 +2607,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOffset(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOffset(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextOffset().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -2875,30 +2621,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - zoom( - exponential( - stop(2, textOffset(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2907,23 +2650,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOffset(property("FeaturePropertyA", Stops.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()); }); } @@ -2932,30 +2672,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-offset"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOffset( - property( - "FeaturePropertyA", - interval( - stop(1, textOffset(new Float[] {0f, 0f})) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -2964,15 +2701,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textAllowOverlap(true)); - assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textAllowOverlap(true)); + assertEquals((Boolean) layer.getTextAllowOverlap().getValue(), (Boolean) true); }); } @@ -2981,29 +2715,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-allow-overlap"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textAllowOverlap( - zoom( - interval( - stop(2, textAllowOverlap(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3012,15 +2743,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textIgnorePlacement(true)); - assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textIgnorePlacement(true)); + assertEquals((Boolean) layer.getTextIgnorePlacement().getValue(), (Boolean) true); }); } @@ -3029,29 +2757,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-ignore-placement"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textIgnorePlacement( - zoom( - interval( - stop(2, textIgnorePlacement(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3060,15 +2785,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOptional(true)); - assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOptional(true)); + assertEquals((Boolean) layer.getTextOptional().getValue(), (Boolean) true); }); } @@ -3077,29 +2799,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-optional"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOptional( - zoom( - interval( - stop(2, textOptional(true)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3108,16 +2827,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconOpacityTransition(options); - assertEquals(layer.getIconOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconOpacityTransition(options); + assertEquals(layer.getIconOpacityTransition(), options); }); } @@ -3126,15 +2842,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconOpacity(0.3f)); - assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconOpacity(0.3f)); + assertEquals((Float) layer.getIconOpacity().getValue(), (Float) 0.3f); }); } @@ -3143,30 +2856,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - zoom( - exponential( - stop(2, iconOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3175,23 +2885,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconOpacity(property("FeaturePropertyA", Stops.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()); }); } @@ -3200,30 +2907,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3232,33 +2936,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -3268,38 +2969,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getIconOpacity().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconOpacity().getFunction().getStops(); + Stop, 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); }); } @@ -3308,16 +3006,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconColorTransition(options); - assertEquals(layer.getIconColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconColorTransition(options); + assertEquals(layer.getIconColorTransition(), options); }); } @@ -3326,15 +3021,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -3343,30 +3035,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - zoom( - exponential( - stop(2, iconColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3375,23 +3064,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconColor(property("FeaturePropertyA", Stops.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()); }); } @@ -3400,30 +3086,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, iconColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3432,33 +3115,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -3468,15 +3148,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconColor(Color.RED)); - assertEquals(layer.getIconColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconColor(Color.RED)); + assertEquals(layer.getIconColorAsInt(), Color.RED); }); } @@ -3485,16 +3162,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloColorTransition(options); - assertEquals(layer.getIconHaloColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloColorTransition(options); + assertEquals(layer.getIconHaloColorTransition(), options); }); } @@ -3503,15 +3177,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getIconHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -3520,30 +3191,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - zoom( - exponential( - stop(2, iconHaloColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3552,23 +3220,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloColor(property("FeaturePropertyA", Stops.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()); }); } @@ -3577,30 +3242,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, iconHaloColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3609,33 +3271,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -3645,15 +3304,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloColor(Color.RED)); - assertEquals(layer.getIconHaloColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloColor(Color.RED)); + assertEquals(layer.getIconHaloColorAsInt(), Color.RED); }); } @@ -3662,16 +3318,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloWidthTransition(options); - assertEquals(layer.getIconHaloWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloWidthTransition(options); + assertEquals(layer.getIconHaloWidthTransition(), options); }); } @@ -3680,15 +3333,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloWidth(0.3f)); - assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloWidth(0.3f)); + assertEquals((Float) layer.getIconHaloWidth().getValue(), (Float) 0.3f); }); } @@ -3697,30 +3347,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - zoom( - exponential( - stop(2, iconHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3729,23 +3376,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloWidth(property("FeaturePropertyA", Stops.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()); }); } @@ -3754,30 +3398,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3786,33 +3427,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -3822,38 +3460,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getIconHaloWidth().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconHaloWidth().getFunction().getStops(); + Stop, 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); }); } @@ -3862,16 +3497,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconHaloBlurTransition(options); - assertEquals(layer.getIconHaloBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconHaloBlurTransition(options); + assertEquals(layer.getIconHaloBlurTransition(), options); }); } @@ -3880,15 +3512,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconHaloBlur(0.3f)); - assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconHaloBlur(0.3f)); + assertEquals((Float) layer.getIconHaloBlur().getValue(), (Float) 0.3f); }); } @@ -3897,30 +3526,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - zoom( - exponential( - stop(2, iconHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3929,23 +3555,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + iconHaloBlur(property("FeaturePropertyA", Stops.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()); }); } @@ -3954,30 +3577,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconHaloBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, iconHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -3986,33 +3606,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -4022,38 +3639,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getIconHaloBlur().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getIconHaloBlur().getFunction().getStops(); + Stop, 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); }); } @@ -4062,16 +3676,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setIconTranslateTransition(options); - assertEquals(layer.getIconTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setIconTranslateTransition(options); + assertEquals(layer.getIconTranslateTransition(), options); }); } @@ -4080,15 +3691,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getIconTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -4097,30 +3705,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslate( - zoom( - exponential( - stop(2, iconTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4129,15 +3734,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getIconTranslateAnchor().getValue(), (String) ICON_TRANSLATE_ANCHOR_MAP); }); } @@ -4146,29 +3748,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("icon-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - iconTranslateAnchor( - zoom( - interval( - stop(2, iconTranslateAnchor(ICON_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4177,16 +3776,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacityTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextOpacityTransition(options); - assertEquals(layer.getTextOpacityTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextOpacityTransition(options); + assertEquals(layer.getTextOpacityTransition(), options); }); } @@ -4195,15 +3791,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textOpacity(0.3f)); - assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textOpacity(0.3f)); + assertEquals((Float) layer.getTextOpacity().getValue(), (Float) 0.3f); }); } @@ -4212,30 +3805,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - zoom( - exponential( - stop(2, textOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4244,23 +3834,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textOpacity(property("FeaturePropertyA", Stops.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()); }); } @@ -4269,30 +3856,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textOpacity( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textOpacity(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4301,33 +3885,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -4337,38 +3918,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-opacity"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getTextOpacity().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextOpacity().getFunction().getStops(); + Stop, 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); }); } @@ -4377,16 +3955,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextColorTransition(options); - assertEquals(layer.getTextColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextColorTransition(options); + assertEquals(layer.getTextColorTransition(), options); }); } @@ -4395,15 +3970,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -4412,30 +3984,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - zoom( - exponential( - stop(2, textColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4444,23 +4013,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textColor(property("FeaturePropertyA", Stops.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()); }); } @@ -4469,30 +4035,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, textColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4501,33 +4064,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -4537,15 +4097,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textColor(Color.RED)); - assertEquals(layer.getTextColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textColor(Color.RED)); + assertEquals(layer.getTextColorAsInt(), Color.RED); }); } @@ -4554,16 +4111,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-colorTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloColorTransition(options); - assertEquals(layer.getTextHaloColorTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloColorTransition(options); + assertEquals(layer.getTextHaloColorTransition(), options); }); } @@ -4572,15 +4126,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); - assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloColor("rgba(0, 0, 0, 1)")); + assertEquals((String) layer.getTextHaloColor().getValue(), (String) "rgba(0, 0, 0, 1)"); }); } @@ -4589,30 +4140,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - zoom( - exponential( - stop(2, textHaloColor("rgba(0, 0, 0, 1)")) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4621,23 +4169,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloColor(property("FeaturePropertyA", Stops.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()); }); } @@ -4646,30 +4191,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloColor( - property( - "FeaturePropertyA", - exponential( - stop(Color.RED, textHaloColor(Color.RED)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4678,33 +4220,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -4714,15 +4253,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-color"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloColor(Color.RED)); - assertEquals(layer.getTextHaloColorAsInt(), Color.RED); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloColor(Color.RED)); + assertEquals(layer.getTextHaloColorAsInt(), Color.RED); }); } @@ -4731,16 +4267,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-widthTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloWidthTransition(options); - assertEquals(layer.getTextHaloWidthTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloWidthTransition(options); + assertEquals(layer.getTextHaloWidthTransition(), options); }); } @@ -4749,15 +4282,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloWidth(0.3f)); - assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloWidth(0.3f)); + assertEquals((Float) layer.getTextHaloWidth().getValue(), (Float) 0.3f); }); } @@ -4766,30 +4296,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - zoom( - exponential( - stop(2, textHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4798,23 +4325,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloWidth(property("FeaturePropertyA", Stops.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()); }); } @@ -4823,30 +4347,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloWidth( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textHaloWidth(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4855,33 +4376,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -4891,38 +4409,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-width"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getTextHaloWidth().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextHaloWidth().getFunction().getStops(); + Stop, 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); }); } @@ -4931,16 +4446,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blurTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextHaloBlurTransition(options); - assertEquals(layer.getTextHaloBlurTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextHaloBlurTransition(options); + assertEquals(layer.getTextHaloBlurTransition(), options); }); } @@ -4949,15 +4461,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textHaloBlur(0.3f)); - assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textHaloBlur(0.3f)); + assertEquals((Float) layer.getTextHaloBlur().getValue(), (Float) 0.3f); }); } @@ -4966,30 +4475,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - zoom( - exponential( - stop(2, textHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -4998,23 +4504,20 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur(property("FeaturePropertyA", Stops.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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set + layer.setProperties( + textHaloBlur(property("FeaturePropertyA", Stops.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()); }); } @@ -5023,30 +4526,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textHaloBlur( - property( - "FeaturePropertyA", - exponential( - stop(0.3f, textHaloBlur(0.3f)) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -5055,33 +4555,30 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); }); } @@ -5091,38 +4588,35 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-halo-blur"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - 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, Float> stops = - (ExponentialStops, Float>) layer.getTextHaloBlur().getFunction().getStops(); - Stop, 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); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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, Float> stops = + (ExponentialStops, Float>) layer.getTextHaloBlur().getFunction().getStops(); + Stop, 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); }); } @@ -5131,16 +4625,13 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translateTransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - layer.setTextTranslateTransition(options); - assertEquals(layer.getTextTranslateTransition(), options); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + layer.setTextTranslateTransition(options); + assertEquals(layer.getTextTranslateTransition(), options); }); } @@ -5149,15 +4640,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTranslate(new Float[] {0f, 0f})); - assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTranslate(new Float[] {0f, 0f})); + assertEquals((Float[]) layer.getTextTranslate().getValue(), (Float[]) new Float[] {0f, 0f}); }); } @@ -5166,30 +4654,27 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTranslate( - zoom( - exponential( - stop(2, textTranslate(new Float[] {0f, 0f})) - ).withBase(0.5f) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } @@ -5198,15 +4683,12 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set and Get - layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); - assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(layer); + + // Set and Get + layer.setProperties(textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)); + assertEquals((String) layer.getTextTranslateAnchor().getValue(), (String) TEXT_TRANSLATE_ANCHOR_MAP); }); } @@ -5215,29 +4697,26 @@ public class SymbolLayerTest extends BaseActivityTest { validateTestSetup(); setupLayer(); Timber.i("text-translate-anchor"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(layer); - - // Set - layer.setProperties( - textTranslateAnchor( - zoom( - interval( - stop(2, textTranslateAnchor(TEXT_TRANSLATE_ANCHOR_MAP)) - ) + invoke(mapboxMap, (uiController, mapboxMap) -> { + 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()); - } + ) + ); + + // 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()); }); } -- cgit v1.2.1