summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2016-03-14 16:10:49 -0400
committerTobrun <tobrun.van.nuland@gmail.com>2016-03-15 14:07:24 -0400
commit9494fa72532f54e54a8b905acde7e188f4bb003b (patch)
treeb17f549b3e05afc1740edbc205fcfa9f3f35e4ff
parentd64b8ad25ca7c2297221337d4021924b5103cc77 (diff)
downloadqtlocation-mapboxgl-9494fa72532f54e54a8b905acde7e188f4bb003b.tar.gz
[android] #4308 - add some simple gesture tests
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java12
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleRotateTest.java27
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleZoomTest.java26
3 files changed, 64 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java
index 73cebf22a0..d41c692509 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxMapUtils.java
@@ -11,8 +11,18 @@ public class MapboxMapUtils {
* @param mapView
* @return
*/
- public static MapboxMap getMapboxMap(MapView mapView){
+ public static MapboxMap getMapboxMap(MapView mapView) {
return mapView.getMapboxMap();
}
+ /**
+ * Set the direction of the user
+ *
+ * @param mapView
+ * @param direction
+ */
+ public static void setDirection(MapView mapView, double direction) {
+ mapView.setDirection(direction);
+ }
+
}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleRotateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleRotateTest.java
new file mode 100644
index 0000000000..f8075b7e58
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleRotateTest.java
@@ -0,0 +1,27 @@
+package com.mapbox.mapboxsdk.testapp.robotium;
+
+import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
+import com.mapbox.mapboxsdk.geometry.LatLng;
+import com.mapbox.mapboxsdk.maps.MapboxMapUtils;
+
+import org.junit.Test;
+
+public class SimpleRotateTest extends BaseMainActivityTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void testRotate() {
+ mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(47.376271, 8.539116), 15));
+ double rotation = 0;
+ for (int i = 0; i < 180; i++) {
+ rotation += 1;
+ MapboxMapUtils.setDirection(mapView, rotation);
+ solo.sleep(100);
+ }
+ }
+
+}
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleZoomTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleZoomTest.java
new file mode 100644
index 0000000000..03ac7ce25b
--- /dev/null
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/robotium/SimpleZoomTest.java
@@ -0,0 +1,26 @@
+package com.mapbox.mapboxsdk.testapp.robotium;
+
+import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
+import com.mapbox.mapboxsdk.constants.MapboxConstants;
+import com.mapbox.mapboxsdk.geometry.LatLng;
+
+import org.junit.Test;
+
+public class SimpleZoomTest extends BaseMainActivityTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ }
+
+ @Test
+ public void testZoomIn() {
+ float currentZoomlevel = MapboxConstants.MINIMUM_ZOOM;
+ while (currentZoomlevel < MapboxConstants.MAXIMUM_ZOOM - 5) {
+ mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(47.376271, 8.539116),currentZoomlevel));
+ currentZoomlevel++;
+ solo.sleep(1400);
+ }
+ }
+
+}