blob: 926212afc80c863f37743f4bef4f1414164fe05a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
package com.mapbox.mapboxsdk.testapp.action;
import android.support.annotation.NonNull;
import android.support.test.espresso.UiController;
import android.support.test.espresso.ViewAction;
import android.view.View;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import org.hamcrest.Matcher;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
public class MapboxMapAction implements ViewAction {
private OnInvokeActionListener invokeViewAction;
private MapboxMap mapboxMap;
public MapboxMapAction(OnInvokeActionListener invokeViewAction, MapboxMap mapboxMap) {
this.invokeViewAction = invokeViewAction;
this.mapboxMap = mapboxMap;
}
@Override
public Matcher<View> getConstraints() {
return isDisplayed();
}
@Override
public String getDescription() {
return getClass().getSimpleName();
}
@Override
public void perform(UiController uiController, View view) {
invokeViewAction.onInvokeAction(uiController, mapboxMap);
}
public static void invoke(MapboxMap mapboxMap, OnInvokeActionListener invokeViewAction) {
onView(withId(android.R.id.content)).perform(new MapboxMapAction(invokeViewAction, mapboxMap));
}
public interface OnInvokeActionListener {
void onInvokeAction(@NonNull UiController uiController, @NonNull MapboxMap mapboxMap);
}
}
|