summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLangston Smith <langston.smith@mapbox.com>2019-08-01 23:40:46 -0700
committerlangsmith <langstonlmcs@gmail.com>2019-09-30 18:54:18 -0700
commit256b1f45b4edf95f1ed42786d9296d2cea5a6206 (patch)
tree9f2110b4f0325fb78f3e116a2cbe77cba68274dc
parenta8a8ccd5ff48c50d827a4face97995272e474b69 (diff)
downloadqtlocation-mapboxgl-256b1f45b4edf95f1ed42786d9296d2cea5a6206.tar.gz
[android] test refactoring
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt10
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java40
3 files changed, 42 insertions, 10 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
index dfadd9f0ae..f52f09eba8 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentOptions.java
@@ -1298,7 +1298,7 @@ public class LocationComponentOptions implements Parcelable {
if (locationComponentOptions.layerAbove() != null && locationComponentOptions.layerBelow() != null) {
throw new IllegalArgumentException("You cannot set both layerAbove and layerBelow options."
- + "Choose one or the other.");
+ + " Choose one or the other.");
}
if (locationComponentOptions.pulseEnabled() == null) {
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
index cc9367bd2d..282a138e11 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationAnimatorCoordinatorTest.kt
@@ -40,7 +40,6 @@ class LocationAnimatorCoordinatorTest {
val context: Context = mockk(relaxed = true)
locationComponentOptions = LocationComponentOptions.builder(context)
- .pulsingCircleEnabled(true)
.build()
locationAnimatorCoordinator = LocationAnimatorCoordinator(projection,
@@ -58,8 +57,7 @@ class LocationAnimatorCoordinatorTest {
ANIMATOR_CAMERA_COMPASS_BEARING,
ANIMATOR_LAYER_ACCURACY,
ANIMATOR_ZOOM,
- ANIMATOR_TILT,
- ANIMATOR_PULSING_CIRCLE
+ ANIMATOR_TILT
))
}
@@ -358,12 +356,6 @@ class LocationAnimatorCoordinatorTest {
}
@Test
- fun startPulsingCircle_animatorCreated() {
- locationAnimatorCoordinator.startLocationComponentCirclePulsing(locationComponentOptions)
- assertTrue(locationAnimatorCoordinator.animatorArray[ANIMATOR_PULSING_CIRCLE] != null)
- }
-
- @Test
fun feedNewTiltLevel_animatorValue() {
val tilt = 30.0f
locationAnimatorCoordinator.feedNewTilt(
diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
index 2660c819d4..13dad70923 100644
--- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationComponentActivationOptionsTest.java
@@ -3,9 +3,11 @@ package com.mapbox.mapboxsdk.location;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
+import android.graphics.Color;
import android.support.annotation.NonNull;
import com.mapbox.mapboxsdk.R;
+import com.mapbox.mapboxsdk.location.modes.PulseMode;
import com.mapbox.mapboxsdk.maps.Style;
import org.junit.Before;
@@ -67,6 +69,44 @@ public class LocationComponentActivationOptionsTest {
}
@Test
+ public void sanityWithDefaultPulsingCircle() throws Exception {
+ when(style.isFullyLoaded()).thenReturn(true);
+
+ LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
+ .accuracyAlpha(0.5f)
+ .pulsingCircleEnabled(true)
+ .build();
+ assertNotNull(locationComponentOptions);
+
+ LocationComponentActivationOptions locationComponentActivationOptions =
+ LocationComponentActivationOptions.builder(context, style)
+ .locationComponentOptions(locationComponentOptions)
+ .useDefaultLocationEngine(true)
+ .build();
+ assertNotNull(locationComponentActivationOptions);
+ }
+
+ @Test
+ public void sanityWithCustomizedPulsingCircle() throws Exception {
+ when(style.isFullyLoaded()).thenReturn(true);
+
+ LocationComponentOptions locationComponentOptions = LocationComponentOptions.builder(context)
+ .accuracyAlpha(0.5f)
+ .pulsingCircleEnabled(true)
+ .pulsingCircleColor(Color.RED)
+ .pulsingCircleInterpolator(PulseMode.LINEAR)
+ .build();
+ assertNotNull(locationComponentOptions);
+
+ LocationComponentActivationOptions locationComponentActivationOptions =
+ LocationComponentActivationOptions.builder(context, style)
+ .locationComponentOptions(locationComponentOptions)
+ .useDefaultLocationEngine(true)
+ .build();
+ assertNotNull(locationComponentActivationOptions);
+ }
+
+ @Test
public void includingBothStyleResAndComponentOptions_causesExceptionToBeThrown() throws Exception {
thrown.expect(IllegalArgumentException.class);