Sha256: 01e5cfcc623dfe1ddb2382d6ab216d36b407d17ee19e66f5a9ad016ba0851004

Contents?: true

Size: 1.34 KB

Versions: 125

Compression:

Stored size: 1.34 KB

Contents

package sh.calaba.instrumentationbackend.actions.map;


import java.util.List;

import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;

import com.google.android.maps.ItemizedOverlay;

/**
 * Allows the test script to retreive a list of markers on {@link ItemizedOverlay}s.
 * The optional arg can be used to require a specific number of markers
 * 
 * @author Nicholas Albion
 */
public class GetMapMarkers implements Action {

    @Override
    public Result execute(String... args) {
        List<String> markers = InstrumentationBackend.solo.getMapMarkerItems();
        
        Result result;
        if( args.length != 0 ) {
        	int expectedNumberOfStops = Integer.parseInt(args[0]);
        
        	if( expectedNumberOfStops != markers.size() ) {
        		result = new Result(false, "Expected " + expectedNumberOfStops + " markers, but found " + markers.size());
        	} else {
        		result = new Result(true);
        	}
        } else {
    		result = new Result(true);
    	}
        
        for (String markerJson : markers) {
//        	Log.i("get_map_markers", markerJson);
			result.addBonusInformation(markerJson);
		}
        return result;
    }

    @Override
    public String key() {
        return "get_map_markers";
    }
}

Version data entries

125 entries across 125 versions & 2 rubygems

Version Path
calabash-android-0.2.16 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java
calabash-android-0.2.15 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java
calabash-android-0.2.14 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java
calabash-android-0.2.13 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java
calabash-android-0.2.12 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map/GetMapMarkers.java