[android] do not clear native layers and sources when style is reloading

This prevents unnecessary layers blink when the same components are re-added after the style reload.
This commit is contained in:
Łukasz Paczos
2019-08-28 16:44:02 +02:00
committed by Łukasz Paczos
parent 6998e9a8ed
commit 6a4e431dbe
3 changed files with 1 additions and 21 deletions

View File

@@ -405,22 +405,4 @@ class StyleTest {
Assert.assertEquals("Layer that failed to be added shouldn't be cached", layer1, mapboxMap.style!!.getLayer("layer1"))
}
}
@Test
fun testClearRemovesSourcesFirst() {
val source1 = mockk<GeoJsonSource>(relaxed = true)
every { source1.id } returns "source1"
val layer1 = mockk<SymbolLayer>(relaxed = true)
every { layer1.id } returns "layer1"
val builder = Style.Builder().withLayer(layer1).withSource(source1)
mapboxMap.setStyle(builder)
mapboxMap.notifyStyleLoaded()
mapboxMap.setStyle(Style.MAPBOX_STREETS)
verifyOrder {
nativeMapView.removeLayer(layer1)
nativeMapView.removeSource(source1)
}
}
}