diff options
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp')
7 files changed, 8 insertions, 132 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt index 4c7baad939..3fbc086621 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt @@ -1219,12 +1219,6 @@ class LocationComponentTest : BaseActivityTest() { override fun getLastAccuracySensorStatus(): Int { return 0 } - - override fun onStart() { - } - - override fun onStop() { - } } component.compassEngine = engine diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt index 9a92a23f9b..a47ebd6000 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt @@ -6,7 +6,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity -import com.mapbox.mapboxsdk.testapp.utils.TestConstants import org.junit.Assert.assertEquals import org.junit.Test @@ -17,34 +16,6 @@ class TransformTest: BaseActivityTest() { companion object { val initialCameraUpdate = CameraUpdateFactory.newLatLngZoom(LatLng(12.0,12.0), 12.0)!! - val scrollByCameraUpdate = CameraUpdateFactory.scrollBy(400.0f,0.0f)!! - } - - @Test - fun cameraUpdateScrollByWithPadding() { - validateTestSetup() - invoke(mapboxMap) { uiController: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(initialCameraUpdate) - mapboxMap.moveCamera(scrollByCameraUpdate) - val expectedCameraPosition = mapboxMap.cameraPosition - - mapboxMap.moveCamera(initialCameraUpdate) - mapboxMap.setPadding(250,250,0,0) - mapboxMap.moveCamera(scrollByCameraUpdate) - val actualCameraPosition = mapboxMap.cameraPosition - - assertEquals("Camera position latitude should match", - expectedCameraPosition.target.latitude, - actualCameraPosition.target.longitude, - TestConstants.LAT_LNG_DELTA - ) - - assertEquals("Camera position longitude should match", - expectedCameraPosition.target.longitude, - actualCameraPosition.target.longitude, - TestConstants.LAT_LNG_DELTA - ) - } } @Test @@ -63,5 +34,4 @@ class TransformTest: BaseActivityTest() { assertEquals("Camera position should match", expectedCameraPosition, actualCameraPosition) } } - }
\ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java index d4283669f3..376e627b04 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -159,35 +158,6 @@ public class CameraAnimateTest extends BaseActivityTest { } @Test - public void testAnimateToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.animateCamera( - CameraUpdateFactory.scrollBy(moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - - @Test public void testAnimateToZoomIn() { validateTestSetup(); invoke(mapboxMap, (uiController, mapboxMap) -> { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java index d51c7661be..fb0eb71ef3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -159,35 +158,6 @@ public class CameraEaseTest extends BaseActivityTest { } @Test - public void testEaseToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - - @Test public void testEaseToZoomIn() { validateTestSetup(); invoke(mapboxMap, (uiController, mapboxMap) -> { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java index 39b2c8d763..752d02e319 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java @@ -244,8 +244,10 @@ public class CameraForTest extends BaseActivityTest { validateTestSetup(); onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { List<List<Point>> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, - new int[] {5, 5, 5, 5}); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry( + Polygon.fromLngLats(polygonDefinition), + new int[] {5, 5, 5, 5}, + 45, 0); CameraPosition expectedPosition = new CameraPosition.Builder() .target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build(); assertEquals("Latitude should match", diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java index 15d52f2576..22c837a4a5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -159,35 +158,6 @@ public class CameraMoveTest extends BaseActivityTest { } @Test - public void testMoveToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.moveCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - - @Test public void testMoveToZoomIn() { validateTestSetup(); invoke(mapboxMap, (uiController, mapboxMap) -> { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index 182fb441cd..b06889d11c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -11,7 +11,7 @@ import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.SeekBar; import android.widget.TextView; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; + import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; @@ -69,10 +69,10 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal uiSettings.setAttributionEnabled(false); FloatingActionButton fab = findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); - fab.setOnClickListener(view -> mapboxMap.easeCamera( - CameraUpdateFactory.scrollBy(seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, + fab.setOnClickListener(view -> mapboxMap.scrollBy( + seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, seekBarY.getProgress() * MULTIPLIER_PER_PIXEL) - )); + ); } @Override |