summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2016-04-08 11:25:50 +0200
committerTobrun <tobrun@mapbox.com>2016-04-08 11:25:50 +0200
commit35b579fde196ec3dd2a487ab5d528c8662571a43 (patch)
treefd2eb7aa095acbc00d3e31306cd320a36efb1233
parent18495fc19d4d6224b3d59db18f22305de533a368 (diff)
downloadqtlocation-mapboxgl-35b579fde196ec3dd2a487ab5d528c8662571a43.tar.gz
[android] #4635 - fix rotate disabled with location tracking
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java17
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java68
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java138
4 files changed, 189 insertions, 38 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
index 80d9a06890..752ba01fac 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/constants/MapboxConstants.java
@@ -71,9 +71,13 @@ public class MapboxConstants {
public static final String STATE_HAS_SAVED_STATE = "savedState";
public static final String STATE_CAMERA_POSITION = "cameraPosition";
public static final String STATE_ZOOM_ENABLED = "zoomEnabled";
+ public static final String STATE_ZOOM_ENABLED_CHANGE = "zoomEnabledChange";
public static final String STATE_SCROLL_ENABLED = "scrollEnabled";
+ public static final String STATE_SCROLL_ENABLED_CHANGE = "scrollEnabledChange";
public static final String STATE_ROTATE_ENABLED = "rotateEnabled";
+ public static final String STATE_ROTATE_ENABLED_CHANGE = "rotateEnabledChange";
public static final String STATE_TILT_ENABLED = "tiltEnabled";
+ public static final String STATE_TILT_ENABLED_CHANGE = "tiltEnabledChange";
public static final String STATE_ZOOM_CONTROLS_ENABLED = "zoomControlsEnabled";
public static final String STATE_DEBUG_ACTIVE = "debugActive";
public static final String STATE_STYLE_URL = "styleUrl";
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
index e0d444d79a..abe0bdc317 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java
@@ -262,10 +262,19 @@ public class MapView extends FrameLayout {
// Enable gestures
UiSettings uiSettings = mMapboxMap.getUiSettings();
+
uiSettings.setZoomGesturesEnabled(options.getZoomGesturesEnabled());
+ uiSettings.setZoomGestureChangeAllowed(options.getZoomGesturesEnabled());
+
uiSettings.setScrollGesturesEnabled(options.getScrollGesturesEnabled());
+ uiSettings.setScrollGestureChangeAllowed(options.getScrollGesturesEnabled());
+
uiSettings.setRotateGesturesEnabled(options.getRotateGesturesEnabled());
+ uiSettings.setRotateGestureChangeAllowed(options.getRotateGesturesEnabled());
+
uiSettings.setTiltGesturesEnabled(options.getTiltGesturesEnabled());
+ uiSettings.setTiltGestureChangeAllowed(options.getTiltGesturesEnabled());
+
uiSettings.setZoomControlsEnabled(options.getZoomControlsEnabled());
// Zoom
@@ -338,9 +347,13 @@ public class MapView extends FrameLayout {
UiSettings uiSettings = mMapboxMap.getUiSettings();
uiSettings.setZoomGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED));
+ uiSettings.setZoomGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE));
uiSettings.setScrollGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED));
+ uiSettings.setScrollGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE));
uiSettings.setRotateGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED));
+ uiSettings.setRotateGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE));
uiSettings.setTiltGesturesEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED));
+ uiSettings.setTiltGestureChangeAllowed(savedInstanceState.getBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE));
uiSettings.setZoomControlsEnabled(savedInstanceState.getBoolean(MapboxConstants.STATE_ZOOM_CONTROLS_ENABLED));
// Compass
@@ -451,9 +464,13 @@ public class MapView extends FrameLayout {
// UiSettings
UiSettings uiSettings = mMapboxMap.getUiSettings();
outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED, uiSettings.isZoomGesturesEnabled());
+ outState.putBoolean(MapboxConstants.STATE_ZOOM_ENABLED_CHANGE, uiSettings.isZoomGestureChangeAllowed());
outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED, uiSettings.isScrollGesturesEnabled());
+ outState.putBoolean(MapboxConstants.STATE_SCROLL_ENABLED_CHANGE,uiSettings.isScrollGestureChangeAllowed());
outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED, uiSettings.isRotateGesturesEnabled());
+ outState.putBoolean(MapboxConstants.STATE_ROTATE_ENABLED_CHANGE,uiSettings.isRotateGestureChangeAllowed());
outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED, uiSettings.isTiltGesturesEnabled());
+ outState.putBoolean(MapboxConstants.STATE_TILT_ENABLED_CHANGE,uiSettings.isTiltGestureChangeAllowed());
outState.putBoolean(MapboxConstants.STATE_ZOOM_CONTROLS_ENABLED, uiSettings.isZoomControlsEnabled());
// UiSettings - Compass
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
index f87ddb4ca1..44f113e70e 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/UiSettings.java
@@ -1,14 +1,10 @@
package com.mapbox.mapboxsdk.maps;
-import android.support.annotation.FloatRange;
import android.support.annotation.NonNull;
import android.support.annotation.UiThread;
-import android.util.Log;
import android.view.Gravity;
import android.view.View;
-import com.mapbox.mapboxsdk.constants.MapboxConstants;
-
/**
* Settings for the user interface of a MapboxMap. To obtain this interface, call getUiSettings().
*/
@@ -20,11 +16,19 @@ public class UiSettings {
private ViewSettings logoSettings;
private ViewSettings attributionSettings;
- private boolean rotateGesturesEnabled;
- private boolean tiltGesturesEnabled;
- private boolean zoomGesturesEnabled;
+ private boolean rotateGesturesEnabled = true;
+ private boolean rotateGestureChangeAllowed = true;
+
+ private boolean tiltGesturesEnabled = true;
+ private boolean tiltGestureChangeAllowed = true;
+
+ private boolean zoomGesturesEnabled = true;
+ private boolean zoomGestureChangeAllowed = true;
+
+ private boolean scrollGesturesEnabled = true;
+ private boolean scrollGestureChangeAllowed = true;
+
private boolean zoomControlsEnabled;
- private boolean scrollGesturesEnabled;
UiSettings(@NonNull MapView mapView) {
this.mapView = mapView;
@@ -339,7 +343,9 @@ public class UiSettings {
* @param rotateGesturesEnabled If true, rotating is enabled.
*/
public void setRotateGesturesEnabled(boolean rotateGesturesEnabled) {
- this.rotateGesturesEnabled = rotateGesturesEnabled;
+ if (rotateGestureChangeAllowed) {
+ this.rotateGesturesEnabled = rotateGesturesEnabled;
+ }
}
/**
@@ -351,6 +357,14 @@ public class UiSettings {
return rotateGesturesEnabled;
}
+ void setRotateGestureChangeAllowed(boolean rotateGestureChangeAllowed) {
+ this.rotateGestureChangeAllowed = rotateGestureChangeAllowed;
+ }
+
+ boolean isRotateGestureChangeAllowed() {
+ return rotateGestureChangeAllowed;
+ }
+
/**
* <p>
* Changes whether the user may tilt the map.
@@ -364,7 +378,9 @@ public class UiSettings {
* @param tiltGesturesEnabled If true, tilting is enabled.
*/
public void setTiltGesturesEnabled(boolean tiltGesturesEnabled) {
- this.tiltGesturesEnabled = tiltGesturesEnabled;
+ if (tiltGestureChangeAllowed) {
+ this.tiltGesturesEnabled = tiltGesturesEnabled;
+ }
}
/**
@@ -376,6 +392,14 @@ public class UiSettings {
return tiltGesturesEnabled;
}
+ void setTiltGestureChangeAllowed(boolean tiltGestureChangeAllowed) {
+ this.tiltGestureChangeAllowed = tiltGestureChangeAllowed;
+ }
+
+ boolean isTiltGestureChangeAllowed() {
+ return tiltGestureChangeAllowed;
+ }
+
/**
* <p>
* Changes whether the user may zoom the map.
@@ -389,7 +413,9 @@ public class UiSettings {
* @param zoomGesturesEnabled If true, zooming is enabled.
*/
public void setZoomGesturesEnabled(boolean zoomGesturesEnabled) {
- this.zoomGesturesEnabled = zoomGesturesEnabled;
+ if (zoomGestureChangeAllowed) {
+ this.zoomGesturesEnabled = zoomGesturesEnabled;
+ }
}
/**
@@ -401,6 +427,14 @@ public class UiSettings {
return zoomGesturesEnabled;
}
+ void setZoomGestureChangeAllowed(boolean zoomGestureChangeAllowed) {
+ this.zoomGestureChangeAllowed = zoomGestureChangeAllowed;
+ }
+
+ boolean isZoomGestureChangeAllowed() {
+ return zoomGestureChangeAllowed;
+ }
+
/**
* <p>
* Sets whether the zoom controls are enabled.
@@ -439,7 +473,9 @@ public class UiSettings {
* @param scrollGesturesEnabled If true, scrolling is enabled.
*/
public void setScrollGesturesEnabled(boolean scrollGesturesEnabled) {
- this.scrollGesturesEnabled = scrollGesturesEnabled;
+ if (scrollGestureChangeAllowed) {
+ this.scrollGesturesEnabled = scrollGesturesEnabled;
+ }
}
/**
@@ -451,6 +487,14 @@ public class UiSettings {
return scrollGesturesEnabled;
}
+ void setScrollGestureChangeAllowed(boolean scrollGestureChangeAllowed) {
+ this.scrollGestureChangeAllowed = scrollGestureChangeAllowed;
+ }
+
+ boolean isScrollGestureChangeAllowed() {
+ return scrollGestureChangeAllowed;
+ }
+
/**
* <p>
* Sets the preference for whether all gestures should be enabled or disabled.
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java
index 4af44a3f49..300ed1d73a 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/UiSettingsTest.java
@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.maps;
import android.view.Gravity;
+import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -9,42 +10,45 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
public class UiSettingsTest {
@InjectMocks
MapView mMapView = mock(MapView.class);
+ UiSettings uiSettings;
+
+ @Before
+ public void beforeTest() {
+ uiSettings = new UiSettings(mMapView);
+ }
+
@Test
public void testSanity() {
- UiSettings uiSettings = new UiSettings(mMapView);
assertNotNull("uiSettings should not be null", uiSettings);
}
@Test
public void testCompassEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setCompassEnabled(true);
assertEquals("Compass should be enabled", true, uiSettings.isCompassEnabled());
}
@Test
public void testCompassDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setCompassEnabled(false);
assertEquals("Compass should be disabled", false, uiSettings.isCompassEnabled());
}
@Test
public void testCompassGravity() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setCompassGravity(Gravity.LEFT);
assertEquals("Compass gravity should be same", Gravity.LEFT, uiSettings.getCompassGravity());
}
@Test
public void testCompassMargins() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setCompassMargins(1, 2, 3, 4);
assertTrue("Compass margin left should be same", uiSettings.getCompassMarginLeft() == 1);
assertTrue("Compass margin top should be same", uiSettings.getCompassMarginTop() == 2);
@@ -54,28 +58,24 @@ public class UiSettingsTest {
@Test
public void testLogoEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setLogoEnabled(true);
assertEquals("Logo should be enabled", true, uiSettings.isLogoEnabled());
}
@Test
public void testLogoDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setLogoEnabled(false);
assertEquals("Logo should be disabled", false, uiSettings.isLogoEnabled());
}
@Test
public void testLogoGravity() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setLogoGravity(Gravity.RIGHT);
assertEquals("Logo gravity should be same", Gravity.RIGHT, uiSettings.getLogoGravity());
}
@Test
public void testLogoMargins() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setLogoMargins(1, 2, 3, 4);
assertTrue("Compass margin left should be same", uiSettings.getLogoMarginLeft() == 1);
assertTrue("Compass margin top should be same", uiSettings.getLogoMarginTop() == 2);
@@ -85,28 +85,24 @@ public class UiSettingsTest {
@Test
public void testAttributionEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAttributionEnabled(true);
assertEquals("Attribution should be enabled", true, uiSettings.isAttributionEnabled());
}
@Test
public void testAttributionDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAttributionEnabled(false);
assertEquals("Attribution should be disabled", false, uiSettings.isLogoEnabled());
}
@Test
public void testAttributionGravity() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAttributionGravity(Gravity.RIGHT);
assertEquals("Attribution gravity should be same", Gravity.RIGHT, uiSettings.getAttributionGravity());
}
@Test
public void testAttributionMargins() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAttributionMargins(1, 2, 3, 4);
assertTrue("Attribution margin left should be same", uiSettings.getAttributionMarginLeft() == 1);
assertTrue("Attribution margin top should be same", uiSettings.getAttributionMarginTop() == 2);
@@ -116,77 +112,158 @@ public class UiSettingsTest {
@Test
public void testRotateGesturesEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setRotateGesturesEnabled(true);
assertEquals("Rotate gesture should be enabled", true, uiSettings.isRotateGesturesEnabled());
}
@Test
public void testRotateGesturesDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setRotateGesturesEnabled(false);
assertEquals("Rotate gesture should be disabled", false, uiSettings.isRotateGesturesEnabled());
}
@Test
+ public void testRotateGestureChange() {
+ assertEquals("Default state should be true", true, uiSettings.isRotateGestureChangeAllowed());
+ uiSettings.setRotateGestureChangeAllowed(false);
+ assertEquals("State should have been changed", false, uiSettings.isRotateGestureChangeAllowed());
+ }
+
+ @Test
+ public void testRotateGestureChangeAllowed() {
+ uiSettings.setRotateGesturesEnabled(false);
+ assertEquals("Rotate gesture should be false", false, uiSettings.isRotateGesturesEnabled());
+ uiSettings.setRotateGesturesEnabled(true);
+ assertEquals("Rotate gesture should be true", true, uiSettings.isRotateGesturesEnabled());
+ }
+
+ @Test
+ public void testRotateGestureChangeDisallowed() {
+ assertEquals("Rotate gesture should be true", true, uiSettings.isRotateGesturesEnabled());
+ uiSettings.setRotateGestureChangeAllowed(false);
+ uiSettings.setRotateGesturesEnabled(false);
+ assertEquals("Rotate gesture change should be ignored", true, uiSettings.isRotateGesturesEnabled());
+ }
+
+ @Test
public void testTiltGesturesEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setTiltGesturesEnabled(true);
assertEquals("Tilt gesture should be enabled", true, uiSettings.isTiltGesturesEnabled());
}
@Test
public void testTiltGesturesDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setTiltGesturesEnabled(false);
assertEquals("Tilt gesture should be disabled", false, uiSettings.isTiltGesturesEnabled());
}
@Test
+ public void testTiltGestureChange() {
+ assertEquals("Default state should be true", true, uiSettings.isTiltGestureChangeAllowed());
+ uiSettings.setTiltGestureChangeAllowed(false);
+ assertEquals("State should have been changed", false, uiSettings.isTiltGestureChangeAllowed());
+ }
+
+ @Test
+ public void testTiltGestureChangeAllowed() {
+ uiSettings.setTiltGesturesEnabled(false);
+ assertEquals("Tilt gesture should be false", false, uiSettings.isTiltGesturesEnabled());
+ uiSettings.setTiltGesturesEnabled(true);
+ assertEquals("Tilt gesture should be true", true, uiSettings.isTiltGesturesEnabled());
+ }
+
+ @Test
+ public void testTiltGestureChangeDisallowed() {
+ assertEquals("Tilt gesture should be true", true, uiSettings.isTiltGesturesEnabled());
+ uiSettings.setTiltGestureChangeAllowed(false);
+ uiSettings.setTiltGesturesEnabled(false);
+ assertEquals("Tilt gesture change should be ignored", true, uiSettings.isTiltGesturesEnabled());
+ }
+
+ @Test
public void testZoomGesturesEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setZoomGesturesEnabled(true);
assertEquals("Zoom gesture should be enabled", true, uiSettings.isZoomGesturesEnabled());
}
@Test
public void testZoomGesturesDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setZoomGesturesEnabled(false);
assertEquals("Zoom gesture should be disabled", false, uiSettings.isZoomGesturesEnabled());
}
@Test
+ public void testZoomGestureChange() {
+ assertEquals("Default state should be true", true, uiSettings.isZoomGestureChangeAllowed());
+ uiSettings.setZoomGestureChangeAllowed(false);
+ assertEquals("State should have been changed", false, uiSettings.isZoomGestureChangeAllowed());
+ }
+
+ @Test
+ public void testZoomGestureChangeAllowed() {
+ uiSettings.setZoomGesturesEnabled(false);
+ assertEquals("Zoom gesture should be false", false, uiSettings.isZoomGesturesEnabled());
+ uiSettings.setZoomGesturesEnabled(true);
+ assertEquals("Zoom gesture should be true", true, uiSettings.isZoomGesturesEnabled());
+ }
+
+ @Test
+ public void testZoomGestureChangeDisallowed() {
+ assertEquals("Zoom gesture should be true", true, uiSettings.isZoomGesturesEnabled());
+ uiSettings.setZoomGestureChangeAllowed(false);
+ uiSettings.setZoomGesturesEnabled(false);
+ assertEquals("Zooom gesture change should be ignored", true, uiSettings.isZoomGesturesEnabled());
+ }
+
+ @Test
public void testZoomControlsEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setZoomControlsEnabled(true);
assertEquals("Zoom controls should be enabled", true, uiSettings.isZoomControlsEnabled());
}
@Test
public void testZoomControlsDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setZoomControlsEnabled(false);
assertEquals("Zoom controls should be disabled", false, uiSettings.isZoomControlsEnabled());
}
@Test
public void testScrollGesturesEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setScrollGesturesEnabled(true);
assertEquals("Scroll gesture should be enabled", true, uiSettings.isScrollGesturesEnabled());
}
@Test
public void testScrollGesturesDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setScrollGesturesEnabled(false);
assertEquals("Scroll gesture should be disabled", false, uiSettings.isScrollGesturesEnabled());
}
@Test
+ public void testScrollGestureChange() {
+ assertEquals("Default state should be true", true, uiSettings.isScrollGestureChangeAllowed());
+ uiSettings.setScrollGestureChangeAllowed(false);
+ assertEquals("State should have been changed", false, uiSettings.isScrollGestureChangeAllowed());
+ }
+
+ @Test
+ public void testScrollGestureChangeAllowed() {
+ uiSettings.setScrollGesturesEnabled(false);
+ assertEquals("Scroll gesture should be false", false, uiSettings.isScrollGesturesEnabled());
+ uiSettings.setScrollGesturesEnabled(true);
+ assertEquals("Scroll gesture should be true", true, uiSettings.isScrollGesturesEnabled());
+ }
+
+ @Test
+ public void testScrollGestureChangeDisallowed() {
+ assertEquals("Scroll gesture should be true", true, uiSettings.isScrollGesturesEnabled());
+ uiSettings.setScrollGestureChangeAllowed(false);
+ uiSettings.setScrollGesturesEnabled(false);
+ assertEquals("Scroll gesture change should be ignored", true, uiSettings.isScrollGesturesEnabled());
+ }
+
+ @Test
public void testAllGesturesEnabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAllGesturesEnabled(true);
assertEquals("Rotate gesture should be enabled", true, uiSettings.isRotateGesturesEnabled());
assertEquals("Tilt gesture should be enabled", true, uiSettings.isTiltGesturesEnabled());
@@ -196,7 +273,6 @@ public class UiSettingsTest {
@Test
public void testAllGesturesDisabled() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.setAllGesturesEnabled(false);
assertEquals("Rotate gesture should be enabled", false, uiSettings.isRotateGesturesEnabled());
assertEquals("Tilt gesture should be disabled", false, uiSettings.isTiltGesturesEnabled());
@@ -206,8 +282,18 @@ public class UiSettingsTest {
@Test
public void testInvalidate() {
- UiSettings uiSettings = new UiSettings(mMapView);
uiSettings.invalidate();
}
+ @Test
+ public void testHeight() {
+ when(mMapView.getMeasuredHeight()).thenReturn(1);
+ assertEquals("height should be same as mocked instance", 1, uiSettings.getHeight(), 0);
+ }
+
+ @Test
+ public void testWidth() {
+ when(mMapView.getMeasuredWidth()).thenReturn(1);
+ assertEquals("width should be same as mocked instance", 1, uiSettings.getWidth(), 0);
+ }
} \ No newline at end of file