summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2017-04-21 23:07:19 +0200
committerGitHub <noreply@github.com>2017-04-21 23:07:19 +0200
commiteed7dedf030ed71aac6d004becef42dbec5606bf (patch)
tree4f3b6a327990887f8046e1c1988ebfdb757562a4 /platform
parent43cc8dbdb80fb89ef13dd2fb039a481bc5a9f6ce (diff)
downloadqtlocation-mapboxgl-eed7dedf030ed71aac6d004becef42dbec5606bf.tar.gz
[android] - rework instrumentation tests (#8793)
Diffstat (limited to 'platform')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java174
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java65
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs2
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java33
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java32
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java31
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java55
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java54
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java32
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java54
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java28
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java49
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java29
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java71
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java38
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java32
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java33
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java95
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java41
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java201
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java126
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java45
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java204
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java91
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java54
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java30
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java555
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs63
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/ScreenshotUtil.java137
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java2
-rw-r--r--platform/android/scripts/generate-test-code.js2
-rw-r--r--platform/android/src/map/camera_position.cpp2
34 files changed, 1119 insertions, 1399 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
index 8480028a2f..a813b7f368 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapTest.java
@@ -3,10 +3,8 @@ package com.mapbox.mapboxsdk.maps;
import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions;
@@ -21,23 +19,18 @@ import com.mapbox.mapboxsdk.exceptions.InvalidMarkerPositionException;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import java.util.ArrayList;
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;
@@ -53,26 +46,16 @@ import static org.junit.Assert.assertTrue;
* with the application UI-thread.
* </p>
*/
-public class MapboxMapTest {
-
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
+public class MapboxMapTest extends BaseActivityTest {
- private OnMapReadyIdlingResource idlingResource;
- private EspressoTestActivity activity;
-
- @Before
- public void beforeTest() {
- activity = rule.getActivity();
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- idlingResource = new OnMapReadyIdlingResource(activity);
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
public void testSanity() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
assertNotNull("mapboxMap should not be null", mapboxMap);
}
@@ -82,8 +65,7 @@ public class MapboxMapTest {
@Test
public void testTransitionDuration() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -96,8 +78,7 @@ public class MapboxMapTest {
@Test
public void testTransitionDelay() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -114,7 +95,6 @@ public class MapboxMapTest {
@Test
public void testCameraForLatLngBounds() {
ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -133,8 +113,7 @@ public class MapboxMapTest {
@Test
public void testMinZoom() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -146,8 +125,7 @@ public class MapboxMapTest {
@Test
public void testMaxZoom() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
final double zoom = 10;
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
@@ -161,8 +139,7 @@ public class MapboxMapTest {
@Test
@Ignore
public void testInitialZoomLevels() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -180,8 +157,7 @@ public class MapboxMapTest {
@Test
public void testTrackingSettings() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
assertNotNull("TrackingSettings should not be null", mapboxMap.getTrackingSettings());
}
@@ -191,8 +167,7 @@ public class MapboxMapTest {
@Test
public void testConcurrentInfoWindowEnabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -204,8 +179,7 @@ public class MapboxMapTest {
@Test
public void testConcurrentInfoWindowDisabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -217,8 +191,7 @@ public class MapboxMapTest {
@Test
public void testInfoWindowAdapter() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -242,8 +215,7 @@ public class MapboxMapTest {
@Test
@Ignore /* disabled due to enabling permissions during test #7177 */
public void testMyLocationEnabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -256,8 +228,7 @@ public class MapboxMapTest {
@Test
@Ignore /* can't create handler inside thread that not called Looper.prepare() */
public void testMyLocationDisabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -273,8 +244,7 @@ public class MapboxMapTest {
@Test
public void testFpsListener() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -292,8 +262,7 @@ public class MapboxMapTest {
@Test
public void testInfoWindowClickListener() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -311,8 +280,7 @@ public class MapboxMapTest {
@Test
public void testInfoWindowCloseListener() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -330,8 +298,7 @@ public class MapboxMapTest {
@Test
public void testInfoWindowLongClickListener() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -354,8 +321,7 @@ public class MapboxMapTest {
@Test
public void testAddMarker() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -373,8 +339,7 @@ public class MapboxMapTest {
@Test
public void testAddMarkers() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -393,8 +358,7 @@ public class MapboxMapTest {
@Test
public void testAddMarkersEmpty() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -407,8 +371,7 @@ public class MapboxMapTest {
@Test
public void testAddMarkersSingleMarker() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -424,8 +387,7 @@ public class MapboxMapTest {
@Test
public void testAddPolygon() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -438,8 +400,7 @@ public class MapboxMapTest {
@Test
public void testAddEmptyPolygon() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -452,8 +413,7 @@ public class MapboxMapTest {
@Test
public void testAddPolygons() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -475,8 +435,7 @@ public class MapboxMapTest {
@Test
public void addPolygonsEmpty() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -488,8 +447,7 @@ public class MapboxMapTest {
@Test
public void addPolygonsSingle() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -505,8 +463,7 @@ public class MapboxMapTest {
@Test
public void testAddPolyline() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -519,8 +476,7 @@ public class MapboxMapTest {
@Test
public void testAddEmptyPolyline() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -533,8 +489,7 @@ public class MapboxMapTest {
@Test
public void testAddPolylines() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -556,8 +511,7 @@ public class MapboxMapTest {
@Test
public void testAddPolylinesEmpty() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -569,8 +523,7 @@ public class MapboxMapTest {
@Test
public void testAddPolylinesSingle() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -586,8 +539,7 @@ public class MapboxMapTest {
@Test
public void testRemoveMarker() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -601,8 +553,7 @@ public class MapboxMapTest {
@Test
public void testRemovePolygon() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -616,8 +567,7 @@ public class MapboxMapTest {
@Test
public void testRemovePolyline() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -631,8 +581,7 @@ public class MapboxMapTest {
@Test
public void testRemoveAnnotation() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -646,8 +595,7 @@ public class MapboxMapTest {
@Test
public void testRemoveAnnotationById() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -662,8 +610,7 @@ public class MapboxMapTest {
@Test
public void testRemoveAnnotations() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -681,8 +628,7 @@ public class MapboxMapTest {
@Test
public void testClear() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -700,8 +646,7 @@ public class MapboxMapTest {
@Test
public void testRemoveAnnotationsByList() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -721,8 +666,7 @@ public class MapboxMapTest {
@Test
public void testGetAnnotationById() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -736,8 +680,7 @@ public class MapboxMapTest {
@Test
public void testGetAnnotations() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -748,8 +691,7 @@ public class MapboxMapTest {
@Test
public void testGetMarkers() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -760,8 +702,7 @@ public class MapboxMapTest {
@Test
public void testGetPolygons() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -772,8 +713,7 @@ public class MapboxMapTest {
@Test
public void testGetPolylines() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -784,8 +724,7 @@ public class MapboxMapTest {
@Test
public void testGetSelectedMarkers() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -796,8 +735,7 @@ public class MapboxMapTest {
@Test
public void testSelectMarker() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -811,8 +749,7 @@ public class MapboxMapTest {
@Test
public void testDeselectMarker() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -827,8 +764,7 @@ public class MapboxMapTest {
@Test
public void testDeselectMarkers() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
@Override
public void onViewAction(UiController uiController, View view) {
@@ -843,12 +779,6 @@ public class MapboxMapTest {
}));
}
- @After
- public void afterTest() {
- Timber.e("@After test: unregister idle resource");
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class MapboxMapAction implements ViewAction {
private InvokeViewAction invokeViewAction;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
index 2f51140cd1..c029bc09c4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseActivityTest.java
@@ -1,21 +1,29 @@
package com.mapbox.mapboxsdk.testapp.activity;
import android.app.Activity;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.IdlingResourceTimeoutException;
+import android.support.test.espresso.UiController;
+import android.support.test.espresso.ViewAction;
import android.support.test.rule.ActivityTestRule;
-
-import timber.log.Timber;
+import android.view.View;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ScreenshotUtil;
+import junit.framework.Assert;
+
+import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
+import timber.log.Timber;
+
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
@@ -46,6 +54,16 @@ public abstract class BaseActivityTest {
}
}
+ protected void validateTestSetup() {
+ Assert.assertTrue("Device is not connected to the Internet.", isConnected(rule.getActivity()));
+ checkViewIsDisplayed(R.id.mapView);
+ Assert.assertNotNull(mapboxMap);
+ }
+
+ protected MapboxMap getMapboxMap() {
+ return mapboxMap;
+ }
+
protected abstract Class getActivityClass();
protected void checkViewIsDisplayed(int id) {
@@ -53,14 +71,15 @@ public abstract class BaseActivityTest {
.check(matches(isDisplayed()));
}
- protected void takeScreenshot(final String name) {
- final Activity activity = rule.getActivity();
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ScreenshotUtil.take(activity, name);
- }
- });
+ protected void waitLoop() {
+ onView(withId(R.id.mapView)).perform(new LoopAction(500));
+ }
+
+ static boolean isConnected(Context context) {
+ ConnectivityManager connectivityManager
+ = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
+ return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
@After
@@ -68,5 +87,29 @@ public abstract class BaseActivityTest {
Timber.e("@After test: unregister idle resource");
Espresso.unregisterIdlingResources(idlingResource);
}
+
+ private class LoopAction implements ViewAction {
+
+ private long loopTime;
+
+ public LoopAction(long loopTime) {
+ this.loopTime = loopTime;
+ }
+
+ @Override
+ public Matcher<View> getConstraints() {
+ return isDisplayed();
+ }
+
+ @Override
+ public String getDescription() {
+ return getClass().getSimpleName();
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadForAtLeast(loopTime);
+ }
+ }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs
index 3e3ef36c39..03d4de17f4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs
@@ -27,7 +27,7 @@ public class <%- activity %>Test extends BaseActivityTest {
@Test
public void testSanity() {
- onView(withId(R.id.mapView)).check(matches(isDisplayed()));
+ validateTestSetup();
}
@Override
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
index 77025c8fa5..2f638ff651 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerTest.java
@@ -1,9 +1,7 @@
package com.mapbox.mapboxsdk.testapp.annotations;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.annotations.Marker;
@@ -11,16 +9,12 @@ import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -30,25 +24,19 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.junit.Assert.assertEquals;
-public class MarkerTest {
+public class MarkerTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
private Marker marker;
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void addMarkerTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
MarkerOptions options = new MarkerOptions();
@@ -69,8 +57,7 @@ public class MarkerTest {
@Test
@Ignore
public void showInfoWindowTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final MarkerOptions options = new MarkerOptions();
options.setPosition(new LatLng());
@@ -133,10 +120,4 @@ public class MarkerTest {
}
}
-
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
index 9351ed1c10..bee20c3150 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/MarkerViewTest.java
@@ -1,27 +1,21 @@
package com.mapbox.mapboxsdk.testapp.annotations;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.annotation.MarkerViewActivity;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
import com.mapbox.mapboxsdk.testapp.model.annotations.TextMarkerViewOptions;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,25 +25,19 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.junit.Assert.assertEquals;
-public class MarkerViewTest {
+public class MarkerViewTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
private Marker marker;
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void addMarkerViewTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
assertEquals("Markers should be empty", 0, mapboxMap.getMarkers().size());
TextMarkerViewOptions options = new TextMarkerViewOptions();
@@ -70,8 +58,7 @@ public class MarkerViewTest {
@Test
@Ignore
public void showInfoWindowTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final TextMarkerViewOptions options = new TextMarkerViewOptions();
options.position(new LatLng());
@@ -139,9 +126,4 @@ public class MarkerViewTest {
uiController.loopMainThreadForAtLeast(250);
}
}
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
index 24b9b3bf01..325568bec4 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolygonTest.java
@@ -1,10 +1,8 @@
package com.mapbox.mapboxsdk.testapp.annotations;
import android.graphics.Color;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.annotations.Polygon;
@@ -12,15 +10,11 @@ import com.mapbox.mapboxsdk.annotations.PolygonOptions;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -28,26 +22,20 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals;
-public class PolygonTest {
+public class PolygonTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
- private OnMapReadyIdlingResource idlingResource;
private Polygon polygon;
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- }
-
@Test
@Ignore
/** native crash **/
public void addPolygonTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
LatLng latLngOne = new LatLng();
LatLng latLngTwo = new LatLng(1, 0);
LatLng latLngThree = new LatLng(1, 1);
@@ -97,9 +85,4 @@ public class PolygonTest {
polygon = mapboxMap.addPolygon(options);
}
}
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
index 607a4ad263..91553f7042 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/PolylineTest.java
@@ -1,10 +1,8 @@
package com.mapbox.mapboxsdk.testapp.annotations;
import android.graphics.Color;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.annotations.Polyline;
@@ -12,15 +10,11 @@ import com.mapbox.mapboxsdk.annotations.PolylineOptions;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -28,25 +22,19 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals;
-public class PolylineTest {
+public class PolylineTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
private Polyline polyline;
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Ignore
@Test
public void addPolylineTest() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
LatLng latLngOne = new LatLng();
LatLng latLngTwo = new LatLng(1, 0);
@@ -92,9 +80,4 @@ public class PolylineTest {
polyline = mapboxMap.addPolyline(options);
}
}
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
index d4b0dbad72..af1a146ca2 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java
@@ -1,10 +1,8 @@
package com.mapbox.mapboxsdk.testapp.camera;
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.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -14,16 +12,12 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,24 +25,17 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals;
-public class CameraAnimateTest {
+public class CameraAnimateTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void testAnimateToCameraPositionTarget() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO remove zoom #6474*/
float zoom = 1.0f;
@@ -70,8 +57,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToCameraPositionTargetZoom() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final float moveZoom = 15.5f;
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
@@ -87,9 +73,9 @@ public class CameraAnimateTest {
}
@Test
+ @Ignore
public void testAnimateToCameraPosition() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
final float moveZoom = 15.5f;
@@ -119,8 +105,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToBounds() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng centerBounds = new LatLng(1, 1);
LatLng cornerOne = new LatLng();
@@ -148,8 +133,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToMoveBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
final LatLng moveTarget = new LatLng(2, 2);
@@ -168,8 +152,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToZoomIn() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -183,8 +166,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToZoomOut() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 10.0f;
@@ -199,8 +181,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToZoomBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -215,8 +196,7 @@ public class CameraAnimateTest {
@Test
@Ignore
public void testAnimateToZoomTo() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
final float zoomTo = 2.45f;
@@ -227,11 +207,6 @@ public class CameraAnimateTest {
TestConstants.ZOOM_DELTA);
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class AnimateCameraAction implements ViewAction {
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
index 83e7d6084c..4fae894039 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java
@@ -1,10 +1,8 @@
package com.mapbox.mapboxsdk.testapp.camera;
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.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -14,16 +12,12 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,24 +25,17 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals;
-public class CameraEaseTest {
+public class CameraEaseTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void testEaseToCameraPositionTarget() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO remove zoom #6474*/
float zoom = 1.0f;
@@ -70,8 +57,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToCameraPositionTargetZoom() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final float moveZoom = 15.5f;
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
@@ -89,8 +75,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToCameraPosition() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
final float moveZoom = 15.5f;
@@ -120,8 +105,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToBounds() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng centerBounds = new LatLng(1, 1);
LatLng cornerOne = new LatLng();
@@ -149,8 +133,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToMoveBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
final LatLng moveTarget = new LatLng(2, 2);
@@ -169,8 +152,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToZoomIn() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -184,8 +166,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToZoomOut() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 10.0f;
@@ -199,8 +180,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToZoomBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -215,8 +195,7 @@ public class CameraEaseTest {
@Test
@Ignore
public void testEaseToZoomTo() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
final float zoomTo = 2.45f;
@@ -227,11 +206,6 @@ public class CameraEaseTest {
TestConstants.ZOOM_DELTA);
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class EaseCameraAction implements ViewAction {
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java
index 2d01347d22..883e76653d 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraInternalApiTest.java
@@ -3,7 +3,6 @@ package com.mapbox.mapboxsdk.testapp.camera;
import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -11,16 +10,13 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapViewUtils;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,25 +27,17 @@ import static org.junit.Assert.assertEquals;
/**
* Tests camera transformations that aren't part of our public API
*/
-public class CameraInternalApiTest {
+public class CameraInternalApiTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void testBearing() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- EspressoTestActivity activity = rule.getActivity();
- MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
CameraPosition initialPosition = new
CameraPosition.Builder().target(new LatLng()).zoom(1).bearing(0).tilt(0).build();
@@ -63,9 +51,7 @@ public class CameraInternalApiTest {
@Test
@Ignore
public void testTilt() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- EspressoTestActivity activity = rule.getActivity();
- MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
CameraPosition initialPosition = new CameraPosition.Builder().target(
new LatLng()).zoom(1).bearing(0).tilt(0).build();
@@ -79,9 +65,7 @@ public class CameraInternalApiTest {
@Test
@Ignore
public void testLatLng() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- EspressoTestActivity activity = rule.getActivity();
- MapboxMap mapboxMap = activity.getMapboxMap();
+ validateTestSetup();
CameraPosition initialPosition = new CameraPosition.Builder().target(
new LatLng()).zoom(1).bearing(0).tilt(0).build();
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
index becf9db7cb..ea8398fc8e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java
@@ -1,10 +1,8 @@
package com.mapbox.mapboxsdk.testapp.camera;
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.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -14,16 +12,12 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,24 +25,17 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.junit.Assert.assertEquals;
-public class CameraMoveTest {
+public class CameraMoveTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore
public void testMoveToCameraPositionTarget() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO remove zoom #6474*/
float zoom = 1.0f;
@@ -70,8 +57,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToCameraPositionTargetZoom() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final float moveZoom = 15.5f;
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
@@ -89,8 +75,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToCameraPosition() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng moveTarget = new LatLng(1.0000000001, 1.0000000003);
final float moveZoom = 15.5f;
@@ -120,8 +105,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToBounds() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final LatLng centerBounds = new LatLng(1, 1);
LatLng cornerOne = new LatLng();
@@ -149,8 +133,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToMoveBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target);
final LatLng moveTarget = new LatLng(2, 2);
@@ -169,8 +152,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToZoomIn() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -184,8 +166,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToZoomOut() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 10.0f;
@@ -200,8 +181,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToZoomBy() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
float zoom = 1.0f;
@@ -216,8 +196,7 @@ public class CameraMoveTest {
@Test
@Ignore
public void testMoveToZoomTo() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- final MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
/*TODO fix zoom #6474*/
final float zoomTo = 2.45f;
@@ -228,11 +207,6 @@ public class CameraMoveTest {
TestConstants.ZOOM_DELTA);
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class MoveCameraAction implements ViewAction {
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java
index f49296a164..5ef93c72b3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesBoxCountTest.java
@@ -1,16 +1,10 @@
package com.mapbox.mapboxsdk.testapp.feature;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxCountActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -27,18 +21,11 @@ import static org.hamcrest.Matchers.not;
* Instrumentation test to validate if clicking on the blue rectangle from
* QueryRenderedFeaturesBoxSymbolCountActivity shows a Toast that 149 features were found.
*/
-public class QueryRenderedFeaturesBoxCountTest {
-
- @Rule
- public final ActivityTestRule<QueryRenderedFeaturesBoxCountActivity> rule =
- new ActivityTestRule<>(QueryRenderedFeaturesBoxCountActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
+public class QueryRenderedFeaturesBoxCountTest extends BaseActivityTest {
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return QueryRenderedFeaturesBoxCountActivity.class;
}
@Test
@@ -53,9 +40,4 @@ public class QueryRenderedFeaturesBoxCountTest {
.check(matches(isDisplayed()));
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java
index 0333aba191..307700e847 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesHighlightTest.java
@@ -1,22 +1,10 @@
package com.mapbox.mapboxsdk.testapp.feature;
-import android.support.test.espresso.Espresso;
-import android.support.test.espresso.ViewAction;
-import android.support.test.espresso.action.CoordinatesProvider;
-import android.support.test.espresso.action.GeneralClickAction;
-import android.support.test.espresso.action.Press;
-import android.support.test.espresso.action.Tap;
-import android.support.test.rule.ActivityTestRule;
-import android.view.View;
-
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxHighlightActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -32,18 +20,11 @@ import static org.hamcrest.Matchers.not;
/**
* Instrumentation test to validate if clicking box on screen highlights features.
*/
-public class QueryRenderedFeaturesHighlightTest {
-
- @Rule
- public final ActivityTestRule<QueryRenderedFeaturesBoxHighlightActivity> rule =
- new ActivityTestRule<>(QueryRenderedFeaturesBoxHighlightActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
+public class QueryRenderedFeaturesHighlightTest extends BaseActivityTest {
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return QueryRenderedFeaturesBoxHighlightActivity.class;
}
@Test
@@ -58,24 +39,4 @@ public class QueryRenderedFeaturesHighlightTest {
.check(matches(isDisplayed()));
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
- private static ViewAction clickXY(final float x, final float y) {
- return new GeneralClickAction(
- Tap.SINGLE,
- new CoordinatesProvider() {
- @Override
- public float[] calculateCoordinates(View view) {
- final int[] screenPos = new int[2];
- view.getLocationOnScreen(screenPos);
- final float screenX = screenPos[0] + x;
- final float screenY = screenPos[1] + y;
- return new float[] {screenX, screenY};
- }
- },
- Press.FINGER);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java
index 01eb9c8b44..8e6987b712 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedFeaturesPropertiesTest.java
@@ -1,25 +1,19 @@
package com.mapbox.mapboxsdk.testapp.feature;
import android.graphics.PointF;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.action.CoordinatesProvider;
import android.support.test.espresso.action.GeneralClickAction;
import android.support.test.espresso.action.Press;
import android.support.test.espresso.action.Tap;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.geometry.LatLng;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesPropertiesActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -31,35 +25,22 @@ import static android.support.test.espresso.matcher.ViewMatchers.withText;
/**
* Instrumentation test to validate if clicking center of screen returns the correct features.
*/
-public class QueryRenderedFeaturesPropertiesTest {
+public class QueryRenderedFeaturesPropertiesTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<QueryRenderedFeaturesPropertiesActivity> rule =
- new ActivityTestRule<>(QueryRenderedFeaturesPropertiesActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return QueryRenderedFeaturesPropertiesActivity.class;
}
@Test
@Ignore
public void testCountFeatures() {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
LatLng centerScreen = mapboxMap.getCameraPosition().target;
PointF centerPixel = mapboxMap.getProjection().toScreenLocation(centerScreen);
onView(withId(R.id.mapView)).perform(clickXY(centerPixel.x, centerPixel.y));
onView(withText("Found 4 features")).check(matches(isDisplayed()));
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private static ViewAction clickXY(final float x, final float y) {
return new GeneralClickAction(
Tap.SINGLE,
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java
index ea80e8689a..a31c3db89e 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/feature/QueryRenderedSymbolBoxCountTest.java
@@ -1,16 +1,10 @@
package com.mapbox.mapboxsdk.testapp.feature;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
-
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.feature.QueryRenderedFeaturesBoxSymbolCountActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -27,18 +21,11 @@ import static org.hamcrest.Matchers.not;
* Instrumentation test to validate if clicking on the blue rectangle from
* QueryRenderedFeaturesBoxSymbolCountActivity shows a Toast that 2 symbols were found.
*/
-public class QueryRenderedSymbolBoxCountTest {
-
- @Rule
- public final ActivityTestRule<QueryRenderedFeaturesBoxSymbolCountActivity> rule =
- new ActivityTestRule<>(QueryRenderedFeaturesBoxSymbolCountActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
+public class QueryRenderedSymbolBoxCountTest extends BaseActivityTest {
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return QueryRenderedFeaturesBoxSymbolCountActivity.class;
}
@Test
@@ -52,11 +39,5 @@ public class QueryRenderedSymbolBoxCountTest {
.inRoot(withDecorView(not(is(rule.getActivity().getWindow().getDecorView()))))
.check(matches(isDisplayed()));
}
-
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
index 1c225204e5..d37c6db2d5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java
@@ -3,11 +3,9 @@ package com.mapbox.mapboxsdk.testapp.maps.widgets;
import android.app.Instrumentation;
import android.content.Intent;
import android.net.Uri;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.support.test.espresso.intent.Intents;
-import android.support.test.rule.ActivityTestRule;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
@@ -17,14 +15,12 @@ import android.view.View;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
import org.junit.After;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onData;
@@ -42,39 +38,25 @@ import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.anything;
import static org.hamcrest.core.IsNot.not;
-public class AttributionTest {
+public class AttributionTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
private URLSpan[] urlSpans;
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+
@Before
public void beforeTest() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ super.beforeTest();
Intents.init();
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- mapboxMap = rule.getActivity().getMapboxMap();
- onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
- @Override
- public void onViewAction(UiController uiController, View view) {
- for (Source source : mapboxMap.getSources()) {
- String attributionSource = source.getAttribution();
- if (!TextUtils.isEmpty(attributionSource)) {
- SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource);
- urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class);
- }
- }
- }
- }));
}
@Test
public void testDisabled() {
+ validateTestSetup();
+
// Default
onView(withId(R.id.attributionView)).check(matches(isDisplayed()));
@@ -86,9 +68,9 @@ public class AttributionTest {
@Test
public void testMapboxStreetsMapboxAttributionLink() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
if (urlSpans == null) {
- return;
+ buildUrlSpans();
}
// click on View to open dialog
@@ -106,10 +88,11 @@ public class AttributionTest {
@Test
public void testMapboxStreetsOpenStreetMapAttributionLink() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
if (urlSpans == null) {
- return;
+ buildUrlSpans();
}
+
// click on View to open dialog
onView(withId(R.id.attributionView)).perform(click());
onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
@@ -125,10 +108,11 @@ public class AttributionTest {
@Test
public void testImproveMapLink() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
if (urlSpans == null) {
- return;
+ buildUrlSpans();
}
+
// click on View to open dialog
onView(withId(R.id.attributionView)).perform(click());
onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed()));
@@ -144,7 +128,7 @@ public class AttributionTest {
@Test
public void testTelemetryDialog() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
// click on View to open dialog
onView(withId(R.id.attributionView)).perform(click());
@@ -157,8 +141,23 @@ public class AttributionTest {
@After
public void afterTest() {
+ super.afterTest();
Intents.release();
- Espresso.unregisterIdlingResources(idlingResource);
+ }
+
+ private void buildUrlSpans() {
+ onView(withId(R.id.mapView)).perform(new MapboxMapAction(new InvokeViewAction() {
+ @Override
+ public void onViewAction(UiController uiController, View view) {
+ for (Source source : mapboxMap.getSources()) {
+ String attributionSource = source.getAttribution();
+ if (!TextUtils.isEmpty(attributionSource)) {
+ SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource);
+ urlSpans = htmlBuilder.getSpans(0, htmlBuilder.length(), URLSpan.class);
+ }
+ }
+ }
+ }));
}
private class DisableAction implements ViewAction {
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
index 02fec41f65..f15605042b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java
@@ -1,9 +1,7 @@
package com.mapbox.mapboxsdk.testapp.maps.widgets;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -12,16 +10,12 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -32,29 +26,22 @@ import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
-public class CompassViewTest {
+public class CompassViewTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
public void testDefault() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
}
@Test
public void testVisible() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
CameraUpdateFactory.newCameraPosition(
@@ -66,15 +53,14 @@ public class CompassViewTest {
)
)
);
-
+ waitLoop();
onView(withId(R.id.compassView)).check(matches(isDisplayed()));
}
@Test
@Ignore // 10-31-2016 click action is not working
public void testClick() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new MoveCameraAction(mapboxMap,
CameraUpdateFactory.newCameraPosition(
@@ -87,6 +73,7 @@ public class CompassViewTest {
)
);
+ waitLoop();
onView(withId(R.id.compassView)).perform(click());
onView(withId(R.id.mapView)).perform(new WaitAction(3000));
onView(withId(R.id.compassView)).check(matches(not(isDisplayed())));
@@ -95,11 +82,6 @@ public class CompassViewTest {
assertEquals("Camera bearing should face north, ", 0, cameraPosition.bearing, TestConstants.BEARING_DELTA);
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class WaitAction implements ViewAction {
private long waitTime;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
index f12b2bf160..0c189aa316 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/LogoTest.java
@@ -1,21 +1,15 @@
package com.mapbox.mapboxsdk.testapp.maps.widgets;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -24,40 +18,28 @@ import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static org.hamcrest.Matchers.not;
-public class LogoTest {
+public class LogoTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
public void testDefault() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.logoView)).check(matches(isDisplayed()));
}
@Test
public void testDisabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.logoView))
.perform(new DisableAction(mapboxMap))
.check(matches(not(isDisplayed())));
}
- @After
- public void unregisterIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class DisableAction implements ViewAction {
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java
index c8a983351b..efd67db356 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/MyLocationViewTest.java
@@ -5,10 +5,8 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.view.View;
import com.mapbox.mapboxsdk.camera.CameraPosition;
@@ -20,17 +18,13 @@ import com.mapbox.mapboxsdk.location.LocationSource;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.maps.widgets.MyLocationView;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
-import org.junit.Rule;
import org.junit.Test;
import static android.support.test.espresso.Espresso.onView;
@@ -49,24 +43,17 @@ import static org.hamcrest.Matchers.not;
* {@link com.mapbox.mapboxsdk.maps.TrackingSettings#setMyBearingTrackingMode(int)}.
* </p>
*/
-public class MyLocationViewTest {
+public class MyLocationViewTest extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void beforeTest() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
}
@Test
@Ignore // requires runtime permissions, disabled for CI
public void testEnabled() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.userLocationView)).check(matches(not(isDisplayed())));
onView(withId(R.id.mapView)).perform(new ToggleLocationAction(mapboxMap, true));
onView(withId(R.id.userLocationView)).check(matches(isDisplayed()));
@@ -79,8 +66,7 @@ public class MyLocationViewTest {
// requires runtime permissions, disabled for CI + issue with android.support.test.espresso.AppNotIdleException:
// Looped for 5049 iterations over 60 SECONDS.
public void testTracking() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
onView(withId(R.id.userLocationView)).check(matches(not(isDisplayed())));
onView(withId(R.id.mapView)).perform(new EnableLocationTrackingAction(mapboxMap));
onView(withId(R.id.userLocationView)).check(matches(isDisplayed()));
@@ -91,11 +77,6 @@ public class MyLocationViewTest {
R.drawable.mapbox_mylocation_icon_bearing, true)));
}
- @After
- public void afterTest() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
-
private class ToggleLocationAction implements ViewAction {
private MapboxMap mapboxMap;
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
index ef73dc7850..5bab1de904 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
@@ -3,69 +3,56 @@
package com.mapbox.mapboxsdk.testapp.style;
import android.graphics.Color;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
-import timber.log.Timber;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
-import com.mapbox.mapboxsdk.style.functions.CompositeFunction;
import com.mapbox.mapboxsdk.style.functions.CameraFunction;
-import com.mapbox.mapboxsdk.style.functions.SourceFunction;
-import com.mapbox.mapboxsdk.style.functions.stops.CategoricalStops;
import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
-import com.mapbox.mapboxsdk.style.functions.stops.IdentityStops;
import com.mapbox.mapboxsdk.style.functions.stops.IntervalStops;
-import com.mapbox.mapboxsdk.style.functions.stops.Stop;
-import com.mapbox.mapboxsdk.style.functions.stops.Stops;
import com.mapbox.mapboxsdk.style.layers.BackgroundLayer;
-import com.mapbox.mapboxsdk.testapp.R;
-import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import static com.mapbox.mapboxsdk.style.functions.Function.*;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stop.stop;
-import static com.mapbox.mapboxsdk.style.functions.stops.Stops.*;
-import static org.junit.Assert.*;
-import static com.mapbox.mapboxsdk.style.layers.Property.*;
-import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
+import timber.log.Timber;
-import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+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.exponential;
+import static com.mapbox.mapboxsdk.style.functions.stops.Stops.interval;
+import static com.mapbox.mapboxsdk.style.layers.Property.NONE;
+import static com.mapbox.mapboxsdk.style.layers.Property.VISIBLE;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundColor;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundOpacity;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.backgroundPattern;
+import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.visibility;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
/**
* Basic smoke tests for BackgroundLayer
*/
@RunWith(AndroidJUnit4.class)
-public class BackgroundLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class BackgroundLayerTest extends BaseActivityTest {
private BackgroundLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer() {
Timber.i("Retrieving layer");
layer = mapboxMap.getLayerAs("background");
}
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -79,7 +66,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-colorTransitionOptions");
assertNotNull(layer);
@@ -91,7 +79,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-color");
assertNotNull(layer);
@@ -102,7 +91,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-color");
assertNotNull(layer);
@@ -128,7 +118,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-color");
assertNotNull(layer);
@@ -139,7 +130,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundPatternTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-patternTransitionOptions");
assertNotNull(layer);
@@ -151,7 +143,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundPatternAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-pattern");
assertNotNull(layer);
@@ -162,7 +155,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundPatternAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-pattern");
assertNotNull(layer);
@@ -187,7 +181,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-opacityTransitionOptions");
assertNotNull(layer);
@@ -199,7 +194,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-opacity");
assertNotNull(layer);
@@ -210,7 +206,8 @@ public class BackgroundLayerTest extends BaseStyleTest {
@Test
public void testBackgroundOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("background-opacity");
assertNotNull(layer);
@@ -234,8 +231,4 @@ public class BackgroundLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java
index 620e15579f..3d56752150 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BaseStyleTest.java
@@ -1,44 +1,15 @@
package com.mapbox.mapboxsdk.testapp.style;
-import android.app.Activity;
-
-import com.mapbox.mapboxsdk.testapp.utils.ScreenshotUtil;
-
-import static android.support.test.espresso.Espresso.onView;
-import static android.support.test.espresso.assertion.ViewAssertions.matches;
-import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
-import static android.support.test.espresso.matcher.ViewMatchers.withId;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
+import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
/**
* Base Test class for Style tests
*/
-public class BaseStyleTest {
-
- protected static final String HOME_BUTTON_STRING = "Navigate up";
-
- /*
- * Shortcuts for common UI tests
- */
-
- protected void checkViewIsDisplayed(int id) {
- onView(withId(id))
- .check(matches(isDisplayed()));
- }
-
- /*
- * Screenshots logic
- */
-
- protected void takeNamedScreenshot(final Activity activity, final String name) {
-
- // Screenshots need to be taken on the UI thread
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- ScreenshotUtil.take(activity, name);
- }
- });
+public class BaseStyleTest extends BaseActivityTest {
+ @Override
+ protected Class getActivityClass() {
+ return RuntimeStyleTestActivity.class;
}
-
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
index 11843ce28f..bf31a935f8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
@@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -37,28 +38,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for CircleLayer
*/
@RunWith(AndroidJUnit4.class)
-public class CircleLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class CircleLayerTest extends BaseActivityTest {
private CircleLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
Timber.i("Adding layer");
layer = new CircleLayer("my-layer", "composite");
@@ -71,7 +66,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -85,8 +81,9 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testSourceLayer() {
- checkViewIsDisplayed(R.id.mapView);
- Timber.i("Visibility");
+ validateTestSetup();
+ setupLayer();
+ Timber.i("SourceLayer");
assertNotNull(layer);
// Get initial
@@ -100,7 +97,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radiusTransitionOptions");
assertNotNull(layer);
@@ -112,7 +110,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -123,7 +122,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -149,7 +149,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -168,7 +169,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -194,7 +196,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -223,7 +226,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleRadiusAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-radius");
assertNotNull(layer);
@@ -257,7 +261,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-colorTransitionOptions");
assertNotNull(layer);
@@ -269,7 +274,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -280,7 +286,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -306,7 +313,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -325,7 +333,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -351,7 +360,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -380,7 +390,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-color");
assertNotNull(layer);
@@ -391,7 +402,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blurTransitionOptions");
assertNotNull(layer);
@@ -403,7 +415,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -414,7 +427,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -440,7 +454,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -459,7 +474,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -485,7 +501,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -514,7 +531,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleBlurAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-blur");
assertNotNull(layer);
@@ -548,7 +566,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacityTransitionOptions");
assertNotNull(layer);
@@ -560,7 +579,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -571,7 +591,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -597,7 +618,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -616,7 +638,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -642,7 +665,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -671,7 +695,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-opacity");
assertNotNull(layer);
@@ -705,7 +730,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleTranslateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-translateTransitionOptions");
assertNotNull(layer);
@@ -717,7 +743,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleTranslateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-translate");
assertNotNull(layer);
@@ -728,7 +755,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleTranslateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-translate");
assertNotNull(layer);
@@ -754,7 +782,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleTranslateAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-translate-anchor");
assertNotNull(layer);
@@ -765,7 +794,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleTranslateAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-translate-anchor");
assertNotNull(layer);
@@ -790,7 +820,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCirclePitchScaleAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-pitch-scale");
assertNotNull(layer);
@@ -801,7 +832,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCirclePitchScaleAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-pitch-scale");
assertNotNull(layer);
@@ -826,7 +858,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-widthTransitionOptions");
assertNotNull(layer);
@@ -838,7 +871,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -849,7 +883,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -875,7 +910,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -894,7 +930,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -920,7 +957,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -949,7 +987,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeWidthAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-width");
assertNotNull(layer);
@@ -983,7 +1022,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-colorTransitionOptions");
assertNotNull(layer);
@@ -995,7 +1035,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1006,7 +1047,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1032,7 +1074,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1051,7 +1094,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1077,7 +1121,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1106,7 +1151,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-color");
assertNotNull(layer);
@@ -1117,7 +1163,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacityTransitionOptions");
assertNotNull(layer);
@@ -1129,7 +1176,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1140,7 +1188,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1166,7 +1215,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1185,7 +1235,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1211,7 +1262,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1240,7 +1292,8 @@ public class CircleLayerTest extends BaseStyleTest {
@Test
public void testCircleStrokeOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("circle-stroke-opacity");
assertNotNull(layer);
@@ -1272,8 +1325,4 @@ public class CircleLayerTest extends BaseStyleTest {
assertEquals(0.9f, stop.out, 0.001f);
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
index edbfcb1106..b6b6578839 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
@@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.style.layers.FillLayer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -37,28 +38,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for FillLayer
*/
@RunWith(AndroidJUnit4.class)
-public class FillLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class FillLayerTest extends BaseActivityTest {
private FillLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
Timber.i("Adding layer");
layer = new FillLayer("my-layer", "composite");
@@ -71,7 +66,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -85,8 +81,9 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testSourceLayer() {
- checkViewIsDisplayed(R.id.mapView);
- Timber.i("Visibility");
+ validateTestSetup();
+ setupLayer();
+ Timber.i("SourceLayer");
assertNotNull(layer);
// Get initial
@@ -100,7 +97,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillAntialiasAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-antialias");
assertNotNull(layer);
@@ -111,7 +109,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillAntialiasAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-antialias");
assertNotNull(layer);
@@ -136,7 +135,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacityTransitionOptions");
assertNotNull(layer);
@@ -148,7 +148,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -159,7 +160,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -185,7 +187,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -204,7 +207,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -230,7 +234,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -259,7 +264,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-opacity");
assertNotNull(layer);
@@ -293,7 +299,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-colorTransitionOptions");
assertNotNull(layer);
@@ -305,7 +312,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -316,7 +324,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -342,7 +351,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -361,7 +371,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -387,7 +398,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -416,7 +428,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-color");
assertNotNull(layer);
@@ -427,7 +440,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-colorTransitionOptions");
assertNotNull(layer);
@@ -439,7 +453,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -450,7 +465,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -476,7 +492,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -495,7 +512,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -521,7 +539,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -550,7 +569,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillOutlineColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-outline-color");
assertNotNull(layer);
@@ -561,7 +581,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillTranslateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-translateTransitionOptions");
assertNotNull(layer);
@@ -573,7 +594,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillTranslateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-translate");
assertNotNull(layer);
@@ -584,7 +606,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillTranslateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-translate");
assertNotNull(layer);
@@ -610,7 +633,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillTranslateAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-translate-anchor");
assertNotNull(layer);
@@ -621,7 +645,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillTranslateAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-translate-anchor");
assertNotNull(layer);
@@ -646,7 +671,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillPatternTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-patternTransitionOptions");
assertNotNull(layer);
@@ -658,7 +684,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillPatternAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-pattern");
assertNotNull(layer);
@@ -669,7 +696,8 @@ public class FillLayerTest extends BaseStyleTest {
@Test
public void testFillPatternAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("fill-pattern");
assertNotNull(layer);
@@ -692,8 +720,4 @@ public class FillLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size());
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
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 a8d1ee5911..be2fc9ab9c 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
@@ -2,29 +2,22 @@ package com.mapbox.mapboxsdk.testapp.style;
import android.content.res.Resources;
import android.support.annotation.RawRes;
-import android.support.test.espresso.Espresso;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
-import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import com.mapbox.services.commons.geojson.Feature;
import com.mapbox.services.commons.geojson.FeatureCollection;
import com.mapbox.services.commons.geojson.Point;
import org.hamcrest.Matcher;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -45,34 +38,20 @@ import static org.junit.Assert.fail;
* Tests for {@link GeoJsonSource}
*/
@RunWith(AndroidJUnit4.class)
-public class GeoJsonSourceTests {
+public class GeoJsonSourceTests extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule =
- new ActivityTestRule<>(RuntimeStyleTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- }
-
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return RuntimeStyleTestActivity.class;
}
@Test
public void testFeatureCollection() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
GeoJsonSource source = new GeoJsonSource("source", FeatureCollection
.fromJson(readRawResource(rule.getActivity().getResources(), R.raw.test_feature_collection)));
mapboxMap.addSource(source);
@@ -85,13 +64,11 @@ public class GeoJsonSourceTests {
@Test
public void testPointGeometry() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
GeoJsonSource source = new GeoJsonSource("source", Point.fromCoordinates(new double[] {0d, 0d}));
mapboxMap.addSource(source);
@@ -103,13 +80,11 @@ public class GeoJsonSourceTests {
@Test
public void testFeatureProperties() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
GeoJsonSource source = new GeoJsonSource("source",
readRawResource(rule.getActivity().getResources(), R.raw.test_feature_properties));
mapboxMap.addSource(source);
@@ -156,13 +131,11 @@ public class GeoJsonSourceTests {
}
protected void testFeatureFromResource(final @RawRes int resource) {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
GeoJsonSource source = new GeoJsonSource("source");
mapboxMap.addSource(source);
Layer layer = new CircleLayer("layer", source.getId());
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
index 7263b5de73..1c23dd366b 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
@@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.style.layers.LineLayer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -37,28 +38,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for LineLayer
*/
@RunWith(AndroidJUnit4.class)
-public class LineLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class LineLayerTest extends BaseActivityTest {
private LineLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
Timber.i("Adding layer");
layer = new LineLayer("my-layer", "composite");
@@ -71,7 +66,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -85,8 +81,9 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testSourceLayer() {
- checkViewIsDisplayed(R.id.mapView);
- Timber.i("Visibility");
+ validateTestSetup();
+ setupLayer();
+ Timber.i("SourceLayer");
assertNotNull(layer);
// Get initial
@@ -100,7 +97,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineCapAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-cap");
assertNotNull(layer);
@@ -111,7 +109,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineCapAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-cap");
assertNotNull(layer);
@@ -136,7 +135,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineJoinAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-join");
assertNotNull(layer);
@@ -147,7 +147,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineJoinAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-join");
assertNotNull(layer);
@@ -172,7 +173,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineMiterLimitAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-miter-limit");
assertNotNull(layer);
@@ -183,7 +185,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineMiterLimitAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-miter-limit");
assertNotNull(layer);
@@ -209,7 +212,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineRoundLimitAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-round-limit");
assertNotNull(layer);
@@ -220,7 +224,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineRoundLimitAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-round-limit");
assertNotNull(layer);
@@ -246,7 +251,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacityTransitionOptions");
assertNotNull(layer);
@@ -258,7 +264,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -269,7 +276,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -295,7 +303,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -314,7 +323,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -340,7 +350,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -369,7 +380,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-opacity");
assertNotNull(layer);
@@ -403,7 +415,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-colorTransitionOptions");
assertNotNull(layer);
@@ -415,7 +428,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -426,7 +440,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -452,7 +467,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -471,7 +487,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -497,7 +514,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -526,7 +544,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-color");
assertNotNull(layer);
@@ -537,7 +556,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineTranslateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-translateTransitionOptions");
assertNotNull(layer);
@@ -549,7 +569,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineTranslateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-translate");
assertNotNull(layer);
@@ -560,7 +581,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineTranslateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-translate");
assertNotNull(layer);
@@ -586,7 +608,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineTranslateAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-translate-anchor");
assertNotNull(layer);
@@ -597,7 +620,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineTranslateAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-translate-anchor");
assertNotNull(layer);
@@ -622,7 +646,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineWidthTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-widthTransitionOptions");
assertNotNull(layer);
@@ -634,7 +659,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-width");
assertNotNull(layer);
@@ -645,7 +671,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-width");
assertNotNull(layer);
@@ -671,7 +698,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-widthTransitionOptions");
assertNotNull(layer);
@@ -683,7 +711,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -694,7 +723,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -720,7 +750,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -739,7 +770,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -765,7 +797,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -794,7 +827,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineGapWidthAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-gap-width");
assertNotNull(layer);
@@ -828,7 +862,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offsetTransitionOptions");
assertNotNull(layer);
@@ -840,7 +875,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -851,7 +887,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -877,7 +914,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -896,7 +934,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -922,7 +961,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -951,7 +991,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineOffsetAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-offset");
assertNotNull(layer);
@@ -985,7 +1026,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blurTransitionOptions");
assertNotNull(layer);
@@ -997,7 +1039,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1008,7 +1051,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1034,7 +1078,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1053,7 +1098,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1079,7 +1125,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1108,7 +1155,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineBlurAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-blur");
assertNotNull(layer);
@@ -1142,7 +1190,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineDasharrayTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-dasharrayTransitionOptions");
assertNotNull(layer);
@@ -1154,7 +1203,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineDasharrayAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-dasharray");
assertNotNull(layer);
@@ -1165,7 +1215,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLineDasharrayAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-dasharray");
assertNotNull(layer);
@@ -1190,7 +1241,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLinePatternTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-patternTransitionOptions");
assertNotNull(layer);
@@ -1202,7 +1254,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLinePatternAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-pattern");
assertNotNull(layer);
@@ -1213,7 +1266,8 @@ public class LineLayerTest extends BaseStyleTest {
@Test
public void testLinePatternAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("line-pattern");
assertNotNull(layer);
@@ -1236,8 +1290,4 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size());
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
index 8ff3911cd1..2a0d3401fb 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
@@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.style.layers.RasterLayer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -37,28 +38,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for RasterLayer
*/
@RunWith(AndroidJUnit4.class)
-public class RasterLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class RasterLayerTest extends BaseActivityTest {
private RasterLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
Timber.i("Adding layer");
layer = new RasterLayer("my-layer", "composite");
@@ -71,7 +66,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -85,7 +81,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-opacityTransitionOptions");
assertNotNull(layer);
@@ -97,7 +94,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-opacity");
assertNotNull(layer);
@@ -108,7 +106,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-opacity");
assertNotNull(layer);
@@ -134,7 +133,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterHueRotateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-hue-rotateTransitionOptions");
assertNotNull(layer);
@@ -146,7 +146,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterHueRotateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-hue-rotate");
assertNotNull(layer);
@@ -157,7 +158,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterHueRotateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-hue-rotate");
assertNotNull(layer);
@@ -183,7 +185,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMinTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-minTransitionOptions");
assertNotNull(layer);
@@ -195,7 +198,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMinAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-min");
assertNotNull(layer);
@@ -206,7 +210,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMinAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-min");
assertNotNull(layer);
@@ -232,7 +237,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMaxTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-maxTransitionOptions");
assertNotNull(layer);
@@ -244,7 +250,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMaxAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-max");
assertNotNull(layer);
@@ -255,7 +262,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterBrightnessMaxAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-brightness-max");
assertNotNull(layer);
@@ -281,7 +289,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterSaturationTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-saturationTransitionOptions");
assertNotNull(layer);
@@ -293,7 +302,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterSaturationAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-saturation");
assertNotNull(layer);
@@ -304,7 +314,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterSaturationAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-saturation");
assertNotNull(layer);
@@ -330,7 +341,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterContrastTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-contrastTransitionOptions");
assertNotNull(layer);
@@ -342,7 +354,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterContrastAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-contrast");
assertNotNull(layer);
@@ -353,7 +366,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterContrastAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-contrast");
assertNotNull(layer);
@@ -379,7 +393,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterFadeDurationTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-fade-durationTransitionOptions");
assertNotNull(layer);
@@ -391,7 +406,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterFadeDurationAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-fade-duration");
assertNotNull(layer);
@@ -402,7 +418,8 @@ public class RasterLayerTest extends BaseStyleTest {
@Test
public void testRasterFadeDurationAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("raster-fade-duration");
assertNotNull(layer);
@@ -426,8 +443,4 @@ public class RasterLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
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 bf90949ffd..354f5def6f 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
@@ -5,11 +5,9 @@ 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.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import android.view.View;
-import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
@@ -20,16 +18,13 @@ import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException;
import com.mapbox.mapboxsdk.style.sources.Source;
import com.mapbox.mapboxsdk.style.sources.VectorSource;
import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import com.mapbox.mapboxsdk.testapp.utils.ViewUtils;
import junit.framework.Assert;
import org.hamcrest.Matcher;
import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -50,28 +45,20 @@ import static org.junit.Assert.fail;
* Basic smoke tests for Layer and Source
*/
@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTests {
+public class RuntimeStyleTests extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return RuntimeStyleTestActivity.class;
}
@Test
public void testListLayers() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
List<Layer> layers = mapboxMap.getLayers();
assertNotNull(layers);
assertTrue(layers.size() > 0);
@@ -85,18 +72,16 @@ public class RuntimeStyleTests {
@Test
public void testGetAddRemoveLayer() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new AddRemoveLayerAction());
}
@Test
public void testAddLayerAbove() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
List<Layer> layers = mapboxMap.getLayers();
Source source = mapboxMap.getSources().get(0);
@@ -126,13 +111,11 @@ public class RuntimeStyleTests {
@Test
public void testRemoveLayerAt() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
// Remove by index
Layer firstLayer = mapboxMap.getLayers().get(0);
Layer removed = mapboxMap.removeLayerAt(0);
@@ -148,12 +131,10 @@ public class RuntimeStyleTests {
}
public void testAddLayerAt() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
List<Layer> layers = mapboxMap.getLayers();
Source source = mapboxMap.getSources().get(0);
@@ -184,13 +165,11 @@ public class RuntimeStyleTests {
@Test
public void testListSources() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
List<Source> sources = mapboxMap.getSources();
assertNotNull(sources);
assertTrue(sources.size() > 0);
@@ -204,9 +183,7 @@ public class RuntimeStyleTests {
@Test
public void testAddRemoveSource() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
-
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
+ validateTestSetup();
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
mapboxMap.removeSource("my-source");
@@ -218,12 +195,11 @@ public class RuntimeStyleTests {
*/
@Test
public void testQueryRenderedFeaturesInputHandling() {
- ViewUtils.checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
String[] layerIds = new String[600];
for (int i = 0; i < layerIds.length; i++) {
layerIds[i] = "layer-" + i;
@@ -238,8 +214,6 @@ public class RuntimeStyleTests {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
// Get initial
assertNotNull(mapboxMap.getLayer("building"));
@@ -283,8 +257,6 @@ public class RuntimeStyleTests {
@Override
public void perform(UiController uiController, View view) {
- MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
-
// Add initial source
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
index 400c5fbc3c..75c8b57787 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTimingTests.java
@@ -1,16 +1,10 @@
package com.mapbox.mapboxsdk.testapp.style;
-import android.support.test.espresso.Espresso;
-import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
-import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTimingTestActivity;
-import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -18,28 +12,16 @@ import org.junit.runner.RunWith;
* Basic smoke tests for adding Layer and Source as early as possible (in onCreate)
*/
@RunWith(AndroidJUnit4.class)
-public class RuntimeStyleTimingTests extends BaseStyleTest {
+public class RuntimeStyleTimingTests extends BaseActivityTest {
- @Rule
- public final ActivityTestRule<RuntimeStyleTimingTestActivity> rule =
- new ActivityTestRule<>(RuntimeStyleTimingTestActivity.class);
-
- private OnMapReadyIdlingResource idlingResource;
-
- @Before
- public void registerIdlingResource() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
+ @Override
+ protected Class getActivityClass() {
+ return RuntimeStyleTimingTestActivity.class;
}
@Test
public void testGetAddRemoveLayer() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
// We're good if it didn't crash
}
-
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
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 97fc3e07d3..737a66713a 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
@@ -22,6 +22,7 @@ import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -37,28 +38,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for SymbolLayer
*/
@RunWith(AndroidJUnit4.class)
-public class SymbolLayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class SymbolLayerTest extends BaseActivityTest {
private SymbolLayer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
Timber.i("Adding layer");
layer = new SymbolLayer("my-layer", "composite");
@@ -71,7 +66,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -85,8 +81,9 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSourceLayer() {
- checkViewIsDisplayed(R.id.mapView);
- Timber.i("Visibility");
+ validateTestSetup();
+ setupLayer();
+ Timber.i("SourceLayer");
assertNotNull(layer);
// Get initial
@@ -100,7 +97,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolPlacementAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-placement");
assertNotNull(layer);
@@ -111,7 +109,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolPlacementAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-placement");
assertNotNull(layer);
@@ -136,7 +135,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolSpacingAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-spacing");
assertNotNull(layer);
@@ -147,7 +147,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolSpacingAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-spacing");
assertNotNull(layer);
@@ -173,7 +174,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolAvoidEdgesAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-avoid-edges");
assertNotNull(layer);
@@ -184,7 +186,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testSymbolAvoidEdgesAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("symbol-avoid-edges");
assertNotNull(layer);
@@ -209,7 +212,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconAllowOverlapAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-allow-overlap");
assertNotNull(layer);
@@ -220,7 +224,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconAllowOverlapAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-allow-overlap");
assertNotNull(layer);
@@ -245,7 +250,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconIgnorePlacementAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-ignore-placement");
assertNotNull(layer);
@@ -256,7 +262,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconIgnorePlacementAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-ignore-placement");
assertNotNull(layer);
@@ -281,7 +288,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOptionalAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-optional");
assertNotNull(layer);
@@ -292,7 +300,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOptionalAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-optional");
assertNotNull(layer);
@@ -317,7 +326,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotationAlignmentAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotation-alignment");
assertNotNull(layer);
@@ -328,7 +338,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotationAlignmentAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotation-alignment");
assertNotNull(layer);
@@ -353,7 +364,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -364,7 +376,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -390,7 +403,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -409,7 +423,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -435,7 +450,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -464,7 +480,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconSizeAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-size");
assertNotNull(layer);
@@ -498,7 +515,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTextFitAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-text-fit");
assertNotNull(layer);
@@ -509,7 +527,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTextFitAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-text-fit");
assertNotNull(layer);
@@ -534,7 +553,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTextFitPaddingAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-text-fit-padding");
assertNotNull(layer);
@@ -545,7 +565,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTextFitPaddingAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-text-fit-padding");
assertNotNull(layer);
@@ -571,7 +592,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconImageAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-image");
assertNotNull(layer);
@@ -582,7 +604,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconImageAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-image");
assertNotNull(layer);
@@ -607,7 +630,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconImageAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-image");
assertNotNull(layer);
@@ -626,7 +650,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconImageAsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-image");
assertNotNull(layer);
@@ -652,7 +677,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -663,7 +689,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -689,7 +716,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -708,7 +736,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -734,7 +763,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -763,7 +793,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconRotateAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-rotate");
assertNotNull(layer);
@@ -797,7 +828,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconPaddingAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-padding");
assertNotNull(layer);
@@ -808,7 +840,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconPaddingAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-padding");
assertNotNull(layer);
@@ -834,7 +867,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconKeepUprightAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-keep-upright");
assertNotNull(layer);
@@ -845,7 +879,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconKeepUprightAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-keep-upright");
assertNotNull(layer);
@@ -870,7 +905,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOffsetAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-offset");
assertNotNull(layer);
@@ -881,7 +917,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOffsetAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-offset");
assertNotNull(layer);
@@ -907,7 +944,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOffsetAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-offset");
assertNotNull(layer);
@@ -926,7 +964,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOffsetAsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-offset");
assertNotNull(layer);
@@ -952,7 +991,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextPitchAlignmentAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-pitch-alignment");
assertNotNull(layer);
@@ -963,7 +1003,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextPitchAlignmentAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-pitch-alignment");
assertNotNull(layer);
@@ -988,7 +1029,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotationAlignmentAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotation-alignment");
assertNotNull(layer);
@@ -999,7 +1041,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotationAlignmentAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotation-alignment");
assertNotNull(layer);
@@ -1024,7 +1067,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFieldAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-field");
assertNotNull(layer);
@@ -1035,7 +1079,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFieldAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-field");
assertNotNull(layer);
@@ -1060,7 +1105,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFieldAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-field");
assertNotNull(layer);
@@ -1079,7 +1125,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFieldAsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-field");
assertNotNull(layer);
@@ -1105,7 +1152,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFontAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-font");
assertNotNull(layer);
@@ -1116,7 +1164,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextFontAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-font");
assertNotNull(layer);
@@ -1141,7 +1190,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1152,7 +1202,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1178,7 +1229,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1197,7 +1249,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1223,7 +1276,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1252,7 +1306,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextSizeAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-size");
assertNotNull(layer);
@@ -1286,7 +1341,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextMaxWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-max-width");
assertNotNull(layer);
@@ -1297,7 +1353,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextMaxWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-max-width");
assertNotNull(layer);
@@ -1323,7 +1380,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextLineHeightAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-line-height");
assertNotNull(layer);
@@ -1334,7 +1392,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextLineHeightAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-line-height");
assertNotNull(layer);
@@ -1360,7 +1419,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextLetterSpacingAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-letter-spacing");
assertNotNull(layer);
@@ -1371,7 +1431,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextLetterSpacingAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-letter-spacing");
assertNotNull(layer);
@@ -1397,7 +1458,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextJustifyAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-justify");
assertNotNull(layer);
@@ -1408,7 +1470,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextJustifyAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-justify");
assertNotNull(layer);
@@ -1433,7 +1496,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-anchor");
assertNotNull(layer);
@@ -1444,7 +1508,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-anchor");
assertNotNull(layer);
@@ -1469,7 +1534,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextMaxAngleAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-max-angle");
assertNotNull(layer);
@@ -1480,7 +1546,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextMaxAngleAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-max-angle");
assertNotNull(layer);
@@ -1506,7 +1573,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1517,7 +1585,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1543,7 +1612,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1562,7 +1632,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1588,7 +1659,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1617,7 +1689,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextRotateAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-rotate");
assertNotNull(layer);
@@ -1651,7 +1724,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextPaddingAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-padding");
assertNotNull(layer);
@@ -1662,7 +1736,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextPaddingAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-padding");
assertNotNull(layer);
@@ -1688,7 +1763,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextKeepUprightAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-keep-upright");
assertNotNull(layer);
@@ -1699,7 +1775,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextKeepUprightAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-keep-upright");
assertNotNull(layer);
@@ -1724,7 +1801,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTransformAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-transform");
assertNotNull(layer);
@@ -1735,7 +1813,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTransformAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-transform");
assertNotNull(layer);
@@ -1760,7 +1839,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTransformAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-transform");
assertNotNull(layer);
@@ -1779,7 +1859,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTransformAsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-transform");
assertNotNull(layer);
@@ -1805,7 +1886,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOffsetAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-offset");
assertNotNull(layer);
@@ -1816,7 +1898,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOffsetAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-offset");
assertNotNull(layer);
@@ -1842,7 +1925,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOffsetAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-offset");
assertNotNull(layer);
@@ -1861,7 +1945,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOffsetAsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-offset");
assertNotNull(layer);
@@ -1887,7 +1972,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextAllowOverlapAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-allow-overlap");
assertNotNull(layer);
@@ -1898,7 +1984,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextAllowOverlapAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-allow-overlap");
assertNotNull(layer);
@@ -1923,7 +2010,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextIgnorePlacementAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-ignore-placement");
assertNotNull(layer);
@@ -1934,7 +2022,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextIgnorePlacementAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-ignore-placement");
assertNotNull(layer);
@@ -1959,7 +2048,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOptionalAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-optional");
assertNotNull(layer);
@@ -1970,7 +2060,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOptionalAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-optional");
assertNotNull(layer);
@@ -1995,7 +2086,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacityTransitionOptions");
assertNotNull(layer);
@@ -2007,7 +2099,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2018,7 +2111,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2044,7 +2138,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2063,7 +2158,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2089,7 +2185,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2118,7 +2215,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-opacity");
assertNotNull(layer);
@@ -2152,7 +2250,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-colorTransitionOptions");
assertNotNull(layer);
@@ -2164,7 +2263,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2175,7 +2275,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2201,7 +2302,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2220,7 +2322,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2246,7 +2349,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2275,7 +2379,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-color");
assertNotNull(layer);
@@ -2286,7 +2391,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-colorTransitionOptions");
assertNotNull(layer);
@@ -2298,7 +2404,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2309,7 +2416,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2335,7 +2443,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2354,7 +2463,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2380,7 +2490,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2409,7 +2520,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-color");
assertNotNull(layer);
@@ -2420,7 +2532,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-widthTransitionOptions");
assertNotNull(layer);
@@ -2432,7 +2545,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2443,7 +2557,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2469,7 +2584,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2488,7 +2604,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2514,7 +2631,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2543,7 +2661,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloWidthAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-width");
assertNotNull(layer);
@@ -2577,7 +2696,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blurTransitionOptions");
assertNotNull(layer);
@@ -2589,7 +2709,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2600,7 +2721,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2626,7 +2748,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2645,7 +2768,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2671,7 +2795,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2700,7 +2825,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconHaloBlurAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-halo-blur");
assertNotNull(layer);
@@ -2734,7 +2860,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTranslateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-translateTransitionOptions");
assertNotNull(layer);
@@ -2746,7 +2873,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTranslateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-translate");
assertNotNull(layer);
@@ -2757,7 +2885,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTranslateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-translate");
assertNotNull(layer);
@@ -2783,7 +2912,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTranslateAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-translate-anchor");
assertNotNull(layer);
@@ -2794,7 +2924,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testIconTranslateAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("icon-translate-anchor");
assertNotNull(layer);
@@ -2819,7 +2950,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacityTransitionOptions");
assertNotNull(layer);
@@ -2831,7 +2963,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2842,7 +2975,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2868,7 +3002,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2887,7 +3022,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2913,7 +3049,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2942,7 +3079,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextOpacityAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-opacity");
assertNotNull(layer);
@@ -2976,7 +3114,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-colorTransitionOptions");
assertNotNull(layer);
@@ -2988,7 +3127,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -2999,7 +3139,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -3025,7 +3166,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -3044,7 +3186,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -3070,7 +3213,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -3099,7 +3243,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-color");
assertNotNull(layer);
@@ -3110,7 +3255,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-colorTransitionOptions");
assertNotNull(layer);
@@ -3122,7 +3268,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3133,7 +3280,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3159,7 +3307,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3178,7 +3327,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3204,7 +3354,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3233,7 +3384,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloColorAsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-color");
assertNotNull(layer);
@@ -3244,7 +3396,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-widthTransitionOptions");
assertNotNull(layer);
@@ -3256,7 +3409,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3267,7 +3421,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3293,7 +3448,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3312,7 +3468,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3338,7 +3495,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3367,7 +3525,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloWidthAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-width");
assertNotNull(layer);
@@ -3401,7 +3560,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blurTransitionOptions");
assertNotNull(layer);
@@ -3413,7 +3573,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3424,7 +3585,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3450,7 +3612,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3469,7 +3632,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3495,7 +3659,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3524,7 +3689,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextHaloBlurAsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-halo-blur");
assertNotNull(layer);
@@ -3558,7 +3724,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTranslateTransition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-translateTransitionOptions");
assertNotNull(layer);
@@ -3570,7 +3737,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTranslateAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-translate");
assertNotNull(layer);
@@ -3581,7 +3749,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTranslateAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-translate");
assertNotNull(layer);
@@ -3607,7 +3776,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTranslateAnchorAsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-translate-anchor");
assertNotNull(layer);
@@ -3618,7 +3788,8 @@ public class SymbolLayerTest extends BaseStyleTest {
@Test
public void testTextTranslateAnchorAsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("text-translate-anchor");
assertNotNull(layer);
@@ -3641,8 +3812,4 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextTranslateAnchor().getFunction().getStops()).size());
}
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
index fd0c177fb8..02aedadfa5 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
@@ -26,6 +26,7 @@ import com.mapbox.mapboxsdk.style.layers.<%- camelize(type) %>Layer;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.activity.style.RuntimeStyleTestActivity;
import com.mapbox.mapboxsdk.testapp.utils.OnMapReadyIdlingResource;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
import org.junit.After;
import org.junit.Before;
@@ -41,28 +42,22 @@ import static com.mapbox.mapboxsdk.style.layers.Property.*;
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.*;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
+import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
/**
* Basic smoke tests for <%- camelize(type) %>Layer
*/
@RunWith(AndroidJUnit4.class)
-public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
-
- @Rule
- public final ActivityTestRule<RuntimeStyleTestActivity> rule = new ActivityTestRule<>(RuntimeStyleTestActivity.class);
+public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
private <%- camelize(type) %>Layer layer;
- private OnMapReadyIdlingResource idlingResource;
-
- private MapboxMap mapboxMap;
-
- @Before
- public void setup() {
- idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
- Espresso.registerIdlingResources(idlingResource);
- mapboxMap = rule.getActivity().getMapboxMap();
+ @Override
+ protected Class getActivityClass() {
+ return EspressoTestActivity.class;
+ }
+ private void setupLayer(){
<% if (type === 'background') { -%>
Timber.i("Retrieving layer");
layer = mapboxMap.getLayerAs("background");
@@ -80,7 +75,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void testSetVisibility() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("Visibility");
assertNotNull(layer);
@@ -95,8 +91,9 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void testSourceLayer() {
- checkViewIsDisplayed(R.id.mapView);
- Timber.i("Visibility");
+ validateTestSetup();
+ setupLayer();
+ Timber.i("SourceLayer");
assertNotNull(layer);
// Get initial
@@ -113,7 +110,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>Transition() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>TransitionOptions");
assertNotNull(layer);
@@ -126,7 +124,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -138,7 +137,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsCameraFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -177,7 +177,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsIdentitySourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -197,7 +198,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -228,7 +230,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsIntervalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -259,7 +262,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsExponentialSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -289,7 +293,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsCategoricalSourceFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -329,7 +334,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsCompositeFunction() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -371,7 +377,8 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
@Test
public void test<%- camelize(property.name) %>AsIntConstant() {
- checkViewIsDisplayed(R.id.mapView);
+ validateTestSetup();
+ setupLayer();
Timber.i("<%- property.name %>");
assertNotNull(layer);
@@ -382,8 +389,4 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
<% } -%>
<% } -%>
- @After
- public void unregisterIntentServiceIdlingResource() {
- Espresso.unregisterIdlingResources(idlingResource);
- }
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/ScreenshotUtil.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/ScreenshotUtil.java
deleted file mode 100644
index 77bfc519bf..0000000000
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/ScreenshotUtil.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.mapbox.mapboxsdk.testapp.utils;
-
-import android.app.Activity;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.os.Environment;
-
-import timber.log.Timber;
-
-import android.view.TextureView;
-import android.view.View;
-import android.view.ViewGroup;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-/**
- * The built-in Fuzz Suite on AWS Device Farm takes screenshots after every test. However,
- * this doesn't happen with Espresso unless we manually do it. This class fixes it.
- */
-public class ScreenshotUtil {
-
- // Where to store the files. This path is required by AWS Device Farm:
- // http://docs.aws.amazon.com/devicefarm/latest/developerguide/test-types-android-instrumentation.html
- // #test-types-android-instrumentation-screenshots
- private static final String SCREENSHOT_FOLDER = "test-screenshots";
-
- // Image type and quality
- private static final String DEFAULT_IMAGE_EXTENSION = ".png";
- private static final Bitmap.CompressFormat DEFAULT_IMAGE_FORMAT = Bitmap.CompressFormat.PNG;
- private static final int DEFAULT_IMAGE_QUALITY = 100;
-
- public static void take(Activity activity, String testName) {
-
- // Check if storage is available
- if (!isExternalStorageWritable()) {
- Timber.d("External storage is not available.");
- return;
- }
-
- // Get a bitmap from the activity root view. When the drawing cache is enabled,
- // the next call to getDrawingCache() will draw the view in a bitmap.
- View rootView = activity.getWindow().getDecorView().getRootView();
- // rootView.setDrawingCacheEnabled(true);r
- // rootView.setDrawingCacheEnabled(false);
-
- Bitmap bitmap = null;
-
- // Add the SurfaceView bit (see getAllTextureViews() below)
- List<TextureView> tilingViews = getAllTextureViews(rootView);
- if (tilingViews.size() > 0) {
- bitmap = Bitmap.createBitmap(tilingViews.get(0).getHeight(), tilingViews.get(0).getWidth(),
- Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(bitmap);
- for (TextureView TextureView : tilingViews) {
- Bitmap b = TextureView.getBitmap(TextureView.getWidth(), TextureView.getHeight());
- int[] location = new int[2];
- TextureView.getLocationInWindow(location);
- int[] location2 = new int[2];
- TextureView.getLocationOnScreen(location2);
- canvas.drawBitmap(b, 0, 0, null);
- }
- }
-
- // Save the bitmap in external storage
- String uniqueAbsolutePath = getUniqueAbsolutePath(testName);
- File outputFile = new File(uniqueAbsolutePath);
- OutputStream outputStream = null;
- try {
- outputStream = new FileOutputStream(outputFile);
- bitmap.compress(DEFAULT_IMAGE_FORMAT, DEFAULT_IMAGE_QUALITY, outputStream);
- outputStream.flush();
- } catch (Exception exception) {
-
- exception.printStackTrace();
- } finally {
- if (outputStream != null) {
- try {
- outputStream.close();
- } catch (IOException ioException) {
- ioException.printStackTrace();
- }
- }
- }
- }
-
- /*
- * The classic way of taking a screenshot (above) doesn't work with TextureView, this fixes it:
- * http://stackoverflow.com/questions/19704060/screen-capture-textureview-is-black-using-drawingcache
- */
-
- public static List<TextureView> getAllTextureViews(View view) {
- List<TextureView> tilingViews = new ArrayList<TextureView>();
- if (view instanceof TextureView) {
- tilingViews.add((TextureView) view);
- } else if (view instanceof ViewGroup) {
- ViewGroup viewGroup = (ViewGroup) view;
- for (int i = 0; i < viewGroup.getChildCount(); i++) {
- tilingViews.addAll(getAllTextureViews(viewGroup.getChildAt(i)));
- }
- }
-
- return tilingViews;
- }
-
- /*
- * Utils
- */
-
- public static boolean isExternalStorageWritable() {
- // Checks if external storage is available for read and write
- String state = Environment.getExternalStorageState();
- return Environment.MEDIA_MOUNTED.equals(state);
- }
-
- private static String getUniqueAbsolutePath(String testName) {
- // A screenshot after every test vs. manual tests
- String filename = UUID.randomUUID().toString() + DEFAULT_IMAGE_EXTENSION;
- if (testName != null && !testName.isEmpty()) {
- filename = testName + DEFAULT_IMAGE_EXTENSION;
- }
-
- String externalPath = Environment.getExternalStorageDirectory().toString();
- String path = externalPath + File.separator + SCREENSHOT_FOLDER;
- File dir = new File(path);
- dir.mkdirs();
- path += File.separator + filename;
- Timber.d("Screenshot path: " + path);
- return path;
- }
-
-}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java
index eca310b0b9..74b43e0257 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/storage/UrlTransformActivity.java
@@ -19,6 +19,7 @@ import timber.log.Timber;
public class UrlTransformActivity extends AppCompatActivity {
private MapView mapView;
+ private MapboxMap mapboxMap;
/**
* Be sure to use an isolated class so the activity is not leaked when
@@ -50,6 +51,7 @@ public class UrlTransformActivity extends AppCompatActivity {
@Override
public void onMapReady(MapboxMap map) {
Timber.i("Map loaded");
+ mapboxMap = map;
}
});
}
diff --git a/platform/android/scripts/generate-test-code.js b/platform/android/scripts/generate-test-code.js
index 2fd98f701f..b054e4a2e7 100644
--- a/platform/android/scripts/generate-test-code.js
+++ b/platform/android/scripts/generate-test-code.js
@@ -14,7 +14,7 @@ global.camelize = function (str) {
}
-const excludeActivities = ["RealTimeGeoJsonActivity","UpdateMetadataActivity","CarDrivingActivity","MyLocationTrackingModeActivity","MyLocationToggleActivity","MyLocationTintActivity","MyLocationDrawableActivity","DoubleMapActivity", "LocationPickerActivity","GeoJsonClusteringActivity","RuntimeStyleTestActivity", "AnimatedMarkerActivity", "ViewPagerActivity","MapFragmentActivity","SupportMapFragmentActivity","SnapshotActivity","NavigationDrawerActivity", "QueryRenderedFeaturesBoxHighlightActivity", "MultiMapActivity", "MapInDialogActivity", "SimpleMapActivity"];
+const excludeActivities = ["DeleteRegionActivity","RealTimeGeoJsonActivity","UpdateMetadataActivity","CarDrivingActivity","MyLocationTrackingModeActivity","MyLocationToggleActivity","MyLocationTintActivity","MyLocationDrawableActivity","DoubleMapActivity", "LocationPickerActivity","GeoJsonClusteringActivity","RuntimeStyleTestActivity", "AnimatedMarkerActivity", "ViewPagerActivity","MapFragmentActivity","SupportMapFragmentActivity","SnapshotActivity","NavigationDrawerActivity", "QueryRenderedFeaturesBoxHighlightActivity", "MultiMapActivity", "MapInDialogActivity", "SimpleMapActivity"];
const appBasePath = 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity';
const testBasePath = 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/gen';
const subPackages = fs.readdirSync(appBasePath);
diff --git a/platform/android/src/map/camera_position.cpp b/platform/android/src/map/camera_position.cpp
index 0b46998878..aa5873b273 100644
--- a/platform/android/src/map/camera_position.cpp
+++ b/platform/android/src/map/camera_position.cpp
@@ -12,7 +12,7 @@ jni::Object<CameraPosition> CameraPosition::New(jni::JNIEnv &env, mbgl::CameraOp
center.wrap();
// convert bearing, core ranges from [−π rad, π rad], android from 0 to 360 degrees
- double bearing_degrees = options.angle.value_or(-M_PI) * 180.0 / M_PI;
+ double bearing_degrees = options.angle.value_or(0) * 180.0 / M_PI;
while (bearing_degrees > 360) {
bearing_degrees -= 360;
}