blob: 1ca4f0df874e5fad1e59c63041a353180a6ebbd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
package com.mapbox.mapboxsdk.testapp.utils;
import android.support.test.espresso.UiController;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import static org.junit.Assert.assertFalse;
public class Utils {
private static final long WAIT_TIMEOUT = 5000;
private static final long WAIT_DELAY = 150;
public static void waitForLayer(UiController uiController, MapboxMap mapboxMap, LatLng latLng, String... layerIds) {
int i = 0;
while (mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), layerIds).isEmpty()) {
i++;
assertFalse("Waiting for layer timed out", i * WAIT_DELAY > WAIT_TIMEOUT);
uiController.loopMainThreadForAtLeast(WAIT_DELAY);
}
}
}
|