[android] #4308 - add some simple gesture tests

This commit is contained in:
Tobrun
2016-03-14 16:10:49 -04:00
parent d64b8ad25c
commit 9494fa7253
3 changed files with 64 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}
}