diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2018-09-03 21:51:43 +0200 |
---|---|---|
committer | Łukasz Paczos <lukasz.paczos@mapbox.com> | 2018-09-12 13:59:11 +0200 |
commit | 465316b4cef4b0d4630d855a789f5b6acef2084e (patch) | |
tree | c101b9386531ed47463127f4ae0ecba7d5ea6621 /platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt | |
parent | cb771f6aca2ef3cd0d1bf686139e18ce7cc0e233 (diff) | |
download | qtlocation-mapboxgl-465316b4cef4b0d4630d855a789f5b6acef2084e.tar.gz |
[android] adapt LocationLayerPlugin's test suite
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt new file mode 100644 index 0000000000..af2c9adf35 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/plugins/utils/LocationLayerPluginAction.kt @@ -0,0 +1,40 @@ +package com.mapbox.mapboxsdk.plugins.utils + +import android.content.Context +import android.support.test.espresso.UiController +import android.support.test.espresso.ViewAction +import android.support.test.espresso.matcher.ViewMatchers.isDisplayed +import android.view.View +import com.mapbox.mapboxsdk.maps.MapboxMap +import com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerPlugin +import org.hamcrest.Matcher + +class LocationLayerPluginAction(private val mapboxMap: MapboxMap, + private val onPerformLocationLayerPluginAction: OnPerformLocationLayerPluginAction) : ViewAction { + + override fun getConstraints(): Matcher<View> { + return isDisplayed() + } + + override fun getDescription(): String { + return javaClass.simpleName + } + + override fun perform(uiController: UiController, view: View) { + val plugin = mapboxMap.locationLayerPlugin + + while (mapboxMap.getSource("mapbox-location-source") == null) { + uiController.loopMainThreadForAtLeast(MapboxTestingUtils.MAP_RENDER_DELAY) + } + + onPerformLocationLayerPluginAction.onLocationLayerPluginAction( + plugin, + mapboxMap, + uiController, + view.context) + } + + interface OnPerformLocationLayerPluginAction { + fun onLocationLayerPluginAction(plugin: LocationLayerPlugin, mapboxMap: MapboxMap, uiController: UiController, context: Context) + } +}
\ No newline at end of file |