summaryrefslogtreecommitdiff
path: root/platform/android
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-06-01 17:03:45 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-06-01 18:14:19 +0300
commit9068c90fc4b1b8b4938d89028fc3f7b46beeac29 (patch)
treea1b9cfd590b977d07f1784ec8fa3e14b149e6087 /platform/android
parent99cfbacdfba642e042132660b0201db0984b6d22 (diff)
downloadqtlocation-mapboxgl-9068c90fc4b1b8b4938d89028fc3f7b46beeac29.tar.gz
[android] fix crash in runtime style ui tests
Diffstat (limited to 'platform/android')
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java49
1 files changed, 37 insertions, 12 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 a37615aadc..f1e2a6c418 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
@@ -199,29 +199,54 @@ public class RuntimeStyleTests extends BaseActivityTest {
public void testVectorSourceUrlGetter() {
validateTestSetup();
- VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.addSource(source);
- assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
+ onView(withId(R.id.mapView)).perform(new BaseViewAction() {
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
+ mapboxMap.addSource(source);
+ assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
+ }
+
+ });
}
@Test
public void testRasterSourceUrlGetter() {
validateTestSetup();
- RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
- mapboxMap.addSource(source);
- assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
+ onView(withId(R.id.mapView)).perform(new BaseViewAction() {
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
+ mapboxMap.addSource(source);
+ assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
+ }
+
+ });
}
@Test
- public void testGeoJsonSourceUrlGetter() throws MalformedURLException {
+ public void testGeoJsonSourceUrlGetter() {
validateTestSetup();
- GeoJsonSource source = new GeoJsonSource("my-source");
- mapboxMap.addSource(source);
- assertNull(source.getUrl());
- source.setUrl(new URL("http://mapbox.com/my-file.json"));
- assertEquals("http://mapbox.com/my-file.json", source.getUrl());
+ onView(withId(R.id.mapView)).perform(new BaseViewAction() {
+
+ @Override
+ public void perform(UiController uiController, View view) {
+ GeoJsonSource source = new GeoJsonSource("my-source");
+ mapboxMap.addSource(source);
+ assertNull(source.getUrl());
+ try {
+ source.setUrl(new URL("http://mapbox.com/my-file.json"));
+ } catch (MalformedURLException err) {
+ assertTrue(err.getMessage(), false);
+ }
+ assertEquals("http://mapbox.com/my-file.json", source.getUrl());
+ }
+
+ });
}
@Test