Cherry pick from https://github.com/mapbox/mapbox-gl-native-android/pull/470/files
This commit is contained in:
@@ -705,6 +705,15 @@ class LocationAnimatorCoordinatorTest {
|
||||
verify { animatorProvider.floatAnimator(any(), any(), 5) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun remove_gps_animator() {
|
||||
val animator = mockk<MapboxFloatAnimator>(relaxed = true)
|
||||
locationAnimatorCoordinator.animatorArray.put(ANIMATOR_LAYER_GPS_BEARING, animator)
|
||||
|
||||
locationAnimatorCoordinator.cancelAndRemoveGpsBearingAnimation()
|
||||
assertTrue(locationAnimatorCoordinator.animatorArray.get(ANIMATOR_LAYER_GPS_BEARING) == null)
|
||||
}
|
||||
|
||||
private fun getListenerHoldersSet(vararg animatorTypes: Int): Set<AnimatorListenerHolder> {
|
||||
return HashSet<AnimatorListenerHolder>().also {
|
||||
for (type in animatorTypes) {
|
||||
|
||||
@@ -469,6 +469,34 @@ class LocationComponentTest {
|
||||
verify(renderChangeListener).onRenderModeChanged(RenderMode.NORMAL)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun change_to_gps_mode_symbolLayerBearingValue() {
|
||||
val location = Location("test")
|
||||
location.bearing = 50f
|
||||
val projection: Projection = mock(Projection::class.java)
|
||||
`when`(projection.getMetersPerPixelAtLatitude(location.latitude)).thenReturn(10.0)
|
||||
`when`(mapboxMap.projection).thenReturn(projection)
|
||||
`when`(style.isFullyLoaded).thenReturn(true)
|
||||
`when`(mapboxMap.cameraPosition).thenReturn(CameraPosition.DEFAULT)
|
||||
|
||||
locationComponent.activateLocationComponent(
|
||||
LocationComponentActivationOptions.builder(context, style)
|
||||
.locationComponentOptions(locationComponentOptions)
|
||||
.useDefaultLocationEngine(false)
|
||||
.build()
|
||||
)
|
||||
locationComponent.isLocationComponentEnabled = true
|
||||
locationComponent.onStart()
|
||||
locationComponent.renderMode = RenderMode.NORMAL
|
||||
locationComponent.forceLocationUpdate(location)
|
||||
|
||||
verify(locationLayerController, times(0)).setGpsBearing(50f)
|
||||
|
||||
locationComponent.renderMode = RenderMode.GPS
|
||||
verify(locationLayerController, times(1)).setGpsBearing(50f)
|
||||
verify(locationAnimatorCoordinator).cancelAndRemoveGpsBearingAnimation()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun tiltWhileTracking_notReady() {
|
||||
`when`(mapboxMap.cameraPosition).thenReturn(CameraPosition.DEFAULT)
|
||||
|
||||
Reference in New Issue
Block a user