summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt114
1 files changed, 73 insertions, 41 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
index 9f756239e1..8362095042 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt
@@ -75,7 +75,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context)
+ component.activateLocationComponent(context, mapboxMap.style!!)
component.isLocationComponentEnabled = true
val locationEngine = component.locationEngine
@@ -96,6 +96,7 @@ class LocationComponentTest : BaseActivityTest() {
uiController: UiController, context: Context) {
component.activateLocationComponent(
context,
+ mapboxMap.style!!,
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
.enableStaleState(false)
@@ -127,6 +128,7 @@ class LocationComponentTest : BaseActivityTest() {
uiController: UiController, context: Context) {
component.activateLocationComponent(
context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
@@ -158,8 +160,9 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
+ val style = mapboxMap.style!!
mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, style,false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
@@ -181,7 +184,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
// Source should be present but empty
@@ -212,6 +215,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
@@ -223,6 +227,7 @@ class LocationComponentTest : BaseActivityTest() {
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
uiController.loopMainThreadForAtLeast(500)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
mapboxMap.querySourceFeatures(LOCATION_SOURCE).also {
it.forEach {
assertThat(it.getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
@@ -241,6 +246,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -264,6 +270,7 @@ class LocationComponentTest : BaseActivityTest() {
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(false))
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
val feature = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0]
assertThat(feature.getStringProperty(PROPERTY_FOREGROUND_ICON), `is`(equalTo("custom-foreground-bitmap")))
assertThat(feature.getStringProperty(PROPERTY_BACKGROUND_ICON), `is`(equalTo("custom-background-bitmap")))
@@ -283,6 +290,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -298,7 +306,7 @@ class LocationComponentTest : BaseActivityTest() {
mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it)
mapboxMap.addImageFromDrawable("custom-gps-bitmap", it)
}
-
+ mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
}
@@ -314,6 +322,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.foregroundName("custom-foreground-bitmap")
@@ -325,12 +334,14 @@ class LocationComponentTest : BaseActivityTest() {
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
component.applyStyle(LocationComponentOptions.builder(context).build())
val renderCheck = {
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON) == FOREGROUND_ICON
}
waitForRenderResult(uiController, renderCheck, true)
@@ -349,6 +360,7 @@ class LocationComponentTest : BaseActivityTest() {
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.gpsName("custom-gps-bitmap")
@@ -359,12 +371,14 @@ class LocationComponentTest : BaseActivityTest() {
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)
assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap")))
component.renderMode = RenderMode.NORMAL
val renderCheck = {
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON) == FOREGROUND_ICON
}
waitForRenderResult(uiController, renderCheck, true)
@@ -382,6 +396,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.staleStateTimeout(200)
@@ -393,6 +408,7 @@ class LocationComponentTest : BaseActivityTest() {
uiController.loopMainThreadForAtLeast(250) // engaging stale state
val renderCheck = {
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE)
}
waitForRenderResult(uiController, renderCheck, true)
@@ -402,6 +418,7 @@ class LocationComponentTest : BaseActivityTest() {
component.onStart()
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true))
assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false))
}
@@ -416,16 +433,19 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
component.onStop()
component.onStart()
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false))
assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true))
}
@@ -443,6 +463,7 @@ class LocationComponentTest : BaseActivityTest() {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
component.activateLocationComponent(context,
+ mapboxMap.style!!,
null,
LocationComponentOptions.builder(context)
.accuracyColor(color)
@@ -453,6 +474,7 @@ class LocationComponentTest : BaseActivityTest() {
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
// Check that the source property changes correctly
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
mapboxMap.querySourceFeatures(LOCATION_SOURCE).also {
it.forEach {
assertThat(it.getStringProperty(PROPERTY_ACCURACY_COLOR), `is`(equalTo(rgbaColor)))
@@ -470,11 +492,12 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
assertThat(component.locationEngine, nullValue())
@@ -491,7 +514,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
@@ -514,7 +537,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
@@ -540,7 +563,7 @@ class LocationComponentTest : BaseActivityTest() {
component.onStop()
component.onStart()
assertThat(component.isLocationComponentEnabled, `is`(false))
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
assertThat(component.isLocationComponentEnabled, `is`(true))
}
@@ -554,7 +577,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
assertThat(component.isLocationComponentEnabled, `is`(true))
component.onStop()
@@ -571,7 +594,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.isLocationComponentEnabled = false
assertThat(component.isLocationComponentEnabled, `is`(false))
@@ -589,7 +612,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.onStop()
@@ -608,7 +631,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
mapboxMap.setStyle(Style.Builder().fromUrl(Style.DARK))
component.onStop()
@@ -625,12 +648,13 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.onStop()
component.forceLocationUpdate(location)
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE).isEmpty(), `is`(true))
}
}
@@ -643,13 +667,15 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.onStop()
component.forceLocationUpdate(location)
component.onStart()
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
+ mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
assertEquals(point.latitude(), location.latitude, 0.1)
assertEquals(point.longitude(), location.longitude, 0.1)
@@ -664,7 +690,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.forceLocationUpdate(location)
mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT))
@@ -673,6 +699,7 @@ class LocationComponentTest : BaseActivityTest() {
component.onStart()
mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point
assertEquals(point.latitude(), location.latitude, 0.1)
assertEquals(point.longitude(), location.longitude, 0.1)
@@ -693,9 +720,9 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
- styleChangeIdlingResource.waitForStyle((rule.activity as SingleActivity).mapView, mapboxMap, MAPBOX_HEAVY_STYLE)
+ styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
val options = LocationComponentOptions.builder(context)
.accuracyColor(Color.RED)
.build()
@@ -719,9 +746,9 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
- styleChangeIdlingResource.waitForStyle((rule.activity as SingleActivity).mapView, mapboxMap, MAPBOX_HEAVY_STYLE)
+ styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
pushSourceUpdates(styleChangeIdlingResource) {
component.forceLocationUpdate(location)
@@ -742,8 +769,9 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- styleChangeIdlingResource.waitForStyle((rule.activity as SingleActivity).mapView, mapboxMap, MAPBOX_HEAVY_STYLE)
- component.activateLocationComponent(context, false)
+ styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE)
+ uiController.loopMainThreadForAtLeast(100)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
val options = LocationComponentOptions.builder(context)
@@ -768,7 +796,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.renderMode = RenderMode.GPS
location.bearing = 77f
@@ -776,11 +804,15 @@ class LocationComponentTest : BaseActivityTest() {
uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS + MAP_RENDER_DELAY)
assertThat(mapboxMap.style, notNullValue())
assertThat(mapboxMap.style?.getSource(LOCATION_SOURCE), notNullValue())
+ mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
assertEquals(77.0, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING) as Double, 0.1)
location.bearing = 92f
component.forceLocationUpdate(location)
uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS + MAP_RENDER_DELAY) // Waiting for the animation to finish
+ mapboxMap.waitForSource(uiController, LOCATION_SOURCE)
+ mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER)
assertEquals(92.0, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING) as Double, 0.1)
}
}
@@ -793,7 +825,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING_GPS
location.bearing = 77f
@@ -822,7 +854,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.NONE_GPS
val latitude = mapboxMap.cameraPosition.target.latitude
@@ -854,7 +886,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.NONE
val latitude = mapboxMap.cameraPosition.target.latitude
@@ -887,7 +919,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.cameraMode = CameraMode.NONE
@@ -906,7 +938,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.NONE
val zoom = mapboxMap.cameraPosition.zoom
@@ -925,7 +957,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.zoomWhileTracking(10.0)
@@ -944,7 +976,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.zoomWhileTracking(15.0)
@@ -964,7 +996,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
@@ -987,7 +1019,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.zoomWhileTracking(15.0)
@@ -1007,7 +1039,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.NONE
val tilt = mapboxMap.cameraPosition.tilt
@@ -1026,7 +1058,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.tiltWhileTracking(30.0)
@@ -1045,7 +1077,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.tiltWhileTracking(30.0)
@@ -1065,7 +1097,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
val tilt = mapboxMap.cameraPosition.tilt
@@ -1087,7 +1119,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!,false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING
component.tiltWhileTracking(30.0)
@@ -1107,7 +1139,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
component.cameraMode = CameraMode.TRACKING_GPS
component.forceLocationUpdate(location)
@@ -1131,7 +1163,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
val target = LatLng(51.0, 17.0)
assertTrue(target.distanceTo(LatLng(location)) > LocationComponentConstants.INSTANT_LOCATION_TRANSITION_THRESHOLD)
@@ -1154,7 +1186,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
assertTrue(component.compassEngine is LocationComponentCompassEngine)
}
@@ -1168,7 +1200,7 @@ class LocationComponentTest : BaseActivityTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
uiController: UiController, context: Context) {
- component.activateLocationComponent(context, false)
+ component.activateLocationComponent(context, mapboxMap.style!!, false)
component.isLocationComponentEnabled = true
val engine: CompassEngine = object : CompassEngine {
override fun addCompassListener(compassListener: CompassListener) {