Add test case of the getColor method of MultiColorTrackPath when use dynamic speed track path descriptor.

This commit is contained in:
youtaol
2012-12-10 18:34:32 +08:00
parent 1a73df6edc
commit be0a067cf0
2 changed files with 73 additions and 1 deletions
@@ -20,6 +20,7 @@ import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Polyline;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
import android.content.Context;
@@ -102,7 +103,8 @@ public class MultiColorTrackPath implements TrackPath {
TrackPathUtils.addPath(googleMap, paths, lastSegmentPoints, lastSegmentColor, useLastPolyline);
}
private int getColor(int speed) {
@VisibleForTesting
protected int getColor(int speed) {
if (speed <= trackPathDescriptor.getSlowSpeed()) {
return slowColor;
} else if (speed <= trackPathDescriptor.getNormalSpeed()) {
@@ -111,4 +113,16 @@ public class MultiColorTrackPath implements TrackPath {
return fastColor;
}
}
public int getSlowColor() {
return slowColor;
}
public int getNormalColor() {
return normalColor;
}
public int getFastColor() {
return fastColor;
}
}