diff options
author | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-10-03 11:30:54 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-10-03 13:13:17 +0200 |
commit | 5bfdd9fb8d721140172be2217a96980a6b94cb6b (patch) | |
tree | 92a2e06c434c3ac97f3d032b4c1de79af17b7fea /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt | |
parent | b31245b96583a7e25aba9626d43080276e647e61 (diff) | |
download | qtlocation-mapboxgl-5bfdd9fb8d721140172be2217a96980a6b94cb6b.tar.gz |
[android] - move camera and puck immediately when starting to track and displacement is big
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt | 23 |
1 files changed, 23 insertions, 0 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 aa3e2eea6f..444b478219 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 @@ -1100,6 +1100,29 @@ class LocationComponentTest : BaseActivityTest() { } @Test + fun cameraPositionSnappedToTargetIfExceedsThreshold() { + val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction { + override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap, + uiController: UiController, context: Context) { + component.activateLocationComponent(context, false) + component.isLocationComponentEnabled = true + val target = LatLng(51.0, 17.0) + assertTrue(target.distanceTo(LatLng(location)) > LocationComponentConstants.INSTANT_LOCATION_TRANSITION_THRESHOLD) + component.cameraMode = CameraMode.NONE + component.forceLocationUpdate(location) + mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(target)) + mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(90.0)) + component.cameraMode = CameraMode.TRACKING_GPS + assertEquals(location.bearing.toDouble(), mapboxMap.cameraPosition.bearing, 0.1) + assertEquals(location.latitude, mapboxMap.cameraPosition.target.latitude, 0.1) + assertEquals(location.longitude, mapboxMap.cameraPosition.target.longitude, 0.1) + } + } + + executeComponentTest(componentAction) + } + + @Test fun compassEngine_onComponentInitializedDefaultIsProvided() { val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction { override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap, |