[android] throw an exception if the component is accessed before the activation

This commit is contained in:
Łukasz Paczos
2019-03-08 14:06:36 +01:00
committed by Łukasz Paczos
parent 278347548d
commit 5ccc5b7c36
3 changed files with 50 additions and 4 deletions

View File

@@ -594,15 +594,20 @@ class LocationComponentTest : EspressoTest() {
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap,
style: Style, uiController: UiController, context: Context) {
assertThat(component.isLocationComponentEnabled, `is`(false))
component.onStop()
component.onStart()
assertThat(component.isLocationComponentEnabled, `is`(false))
component.activateLocationComponent(LocationComponentActivationOptions
.builder(context, style)
.useDefaultLocationEngine(false)
.build())
assertThat(component.isLocationComponentEnabled, `is`(false))
component.onStop()
component.onStart()
assertThat(component.isLocationComponentEnabled, `is`(false))
component.isLocationComponentEnabled = true
assertThat(component.isLocationComponentEnabled, `is`(true))
}