diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-12-07 17:00:36 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-12-10 16:59:50 +0100 |
commit | 8eaff9ce13b1a16bf347d27fde2d9ebfdd8665a4 (patch) | |
tree | e0086b3cb4792720e879feb380e5f0850e6f405f /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt | |
parent | 648f34aadc97df07026b89256afe8ae813baee81 (diff) | |
download | qtlocation-mapboxgl-8eaff9ce13b1a16bf347d27fde2d9ebfdd8665a4.tar.gz |
[android] - make style part of location component activation, add tests for non existing style and multiple style loading, revisit code comments
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt index b8f146f983..12ae701d0a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt @@ -75,7 +75,7 @@ class LocationLayerControllerTest : 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.NORMAL uiController.loopMainThreadForAtLeast(MAP_RENDER_DELAY) @@ -94,7 +94,7 @@ class LocationLayerControllerTest : 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.NORMAL component.forceLocationUpdate(location) @@ -114,7 +114,7 @@ class LocationLayerControllerTest : 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.COMPASS component.forceLocationUpdate(location) @@ -134,7 +134,7 @@ class LocationLayerControllerTest : 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 component.forceLocationUpdate(location) @@ -154,7 +154,7 @@ class LocationLayerControllerTest : 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) @@ -183,7 +183,7 @@ class LocationLayerControllerTest : 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.NORMAL component.forceLocationUpdate(location) @@ -207,7 +207,7 @@ class LocationLayerControllerTest : 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.NORMAL component.forceLocationUpdate(location) @@ -239,7 +239,7 @@ class LocationLayerControllerTest : 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.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(100).build()) component.forceLocationUpdate(location) @@ -268,10 +268,10 @@ class LocationLayerControllerTest : 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.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(1).build()) - styleChangeIdlingResource.waitForStyle((rule.activity as SingleActivity).mapView, mapboxMap, MAPBOX_HEAVY_STYLE) + styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE) pushSourceUpdates(styleChangeIdlingResource) { component.forceLocationUpdate(location) } @@ -288,9 +288,10 @@ class LocationLayerControllerTest : 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) + styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE) + uiController.loopMainThreadForAtLeast(100) var show = true - component.activateLocationComponent(context, false) + component.activateLocationComponent(context, mapboxMap.style!!,false) pushSourceUpdates(styleChangeIdlingResource) { component.isLocationComponentEnabled = show show = !show @@ -310,7 +311,7 @@ class LocationLayerControllerTest : 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.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(location), 16.0)) component.forceLocationUpdate(location) @@ -330,7 +331,7 @@ class LocationLayerControllerTest : 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) @@ -364,7 +365,7 @@ class LocationLayerControllerTest : 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) |