[android] #4018 - migrated max/min zoom to UiSettings + added tests + update sample app
This commit is contained in:
@@ -15,6 +15,7 @@ import com.mapbox.mapboxsdk.geometry.LatLng;
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
|
||||
import com.mapbox.mapboxsdk.maps.UiSettings;
|
||||
import com.mapbox.mapboxsdk.utils.ApiAccess;
|
||||
|
||||
public class MaxMinZoomActivity extends AppCompatActivity {
|
||||
@@ -44,8 +45,11 @@ public class MaxMinZoomActivity extends AppCompatActivity {
|
||||
public void onMapReady(@NonNull final MapboxMap mapboxMap) {
|
||||
mMapboxMap = mapboxMap;
|
||||
mMapboxMap.setStyle(Style.SATELLITE_STREETS);
|
||||
mMapboxMap.setMinZoom(3);
|
||||
mMapboxMap.setMaxZoom(5);
|
||||
|
||||
UiSettings uiSettings = mapboxMap.getUiSettings();
|
||||
uiSettings.setMinZoom(3);
|
||||
uiSettings.setMaxZoom(5);
|
||||
|
||||
mMapboxMap.moveCamera(CameraUpdateFactory.newLatLng(new LatLng(-1.063510, 32.895425)));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -21,6 +21,30 @@ public class UiSettingsTest {
|
||||
assertNotNull("uiSettings should not be null", uiSettings);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinZoom() {
|
||||
double zoom = 10;
|
||||
UiSettings uiSettings = new UiSettings(mMapView);
|
||||
uiSettings.setMinZoom(zoom);
|
||||
assertEquals("MinZoom should match", zoom, uiSettings.getMinZoom(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaxZoom() {
|
||||
double zoom = 10;
|
||||
UiSettings uiSettings = new UiSettings(mMapView);
|
||||
uiSettings.setMaxZoom(zoom);
|
||||
assertEquals("MaxZoom should match", zoom, uiSettings.getMaxZoom(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitialZoomLevels() {
|
||||
//we are mocking MapView we expect a value of 0 to be returned
|
||||
UiSettings uiSettings = new UiSettings(mMapView);
|
||||
assertEquals("MaxZoom should match", 0, uiSettings.getMaxZoom(), 0);
|
||||
assertEquals("MinZoom should match", 0, uiSettings.getMinZoom(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCompassEnabled() {
|
||||
UiSettings uiSettings = new UiSettings(mMapView);
|
||||
@@ -204,7 +228,6 @@ public class UiSettingsTest {
|
||||
assertEquals("Scroll gesture should be disabled", false, uiSettings.isScrollGesturesEnabled());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInvalidate() {
|
||||
UiSettings uiSettings = new UiSettings(mMapView);
|
||||
|
||||
Reference in New Issue
Block a user