Cherry pick release v4.2.0 (#6944)

* [android] - MyLocationView should facing above when location and compass bearing tracking are enabled. (#6829)

* [android] - use current animated rotation value for calculating animated marker rotation difference (#6826)

fix unit tests, input limiting is not handled by animateRotationBy instead of MarkerView.
Changed test to validate if method was called with correct value.

* [android] - only calculated offset margins for InfoWindow if View is found in current viewport, added example to the test app to test for regressions (#6877)

* upgraded okhttp dependency to latest version (#6880)

* Cancelable callback invocation (#6891)

* [android] - allow onCancel to be invoked from camera cancel callbacks

* set to null after finish

* [android]  - using bearing clockwise versus counterclockwise (#6917)

* [android]  - using bearing clockwise versus counterclockwise

* fixup brackets

* [android] - convert bearing values from core to Android SDK equivalent.
This commit is contained in:
Tobrun
2016-11-09 10:42:18 +01:00
committed by GitHub
parent efc427f9bb
commit 772324e8f2
12 changed files with 144 additions and 93 deletions

View File

@@ -146,7 +146,6 @@ public class MarkerViewTest {
public void testRotationUpdatePositive() {
float startRotation = 45;
float endRotation = 180;
float animationValue = 135;
// allow calls to our mock
when(mapboxMap.getMarkerViewManager()).thenReturn(markerViewManager);
@@ -156,14 +155,13 @@ public class MarkerViewTest {
marker.setMapboxMap(mapboxMap);
marker.setRotation(endRotation);
verify(markerViewManager, times(1)).animateRotationBy(marker, animationValue);
verify(markerViewManager, times(1)).animateRotationBy(marker, endRotation);
}
@Test
public void testRotationUpdateNegative() {
float startRotation = 10;
float endRotation = 270;
float animationValue = -100;
// allow calls to our mock
when(mapboxMap.getMarkerViewManager()).thenReturn(markerViewManager);
@@ -173,14 +171,13 @@ public class MarkerViewTest {
marker.setMapboxMap(mapboxMap);
marker.setRotation(endRotation);
verify(markerViewManager, times(1)).animateRotationBy(marker, animationValue);
verify(markerViewManager, times(1)).animateRotationBy(marker, endRotation);
}
@Test
public void testRotationUpdateMax() {
float startRotation = 359;
float endRotation = 0;
float animationValue = 1;
// allow calls to our mock
when(mapboxMap.getMarkerViewManager()).thenReturn(markerViewManager);
@@ -190,14 +187,13 @@ public class MarkerViewTest {
marker.setMapboxMap(mapboxMap);
marker.setRotation(endRotation);
verify(markerViewManager, times(1)).animateRotationBy(marker, animationValue);
verify(markerViewManager, times(1)).animateRotationBy(marker, 0);
}
@Test
public void testRotationUpdateMin() {
float startRotation = 0;
float endRotation = 359;
float animationValue = -1;
// allow calls to our mock
when(mapboxMap.getMarkerViewManager()).thenReturn(markerViewManager);
@@ -207,7 +203,7 @@ public class MarkerViewTest {
marker.setMapboxMap(mapboxMap);
marker.setRotation(endRotation);
verify(markerViewManager, times(1)).animateRotationBy(marker, animationValue);
verify(markerViewManager, times(1)).animateRotationBy(marker, endRotation);
}
@Test