[android] remove layer at index

This commit is contained in:
Ivo van Dongen
2017-02-24 18:19:04 +02:00
committed by Ivo van Dongen
parent dc21396d71
commit a9d2929819
5 changed files with 75 additions and 2 deletions

View File

@@ -35,6 +35,8 @@ import org.junit.runner.RunWith;
import java.util.List;
import timber.log.Timber;
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;
@@ -122,6 +124,29 @@ public class RuntimeStyleTests {
});
}
@Test
public void testRemoveLayerAt() {
ViewUtils.checkViewIsDisplayed(R.id.mapView);
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
@Override
public void perform(UiController uiController, View view) {
MapboxMap mapboxMap = rule.getActivity().getMapboxMap();
// Remove by index
Layer firstLayer = mapboxMap.getLayers().get(0);
Layer removed = mapboxMap.removeLayerAt(0);
assertNotNull(removed);
assertNotNull(removed.getId());
assertEquals(firstLayer.getId(), removed.getId());
// Test remove by index bounds checks
Timber.i("Remove layer at index > size");
assertNull(mapboxMap.removeLayerAt(Integer.MAX_VALUE));
}
});
}
@Test
public void testListSources() {
ViewUtils.checkViewIsDisplayed(R.id.mapView);