summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt21
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java26
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java13
5 files changed, 26 insertions, 38 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt
index eb458ab8f5..a6238ebf14 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt
@@ -6,8 +6,9 @@ import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource
import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_POOL_LIMIT
import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_PREFIX
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke
-import com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationLandscape
-import com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationPortrait
+import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscape
+import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortrait
+import com.mapbox.mapboxsdk.testapp.action.WaitAction
import com.mapbox.mapboxsdk.testapp.activity.BaseTest
import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity
import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity.ID_GRID_LAYER
@@ -25,11 +26,11 @@ class CustomGeometrySourceTest : BaseTest() {
@Ignore
fun sourceNotLeakingThreadsTest() {
validateTestSetup()
- waitAction(4000)
+ WaitAction.invoke(4000)
onView(isRoot()).perform(orientationLandscape())
- waitAction(2000)
+ WaitAction.invoke(2000)
onView(isRoot()).perform(orientationPortrait())
- waitAction(2000)
+ WaitAction.invoke(2000)
Assert.assertFalse("Threads should be shutdown when the source is destroyed.",
Thread.getAllStackTraces().keys.filter {
it.name.startsWith(THREAD_PREFIX)
@@ -42,9 +43,9 @@ class CustomGeometrySourceTest : BaseTest() {
validateTestSetup()
invoke(mapboxMap) { uiController, mapboxMap ->
mapboxMap.style!!.removeLayer(ID_GRID_LAYER)
- TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView)
+ TestingAsyncUtils.waitForLayer(uiController, mapView)
mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
- TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView)
+ TestingAsyncUtils.waitForLayer(uiController, mapView)
Assert.assertTrue("There should be no threads running when the source is removed.",
Thread.getAllStackTraces().keys.filter {
it.name.startsWith(CustomGeometrySource.THREAD_PREFIX)
@@ -58,12 +59,12 @@ class CustomGeometrySourceTest : BaseTest() {
validateTestSetup()
invoke(mapboxMap) { uiController, mapboxMap ->
mapboxMap.style!!.removeLayer((rule.activity as GridSourceActivity).layer)
- TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView)
+ TestingAsyncUtils.waitForLayer(uiController, mapView)
mapboxMap.style!!.removeSource(ID_GRID_SOURCE)
- TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView)
+ TestingAsyncUtils.waitForLayer(uiController, mapView)
mapboxMap.style!!.addSource((rule.activity as GridSourceActivity).source)
mapboxMap.style!!.addLayer((rule.activity as GridSourceActivity).layer)
- TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView)
+ TestingAsyncUtils.waitForLayer(uiController, mapView)
Assert.assertTrue("Threads should be restarted when the source is re-added to the map.",
Thread.getAllStackTraces().keys.filter {
it.name.startsWith(CustomGeometrySource.THREAD_PREFIX)
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
index 75dcbf1209..ff3b2a9d6d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java
@@ -252,7 +252,7 @@ public class ExpressionTest extends EspressoTest {
)
));
mapboxMap.getStyle().addLayer(layer);
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -262,7 +262,7 @@ public class ExpressionTest extends EspressoTest {
literal(ColorUtils.colorToRgbaString(Color.RED))
)
));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -272,7 +272,7 @@ public class ExpressionTest extends EspressoTest {
literal(ColorUtils.colorToRgbaString(Color.RED))
)
));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
});
@@ -292,7 +292,7 @@ public class ExpressionTest extends EspressoTest {
formatEntry("test")
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -315,7 +315,7 @@ public class ExpressionTest extends EspressoTest {
formatEntry("test", formatFontScale(1.75))
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -341,7 +341,7 @@ public class ExpressionTest extends EspressoTest {
)
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
@@ -371,7 +371,7 @@ public class ExpressionTest extends EspressoTest {
)
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
@@ -402,7 +402,7 @@ public class ExpressionTest extends EspressoTest {
)
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
@@ -436,7 +436,7 @@ public class ExpressionTest extends EspressoTest {
formatEntry("\ntest2", formatFontScale(2), formatTextColor(Color.BLUE))
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(
mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty()
@@ -472,7 +472,7 @@ public class ExpressionTest extends EspressoTest {
)
);
layer.setProperties(textField(expression));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -504,7 +504,7 @@ public class ExpressionTest extends EspressoTest {
formatEntry("\ntest2", formatFontScale(2))
);
layer.setProperties(textField(expression), textColor("rgba(128, 0, 0, 1)"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -524,7 +524,7 @@ public class ExpressionTest extends EspressoTest {
mapboxMap.getStyle().addLayer(layer);
layer.setProperties(textField("test"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
@@ -550,7 +550,7 @@ public class ExpressionTest extends EspressoTest {
new FormattedSection("test", null, null, "rgba(0, 255, 0, 1)")
);
layer.setProperties(textField(formatted), textColor("rgba(128, 0, 0, 1)"));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
.isEmpty());
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
index 92d060fee4..99e0ae4016 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java
@@ -94,7 +94,7 @@ public class GeoJsonSourceTests extends EspressoTest {
}
source.setGeoJson(Point.fromLngLat(20, 55));
- TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView());
+ TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView);
assertEquals(1, mapboxMap.queryRenderedFeatures(
mapboxMap.getProjection().toScreenLocation(
new LatLng(55, 20)), "layer").size());
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java
index 0e4c8f3f2e..1c49801e05 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java
@@ -4,10 +4,8 @@ import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.test.runner.AndroidJUnit4;
-
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction;
-
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
index ed39f36e32..a4a34e752e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java
@@ -2,12 +2,10 @@ package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
import android.graphics.PointF;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
-
import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
@@ -22,20 +20,16 @@ import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.mapboxsdk.style.sources.VectorSource;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.EspressoTest;
-
import junit.framework.Assert;
-
import org.hamcrest.Matcher;
-import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
+import timber.log.Timber;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
-import timber.log.Timber;
-
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
@@ -366,11 +360,6 @@ public class RuntimeStyleTests extends EspressoTest {
}
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
public abstract class BaseViewAction implements ViewAction {
@Override