[android] test remove source in use

This commit is contained in:
Ivo van Dongen
2017-05-30 11:20:45 +03:00
committed by Ivo van Dongen
parent 005dc6d122
commit 5d956d81cc

View File

@@ -12,6 +12,7 @@ import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.layers.LineLayer;
import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
import com.mapbox.mapboxsdk.style.sources.CannotAddSourceException;
@@ -223,6 +224,23 @@ public class RuntimeStyleTests extends BaseActivityTest {
assertEquals("http://mapbox.com/my-file.json", source.getUrl());
}
@Test
public void testRemoveSourceInUse() {
validateTestSetup();
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
mapboxMap.addLayer(new LineLayer("my-layer", "my-source"));
mapboxMap.removeSource("my-source");
assertNotNull(mapboxMap.getSource("my-source"));
}
});
}
/**
* https://github.com/mapbox/mapbox-gl-native/issues/7973
*/