summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java62
1 files changed, 62 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java
new file mode 100644
index 0000000000..edef97027e
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/RotateActivityTest.java
@@ -0,0 +1,62 @@
+package com.mapbox.mapboxsdk.testapp.camera;
+
+import android.support.test.espresso.UiController;
+import android.support.test.espresso.ViewAction;
+import android.view.View;
+
+import com.mapbox.mapboxsdk.maps.MapView;
+import com.mapbox.mapboxsdk.maps.MapboxMapUtils;
+import com.mapbox.mapboxsdk.testapp.R;
+import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
+import com.mapbox.mapboxsdk.testapp.activity.infowindow.InfoWindowActivity;
+
+import org.hamcrest.Matcher;
+import org.junit.Test;
+
+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;
+
+public class RotateActivityTest extends BaseActivityTest {
+
+ @Test
+ // longer testing change second param
+ public void testRotate() {
+ onView(withId(R.id.mapView)).perform(new RotateAction(0, 1));
+ }
+
+ @Override
+ public Class getActivityClass() {
+ return InfoWindowActivity.class;
+ }
+
+ private class RotateAction implements ViewAction {
+
+ private float startDegree;
+ private float endDegree;
+
+ public RotateAction(float startDegree, float endDegree) {
+ this.startDegree = startDegree;
+ this.endDegree = endDegree;
+ }
+
+ @Override
+ public Matcher<View> getConstraints() {
+ return isDisplayed();
+ }
+
+ @Override
+ public String getDescription() {
+ return "rotateAction";
+ }
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ uiController.loopMainThreadForAtLeast(500);
+ for (float i = startDegree; i < endDegree; i++) {
+ MapboxMapUtils.setDirection((MapView) view, i);
+ uiController.loopMainThreadForAtLeast(1);
+ }
+ }
+ }
+}