diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-05-13 17:37:39 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2019-05-13 19:57:04 +0200 |
commit | d2dd3cc2c875f52d2bb797a5f842f6f6fb3c769a (patch) | |
tree | 40a49321562d611221bf49612cc66b99ccb00cc7 | |
parent | 615c5387fccf28c0d54fb71475f7a878318e1413 (diff) | |
download | qtlocation-mapboxgl-d2dd3cc2c875f52d2bb797a5f842f6f6fb3c769a.tar.gz |
[android] split image missing test
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt index ff862b6636..d836185fc4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/ImageMissingTest.kt @@ -7,6 +7,7 @@ import com.mapbox.mapboxsdk.maps.Style import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity import junit.framework.Assert.assertEquals +import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -22,7 +23,12 @@ class ImageMissingTest { var rule = ActivityTestRule(EspressoTestActivity::class.java) private lateinit var mapView: MapView - private val latch = CountDownLatch(2) + private lateinit var latch: CountDownLatch + + @Before + fun setup() { + latch = CountDownLatch(1) + } @Test fun testMissingImage() { @@ -33,6 +39,13 @@ class ImageMissingTest { } } + if (!latch.await(5, TimeUnit.SECONDS)) { + throw TimeoutException() + } + } + + @Test + fun testMissingImage_invalidSprite() { rule.runOnUiThread { initMap(styleJsonInvalidSprite).addOnStyleImageMissingListener { assertEquals("missing-icon", it) @@ -40,12 +53,12 @@ class ImageMissingTest { } } - if(!latch.await(5, TimeUnit.SECONDS)){ + if (!latch.await(5, TimeUnit.SECONDS)) { throw TimeoutException() } } - private fun initMap(style :String): MapView { + private fun initMap(style: String): MapView { mapView = rule.activity.findViewById(R.id.mapView) mapView.getMapAsync { it.setStyle(Style.Builder().fromJson(style)) } return mapView @@ -99,7 +112,7 @@ class ImageMissingTest { { "version": 8, "name": "Mapbox Streets", - "sprite": "mapbox://sprites/mapbox/invalid", + "sprite": "asset://sprites/mapbox/invalid", "glyphs": "mapbox://fonts/mapbox/{fontstack}/{range}.pbf", "sources": { "point": { |