Add min and max pitch options (#199)

* Add min and max pitch options

* Add min and max pitch into attrs

* Update gl-native submodule
This commit is contained in:
Kevin Li
2020-02-28 18:17:08 +08:00
committed by GitHub
parent 53f5015ca6
commit 17b19b3b4a
13 changed files with 287 additions and 8 deletions

View File

@@ -121,6 +121,20 @@ public class MapboxMapOptionsTest {
assertNotEquals(2.0f, new MapboxMapOptions().maxZoomPreference(5.0f).getMaxZoomPreference(), DELTA);
}
@Test
public void testMinPitch() {
assertEquals(MapboxConstants.MINIMUM_PITCH, new MapboxMapOptions().getMinPitchPreference(), DELTA);
assertEquals(5.0f, new MapboxMapOptions().minPitchPreference(5.0f).getMinPitchPreference(), DELTA);
assertNotEquals(2.0f, new MapboxMapOptions().minPitchPreference(5.0f).getMinPitchPreference(), DELTA);
}
@Test
public void testMaxPitch() {
assertEquals(MapboxConstants.MAXIMUM_PITCH, new MapboxMapOptions().getMaxPitchPreference(), DELTA);
assertEquals(5.0f, new MapboxMapOptions().maxPitchPreference(5.0f).getMaxPitchPreference(), DELTA);
assertNotEquals(2.0f, new MapboxMapOptions().maxPitchPreference(5.0f).getMaxPitchPreference(), DELTA);
}
@Test
public void testTiltGesturesEnabled() {
assertTrue(new MapboxMapOptions().getTiltGesturesEnabled());

View File

@@ -113,6 +113,18 @@ class MapboxMapTest {
verify { transform.maxZoom = 10.0 }
}
@Test
fun testMinPitch() {
mapboxMap.setMinPitchPreference(10.0)
verify { transform.minPitch = 10.0 }
}
@Test
fun testMaxPitch() {
mapboxMap.setMaxPitchPreference(10.0)
verify { transform.maxPitch = 10.0 }
}
@Test
fun testFpsListener() {
val fpsChangedListener = mockk<MapboxMap.OnFpsChangedListener>()

View File

@@ -30,6 +30,8 @@ class TransformTest {
every { nativeMapView.flyTo(any(), any(), any(), any(), any(), any()) } answers {}
every { nativeMapView.minZoom = any() } answers {}
every { nativeMapView.maxZoom = any() } answers {}
every { nativeMapView.minPitch = any() } answers {}
every { nativeMapView.maxPitch = any() } answers {}
}
@Test
@@ -157,6 +159,18 @@ class TransformTest {
verify { nativeMapView.maxZoom = 10.0 }
}
@Test
fun testMinPitch() {
transform.minPitch = 10.0
verify { nativeMapView.minPitch = 10.0 }
}
@Test
fun testMaxPitch() {
transform.maxPitch = 10.0
verify { nativeMapView.maxPitch = 10.0 }
}
@Test
fun testCancelNotInvokedFromOnFinish() {
val slot = slot<MapView.OnCameraDidChangeListener>()