[android] - optimise loaded style for location component, expose isFullyLoaded
This commit is contained in:
@@ -153,7 +153,7 @@ class LocationComponentTest : BaseActivityTest() {
|
||||
executeComponentTest(componentAction)
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(expected = IllegalStateException::class)
|
||||
fun settingMapStyleImmediatelyBeforeLoadingComponent_doesStillLoadLayersProperly() {
|
||||
validateTestSetup()
|
||||
val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction {
|
||||
|
||||
@@ -48,6 +48,15 @@ fun MapboxMap.waitForLayer(uiController: UiController, location: Location, layer
|
||||
}
|
||||
}
|
||||
|
||||
fun MapboxMap.waitForStyle(uiController: UiController, mapboxMap: MapboxMap) {
|
||||
var counter = 0
|
||||
val delay = MapboxTestingUtils.MAP_RENDER_DELAY
|
||||
while ((mapboxMap.style == null && !mapboxMap.style?.isFullyLoaded!!) && delay * counter < MapboxTestingUtils.RENDER_TIMEOUT) {
|
||||
uiController.loopMainThreadForAtLeast(delay)
|
||||
counter++
|
||||
}
|
||||
}
|
||||
|
||||
inline fun waitForRenderResult(uiController: UiController, checkFunction: () -> Boolean, expectedResult: Boolean) {
|
||||
var counter = 0
|
||||
val delay = MapboxTestingUtils.MAP_RENDER_DELAY
|
||||
@@ -62,7 +71,7 @@ class MapboxTestingUtils {
|
||||
|
||||
const val MAP_RENDER_DELAY = 250L
|
||||
const val MAP_CONNECTION_DELAY = 1000L
|
||||
const val RENDER_TIMEOUT = 2_500L
|
||||
const val RENDER_TIMEOUT = 5_500L
|
||||
|
||||
/**
|
||||
* Used to increase style load time for stress testing.
|
||||
|
||||
Reference in New Issue
Block a user