[android] copy features array before passing them to core

This commit is contained in:
Łukasz Paczos
2019-05-29 19:46:15 +02:00
parent fd33e066a4
commit 7b5d6c15ac
2 changed files with 31 additions and 6 deletions

View File

@@ -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);