[android] Expose pre-fetching zoom delta. (#15769)

* [android] Expose pre-fetching zoom delta.

* [android] Fix Clang format.

* [android] Add MapboxMap unit test.

* [android] Add prefetching zoom delta into MapboxMapOptions.

* [android] Deprecate setPrefetchesTiles to migrate to setPrefetchZoomDelta.

* [android] Deprecate getPrefetchesTiles() and migrate to setPrefetchZoomDelta().

* [android] Add unit test to NativeMapViewTest.

* [android] Add IntRange annotation to getPrefetchZoomDelta.
This commit is contained in:
Peng Liu
2019-10-08 16:21:46 +03:00
committed by GitHub
parent 4eaaa9046e
commit 7139abdbf5
11 changed files with 262 additions and 96 deletions

View File

@@ -167,6 +167,16 @@ public class MapboxMapOptionsTest {
assertFalse(new MapboxMapOptions().setPrefetchesTiles(false).getPrefetchesTiles());
}
@Test
public void testPrefetchZoomDelta() {
// Default value
assertEquals(4, new MapboxMapOptions().getPrefetchZoomDelta());
// Check mutations
assertEquals(5, new MapboxMapOptions().setPrefetchZoomDelta(5).getPrefetchZoomDelta());
}
@Test
public void testCrossSourceCollisions() {
// Default value

View File

@@ -126,6 +126,18 @@ class MapboxMapTest {
verify { nativeMapView.prefetchTiles = true }
}
@Test
fun testGetPrefetchZoomDelta() {
every { nativeMapView.prefetchZoomDelta } answers { 3 }
assertEquals(3, mapboxMap.prefetchZoomDelta)
}
@Test
fun testSetPrefetchZoomDelta() {
mapboxMap.prefetchZoomDelta = 2
verify { nativeMapView.prefetchZoomDelta = 2 }
}
@Test
fun testCameraForLatLngBounds() {
val bounds = LatLngBounds.Builder().include(LatLng()).include(LatLng(1.0, 1.0)).build()