From 6179110b6bfe8ee0880a055a31c12a88f9bd9b20 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Thu, 8 Mar 2018 16:27:02 +0100 Subject: [android] - add expression conversion, add getters (#11352) --- .../mapbox/mapboxsdk/testapp/style/light.junit.ejs | 56 +++++++++------------- 1 file changed, 22 insertions(+), 34 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs') diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs index 2f22a8f3f0..96f23871c5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs @@ -9,15 +9,12 @@ import android.support.test.espresso.ViewAction; import android.support.test.runner.AndroidJUnit4; import android.view.View; -import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.style.light.Light; -import com.mapbox.mapboxsdk.style.functions.Function; -import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops; +import com.mapbox.mapboxsdk.style.expressions.Expression; import com.mapbox.mapboxsdk.style.layers.FillExtrusionLayer; import com.mapbox.mapboxsdk.style.layers.TransitionOptions; import com.mapbox.mapboxsdk.style.light.Position; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest; import com.mapbox.mapboxsdk.testapp.activity.style.FillExtrusionStyleTestActivity; @@ -53,15 +50,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("<%- property.name %>TransitionOptions"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - TransitionOptions options = new TransitionOptions(300, 100); - light.set<%- camelize(property.name) %>Transition(options); - assertEquals("Transition options should match", options, light.get<%- camelize(property.name) %>Transition()); - } + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + TransitionOptions options = new TransitionOptions(300, 100); + light.set<%- camelize(property.name) %>Transition(options); + assertEquals("Transition options should match", options, light.get<%- camelize(property.name) %>Transition()); }); } <% } -%> @@ -72,15 +66,12 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - Position position = new Position(1, 2, 3); - light.set<%- camelize(property.name) %>(position); - assertEquals("Position should match", position, light.get<%- camelize(property.name) %>()); - } + invoke(mapboxMap,(uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + Position position = new Position(1, 2, 3); + light.set<%- camelize(property.name) %>(position); + assertEquals("Position should match", position, light.get<%- camelize(property.name) %>()); }); } <% } else { -%> @@ -90,18 +81,15 @@ public class LightTest extends BaseActivityTest { validateTestSetup(); setupLight(); Timber.i("<%- property.name %>"); - invoke(mapboxMap, new MapboxMapAction.OnInvokeActionListener() { - @Override - public void onInvokeAction(UiController uiController, MapboxMap mapboxMap) { - assertNotNull(light); - // Set and Get - light.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>); + invoke(mapboxMap, (uiController, mapboxMap) -> { + assertNotNull(light); + // Set and Get + light.set<%- camelize(property.name) %>(<%- defaultValueJava(property) %>); <% if (property.name == 'color') { -%> - assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>.replaceAll("\\s+", ""), light.get<%- camelize(property.name) %>()); + assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>.replaceAll("\\s+", ""), light.get<%- camelize(property.name) %>()); <% } else { -%> - assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>, light.get<%- camelize(property.name) %>()); + assertEquals("<%- camelize(property.name) %> should match", <%- defaultValueJava(property) %>, light.get<%- camelize(property.name) %>()); <% } -%> - } }); } <% } -%> @@ -128,8 +116,8 @@ public class LightTest extends BaseActivityTest { fillExtrusionLayer.setMinZoom(15); fillExtrusionLayer.setProperties( fillExtrusionColor(Color.LTGRAY), - fillExtrusionHeight(Function.property("height", new IdentityStops())), - fillExtrusionBase(Function.property("min_height", new IdentityStops())), + fillExtrusionHeight(Expression.get("height")), + fillExtrusionBase(Expression.get("min_height")), fillExtrusionOpacity(0.6f) ); mapboxMap.addLayer(fillExtrusionLayer); @@ -141,4 +129,4 @@ public class LightTest extends BaseActivityTest { protected Class getActivityClass() { return FillExtrusionStyleTestActivity.class; } -} +} \ No newline at end of file -- cgit v1.2.1 From f0110350176e48e4ee2bac7a923287444f85dbea Mon Sep 17 00:00:00 2001 From: Tobrun Date: Mon, 19 Mar 2018 15:11:17 +0100 Subject: Expression filters (#11429) * [android] - add expression filter integration --- .../androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs') diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs index 96f23871c5..a8207a903b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs @@ -27,7 +27,7 @@ import org.junit.runner.RunWith; import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; -import static com.mapbox.mapboxsdk.style.layers.Filter.eq; +import static com.mapbox.mapboxsdk.style.expressions.Expression.eq; import static com.mapbox.mapboxsdk.style.layers.Property.ANCHOR_MAP; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionBase; import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.fillExtrusionColor; -- cgit v1.2.1 From 5d8844152dfa0a8c5d7a6abf02745875aed95e3a Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 4 Apr 2018 12:41:34 +0200 Subject: Rework logical condition convenience expressions (#11555) * [android] - rework expression logical operator api to match actual usage --- .../androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs') diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs index a8207a903b..c35168bb7a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs @@ -112,7 +112,7 @@ public class LightTest extends BaseActivityTest { light = mapboxMap.getLight(); FillExtrusionLayer fillExtrusionLayer = new FillExtrusionLayer("3d-buildings", "composite"); fillExtrusionLayer.setSourceLayer("building"); - fillExtrusionLayer.setFilter(eq("extrude", "true")); + fillExtrusionLayer.setFilter(eq(Expression.get("extrude"), "true")); fillExtrusionLayer.setMinZoom(15); fillExtrusionLayer.setProperties( fillExtrusionColor(Color.LTGRAY), -- cgit v1.2.1