[android] copy features array before passing them to core
This commit is contained in:
@@ -23,6 +23,8 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import timber.log.Timber;
|
||||
|
||||
@@ -101,6 +103,22 @@ public class GeoJsonSourceTests extends EspressoTest {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClearCollectionDuringConversion() {
|
||||
// https://github.com/mapbox/mapbox-gl-native/issues/14565
|
||||
validateTestSetup();
|
||||
MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
List<Feature> features = new ArrayList<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
features.add(Feature.fromGeometry(Point.fromLngLat(0, 0)));
|
||||
}
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source" + j, FeatureCollection.fromFeatures(features)));
|
||||
features.clear();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPointFeature() {
|
||||
testFeatureFromResource(R.raw.test_point_feature);
|
||||
|
||||
Reference in New Issue
Block a user