diff options
author | Ivo van Dongen <info@ivovandongen.nl> | 2017-02-08 13:46:21 +0200 |
---|---|---|
committer | Ivo van Dongen <ivovandongen@users.noreply.github.com> | 2017-02-08 15:15:13 +0200 |
commit | 343d161ac1735992a94539794ed4da7d7a6cfd0f (patch) | |
tree | 278799d907a1fb1188246a12767ca6e5b7067398 | |
parent | 74eb8b360904be0c1d1818d0bf94a03fb0e8a687 (diff) | |
download | qtlocation-mapboxgl-343d161ac1735992a94539794ed4da7d7a6cfd0f.tar.gz |
[android] fix reference table overflow in query rendered features
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java | 56 | ||||
-rw-r--r-- | platform/android/src/conversion/collection.hpp | 1 |
2 files changed, 37 insertions, 20 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java index a034457944..a07ad924d5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; +import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; @@ -77,17 +78,28 @@ public class RuntimeStyleTests { onView(withId(R.id.mapView)).perform(new AddRemoveSourceAction()); } - private class AddRemoveLayerAction implements ViewAction { + /** + * https://github.com/mapbox/mapbox-gl-native/issues/7973 + */ + @Test + public void testQueryRenderedFeaturesInputHandling() { + ViewUtils.checkViewIsDisplayed(R.id.mapView); + onView(withId(R.id.mapView)).perform(new BaseViewAction() { + + @Override + public void perform(UiController uiController, View view) { + MapboxMap mapboxMap = rule.getActivity().getMapboxMap(); + String[] layerIds = new String[600]; + for (int i = 0; i < layerIds.length; i++) { + layerIds[i] = "layer-" + i; + } + mapboxMap.queryRenderedFeatures(new PointF(100, 100), layerIds); + } - @Override - public Matcher<View> getConstraints() { - return isDisplayed(); - } + }); + } - @Override - public String getDescription() { - return getClass().getSimpleName(); - } + private class AddRemoveLayerAction extends BaseViewAction { @Override public void perform(UiController uiController, View view) { @@ -139,17 +151,7 @@ public class RuntimeStyleTests { } } - private class AddRemoveSourceAction implements ViewAction { - - @Override - public Matcher<View> getConstraints() { - return isDisplayed(); - } - - @Override - public String getDescription() { - return getClass().getSimpleName(); - } + private class AddRemoveSourceAction extends BaseViewAction { @Override public void perform(UiController uiController, View view) { @@ -198,4 +200,18 @@ public class RuntimeStyleTests { public void unregisterIntentServiceIdlingResource() { Espresso.unregisterIdlingResources(idlingResource); } + + public abstract class BaseViewAction implements ViewAction { + + @Override + public Matcher<View> getConstraints() { + return isDisplayed(); + } + + @Override + public String getDescription() { + return getClass().getSimpleName(); + } + + } } diff --git a/platform/android/src/conversion/collection.hpp b/platform/android/src/conversion/collection.hpp index 4256d5f969..0f67c685f4 100644 --- a/platform/android/src/conversion/collection.hpp +++ b/platform/android/src/conversion/collection.hpp @@ -32,6 +32,7 @@ inline std::vector<std::string> toVector(JNIEnv& env, jni::jarray<jni::jobject>& for (std::size_t i = 0; i < len; i++) { jni::jstring* jstr = reinterpret_cast<jni::jstring*>(jni::GetObjectArrayElement(env, array, i)); vector.push_back(*convert<std::string, jni::String>(env, jni::String(jstr))); + jni::DeleteLocalRef(env, jstr); } return vector; |