[android] - create device independent tests for camera position testing
This commit is contained in:
@@ -7,10 +7,9 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
@@ -20,11 +19,10 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return EspressoTestActivity.class;
|
||||
return DeviceIndependentTestActivity.class;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToCameraPositionTarget() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -45,7 +43,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToCameraPositionTargetZoom() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -63,7 +60,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToCameraPosition() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -93,7 +89,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToBounds() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -118,7 +113,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToMoveBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -137,7 +131,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToZoomIn() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -151,7 +144,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToZoomOut() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -167,7 +159,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToZoomBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -182,7 +173,6 @@ public class CameraAnimateTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testAnimateToZoomTo() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
|
||||
@@ -7,10 +7,9 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
@@ -20,11 +19,10 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return EspressoTestActivity.class;
|
||||
return DeviceIndependentTestActivity.class;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToCameraPositionTarget() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -45,7 +43,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToCameraPositionTargetZoom() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -63,7 +60,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToCameraPosition() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -93,7 +89,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToBounds() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -118,7 +113,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToMoveBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -137,7 +131,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToZoomIn() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -151,7 +144,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToZoomOut() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -167,7 +159,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToZoomBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -182,7 +173,6 @@ public class CameraEaseTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testEaseToZoomTo() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -24,7 +24,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
|
||||
LatLngBounds.from(10, 10, -10, -10));
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.66).tilt(0).bearing(0).build();
|
||||
.target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -42,7 +42,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
|
||||
LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5});
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.64).tilt(0).bearing(0).build();
|
||||
.target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -63,7 +63,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
|
||||
LatLngBounds.from(10, 10, -10, -10), 45, 0);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.15).tilt(0).bearing(45).build();
|
||||
.target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -84,7 +84,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
|
||||
LatLngBounds.from(10, 10, -10, -10), 0, 45);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng(-0.2423318, 0)).zoom(3.62).tilt(45).bearing(0).build();
|
||||
.target(new LatLng(-0.264576975267, 0)).zoom(4.13).tilt(45).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -105,7 +105,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds(
|
||||
LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}, 45, 45);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng(-0.3418347, -0.3400988)).zoom(3.13).tilt(45).bearing(45).build();
|
||||
.target(new LatLng(-0.3732134634, -0.3713191053)).zoom(3.63).tilt(45).bearing(45).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -126,7 +126,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
List<List<Point>> polygonDefinition = getPolygonDefinition();
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition));
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.66).tilt(0).bearing(0).build();
|
||||
.target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -161,7 +161,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition),
|
||||
new int[] {5, 5, 5, 5});
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.64).tilt(0).bearing(0).build();
|
||||
.target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -182,7 +182,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
List<List<Point>> polygonDefinition = getPolygonDefinition();
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, 0);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.15).tilt(0).bearing(45).build();
|
||||
.target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -203,7 +203,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
List<List<Point>> polygonDefinition = getPolygonDefinition();
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 0, 45);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng(-0.2423318, 0)).zoom(3.62).tilt(45).bearing(0).build();
|
||||
.target(new LatLng(-0.2645769752, 0)).zoom(4.13).tilt(45).bearing(0).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -225,7 +225,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition),
|
||||
new int[] {5, 5, 5, 5}, 45, 45);
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng(-0.3418347, -0.3400988)).zoom(3.13).tilt(45).bearing(45).build();
|
||||
.target(new LatLng(-0.373213463, -0.37131910534)).zoom(3.63).tilt(45).bearing(45).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -247,7 +247,7 @@ public class CameraForTest extends BaseActivityTest {
|
||||
CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45,
|
||||
new int[] {5, 5, 5, 5});
|
||||
CameraPosition expectedPosition = new CameraPosition.Builder()
|
||||
.target(new LatLng()).zoom(3.13).tilt(0).bearing(45).build();
|
||||
.target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build();
|
||||
assertEquals("Latitude should match",
|
||||
expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f);
|
||||
assertEquals("Longitude should match",
|
||||
@@ -263,6 +263,6 @@ public class CameraForTest extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return EspressoTestActivity.class;
|
||||
return DeviceIndependentTestActivity.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,9 @@ import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.activity.espresso.DeviceIndependentTestActivity;
|
||||
import com.mapbox.mapboxsdk.testapp.utils.TestConstants;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke;
|
||||
@@ -21,11 +20,10 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
protected Class getActivityClass() {
|
||||
return EspressoTestActivity.class;
|
||||
return DeviceIndependentTestActivity.class;
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToCameraPositionTarget() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -46,7 +44,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToCameraPositionTargetZoom() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -64,7 +61,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToCameraPosition() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -94,7 +90,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToBounds() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -119,7 +114,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToMoveBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -138,7 +132,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToZoomIn() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -152,7 +145,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToZoomOut() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -168,7 +160,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToZoomBy() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
@@ -183,7 +174,6 @@ public class CameraMoveTest extends BaseActivityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testMoveToZoomTo() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
|
||||
@@ -6,11 +6,11 @@ public class TestConstants {
|
||||
|
||||
public static final long ANIMATION_TEST_TIME = MapboxConstants.ANIMATION_DURATION * 2;
|
||||
|
||||
public static final double LAT_LNG_DELTA_LARGE = 0.1;
|
||||
public static final double LAT_LNG_DELTA = 0.01;
|
||||
public static final double BEARING_DELTA = 0.1;
|
||||
public static final double TILT_DELTA = 0.1;
|
||||
public static final double ZOOM_DELTA = 0.3;
|
||||
public static final double LAT_LNG_DELTA_LARGE = 0.01;
|
||||
public static final double LAT_LNG_DELTA = 0.001;
|
||||
public static final double BEARING_DELTA = 0.01;
|
||||
public static final double TILT_DELTA = 0.01;
|
||||
public static final double ZOOM_DELTA = 0.01;
|
||||
|
||||
public static final String TEXT_MARKER_TEXT = "Text";
|
||||
public static final String TEXT_MARKER_TITLE = "Marker";
|
||||
|
||||
Reference in New Issue
Block a user