[android] - rework instrumentation tests (#8793)
This commit is contained in:
@@ -65,7 +65,7 @@ jobs:
|
||||
--app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug.apk \
|
||||
--test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \
|
||||
--device-ids shamu --os-version-ids 22 --locales en --orientations portrait --timeout 15m \
|
||||
--test-targets "class com.mapbox.mapboxsdk.testapp.maps.widgets.AttributionTest" 2>&1 | tee firebase.log) || EXIT_CODE=$?
|
||||
--test-targets "class com.mapbox.mapboxsdk.testapp.maps.widgets.LogoTest" 2>&1 | tee firebase.log) || EXIT_CODE=$?
|
||||
|
||||
FIREBASE_TEST_BUCKET=$(sed -n 's|^.*\[https://console.developers.google.com/storage/browser/\([^]]*\).*|gs://\1|p' firebase.log)
|
||||
echo "Downloading from: ${FIREBASE_TEST_BUCKET}"
|
||||
|
||||
@@ -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 {
|
||||
public class MapboxMapTest extends BaseActivityTest {
|
||||
|
||||
@Rule
|
||||
public final ActivityTestRule<EspressoTestActivity> rule = new ActivityTestRule<>(EspressoTestActivity.class);
|
||||
|
||||
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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class <%- activity %>Test extends BaseActivityTest {
|
||||
|
||||
@Test
|
||||
public void testSanity() {
|
||||
onView(withId(R.id.mapView)).check(matches(isDisplayed()));
|
||||
validateTestSetup();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
private OnMapReadyIdlingResource idlingResource;
|
||||
private Polygon polygon;
|
||||
|
||||
@Before
|
||||
public void registerIdlingResource() {
|
||||
idlingResource = new OnMapReadyIdlingResource(rule.getActivity());
|
||||
Espresso.registerIdlingResources(idlingResource);
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return EspressoTestActivity.class;
|
||||
}
|
||||
|
||||
private Polygon polygon;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
public class QueryRenderedFeaturesBoxCountTest extends BaseActivityTest {
|
||||
|
||||
@Rule
|
||||
public final ActivityTestRule<QueryRenderedFeaturesBoxCountActivity> rule =
|
||||
new ActivityTestRule<>(QueryRenderedFeaturesBoxCountActivity.class);
|
||||
|
||||
private OnMapReadyIdlingResource idlingResource;
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
public class QueryRenderedFeaturesHighlightTest extends BaseActivityTest {
|
||||
|
||||
@Rule
|
||||
public final ActivityTestRule<QueryRenderedFeaturesBoxHighlightActivity> rule =
|
||||
new ActivityTestRule<>(QueryRenderedFeaturesBoxHighlightActivity.class);
|
||||
|
||||
private OnMapReadyIdlingResource idlingResource;
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
public class QueryRenderedSymbolBoxCountTest extends BaseActivityTest {
|
||||
|
||||
@Rule
|
||||
public final ActivityTestRule<QueryRenderedFeaturesBoxSymbolCountActivity> rule =
|
||||
new ActivityTestRule<>(QueryRenderedFeaturesBoxSymbolCountActivity.class);
|
||||
|
||||
private OnMapReadyIdlingResource idlingResource;
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
public class BaseStyleTest extends BaseActivityTest {
|
||||
|
||||
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()));
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return RuntimeStyleTestActivity.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user