[android] - ignore location tracking mode based animations when the camera is transitioning

This commit is contained in:
Łukasz Paczos
2019-09-17 12:43:54 +02:00
parent 5254876b39
commit 4f91073414
2 changed files with 92 additions and 0 deletions

View File

@@ -1288,6 +1288,36 @@ class LocationComponentTest : EspressoTest() {
executeComponentTest(componentAction)
}
@Test
fun animators_dontZoomWhileTransitioning() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(
component: LocationComponent,
mapboxMap: MapboxMap,
style: Style,
uiController: UiController,
context: Context
) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
.build())
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
val zoom = mapboxMap.cameraPosition.zoom
component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
component.zoomWhileTracking(16.0, 1000)
uiController.loopMainThreadForAtLeast(1000)
TestingAsyncUtils.waitForLayer(uiController, mapView)
assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.0001)
}
}
executeComponentTest(componentAction)
}
@Test
@Ignore
fun animators_cancelZoomWhileTracking() {
@@ -1433,6 +1463,36 @@ class LocationComponentTest : EspressoTest() {
executeComponentTest(componentAction)
}
@Test
fun animators_dontTiltWhileTransitioning() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(
component: LocationComponent,
mapboxMap: MapboxMap,
style: Style,
uiController: UiController,
context: Context
) {
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
.build())
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
val tilt = mapboxMap.cameraPosition.tilt
component.setCameraMode(CameraMode.TRACKING_GPS, 500L, null, null, null, null)
component.tiltWhileTracking(30.0, 1000)
uiController.loopMainThreadForAtLeast(1000)
TestingAsyncUtils.waitForLayer(uiController, mapView)
assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.0001)
}
}
executeComponentTest(componentAction)
}
@Test
@Ignore
fun animators_cancelTiltWhileTracking() {