mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-03 18:03:06 +02:00
Merge heads
This commit is contained in:
@@ -25,121 +25,137 @@ import android.location.Location;
|
||||
import android.test.AndroidTestCase;
|
||||
|
||||
/**
|
||||
* Tests for the MyTracks map overlay.
|
||||
* Tests {@link MapOverlay}.
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
* @author Vangelis S.
|
||||
*/
|
||||
public class MapOverlayTest extends AndroidTestCase {
|
||||
private Canvas canvas;
|
||||
private MockMyTracksOverlay myTracksOverlay;
|
||||
private MapView mockView;
|
||||
private MockMyTracksOverlay mockMyTracksOverlay;
|
||||
private MapView mapView;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
canvas = new Canvas();
|
||||
myTracksOverlay = new MockMyTracksOverlay(getContext());
|
||||
mockMyTracksOverlay = new MockMyTracksOverlay(getContext());
|
||||
|
||||
// Enable drawing.
|
||||
myTracksOverlay.setTrackDrawingEnabled(true);
|
||||
mockMyTracksOverlay.setTrackDrawingEnabled(true);
|
||||
|
||||
// Set a TrackPathPainter with a MockPath.
|
||||
myTracksOverlay.setTrackPathPainter(new SingleColorTrackPathPainter(getContext()) {
|
||||
@Override
|
||||
mockMyTracksOverlay.setTrackPathPainter(new SingleColorTrackPathPainter(getContext()) {
|
||||
@Override
|
||||
public Path newPath() {
|
||||
return new MockPath();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mockView = null;
|
||||
|
||||
mapView = null;
|
||||
}
|
||||
|
||||
public void testAddLocation() throws Exception {
|
||||
|
||||
/**
|
||||
* Tests {@link MapOverlay#addLocation(Location)}.
|
||||
*/
|
||||
public void testAddLocation() throws Exception {
|
||||
Location location = new Location("gps");
|
||||
location.setLatitude(10);
|
||||
location.setLongitude(20);
|
||||
myTracksOverlay.addLocation(location);
|
||||
assertEquals(1, myTracksOverlay.getNumLocations());
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
|
||||
mockMyTracksOverlay.addLocation(location);
|
||||
assertEquals(1, mockMyTracksOverlay.getNumLocations());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumWaypoints());
|
||||
|
||||
location.setLatitude(20);
|
||||
location.setLongitude(30);
|
||||
myTracksOverlay.addLocation(location);
|
||||
assertEquals(2, myTracksOverlay.getNumLocations());
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
|
||||
mockMyTracksOverlay.addLocation(location);
|
||||
assertEquals(2, mockMyTracksOverlay.getNumLocations());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertFalse(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
|
||||
// Draw and make sure that we don't lose any point.
|
||||
myTracksOverlay.draw(canvas, mockView, false);
|
||||
assertEquals(2, myTracksOverlay.getNumLocations());
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
assertTrue(myTracksOverlay.getTrackPathPainter().getLastPath() instanceof MockPath);
|
||||
MockPath path = (MockPath) myTracksOverlay.getTrackPathPainter().getLastPath();
|
||||
assertEquals(2, path.totalPoints);
|
||||
|
||||
myTracksOverlay.draw(canvas, mockView, true);
|
||||
assertEquals(2, myTracksOverlay.getNumLocations());
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
mockMyTracksOverlay.draw(canvas, mapView, false);
|
||||
assertEquals(2, mockMyTracksOverlay.getNumLocations());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertTrue(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
SingleColorTrackPathPainter trackPathPainter = (SingleColorTrackPathPainter) mockMyTracksOverlay
|
||||
.getTrackPathPainter();
|
||||
MockPath path = (MockPath) trackPathPainter.getPath();
|
||||
assertEquals(2, path.getTotalPoints());
|
||||
|
||||
mockMyTracksOverlay.draw(canvas, mapView, true);
|
||||
assertEquals(2, mockMyTracksOverlay.getNumLocations());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertTrue(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link MapOverlay#clearPoints()}.
|
||||
*/
|
||||
public void testClearPoints() throws Exception {
|
||||
Location location = new Location("gps");
|
||||
location.setLatitude(10);
|
||||
location.setLongitude(20);
|
||||
myTracksOverlay.addLocation(location);
|
||||
assertEquals(1, myTracksOverlay.getNumLocations());
|
||||
myTracksOverlay.clearPoints();
|
||||
assertEquals(0, myTracksOverlay.getNumLocations());
|
||||
mockMyTracksOverlay.addLocation(location);
|
||||
assertEquals(1, mockMyTracksOverlay.getNumLocations());
|
||||
mockMyTracksOverlay.clearPoints();
|
||||
assertEquals(0, mockMyTracksOverlay.getNumLocations());
|
||||
|
||||
// Same after drawing on canvas.
|
||||
// Test after drawing on canvas
|
||||
final int locations = 100;
|
||||
for (int i = 0; i < locations; ++i) {
|
||||
myTracksOverlay.addLocation(location);
|
||||
mockMyTracksOverlay.addLocation(location);
|
||||
}
|
||||
assertEquals(locations, myTracksOverlay.getNumLocations());
|
||||
myTracksOverlay.draw(canvas, mockView, false);
|
||||
myTracksOverlay.draw(canvas, mockView, true);
|
||||
myTracksOverlay.clearPoints();
|
||||
assertEquals(0, myTracksOverlay.getNumLocations());
|
||||
assertEquals(locations, mockMyTracksOverlay.getNumLocations());
|
||||
mockMyTracksOverlay.draw(canvas, mapView, false);
|
||||
mockMyTracksOverlay.draw(canvas, mapView, true);
|
||||
mockMyTracksOverlay.clearPoints();
|
||||
assertEquals(0, mockMyTracksOverlay.getNumLocations());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link MapOverlay#addWaypoint(Waypoint)}.
|
||||
*/
|
||||
public void testAddWaypoint() throws Exception {
|
||||
Location location = new Location("gps");
|
||||
location.setLatitude(10);
|
||||
location.setLongitude(20);
|
||||
Waypoint waypoint = new Waypoint();
|
||||
waypoint.setLocation(location);
|
||||
myTracksOverlay.addWaypoint(waypoint);
|
||||
assertEquals(1, myTracksOverlay.getNumWaypoints());
|
||||
assertEquals(0, myTracksOverlay.getNumLocations());
|
||||
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
|
||||
mockMyTracksOverlay.addWaypoint(waypoint);
|
||||
assertEquals(1, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumLocations());
|
||||
assertFalse(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
|
||||
final int waypoints = 10;
|
||||
for (int i = 0; i < waypoints; ++i) {
|
||||
waypoint = new Waypoint();
|
||||
waypoint.setLocation(location);
|
||||
myTracksOverlay.addWaypoint(waypoint);
|
||||
mockMyTracksOverlay.addWaypoint(waypoint);
|
||||
}
|
||||
assertEquals(1 + waypoints, myTracksOverlay.getNumWaypoints());
|
||||
assertEquals(0, myTracksOverlay.getNumLocations());
|
||||
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
assertEquals(1 + waypoints, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertEquals(0, mockMyTracksOverlay.getNumLocations());
|
||||
assertFalse(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link MapOverlay#clearWaypoints()}.
|
||||
*/
|
||||
public void testClearWaypoints() throws Exception {
|
||||
Location location = new Location("gps");
|
||||
location.setLatitude(10);
|
||||
location.setLongitude(20);
|
||||
Waypoint waypoint = new Waypoint();
|
||||
waypoint.setLocation(location);
|
||||
myTracksOverlay.addWaypoint(waypoint);
|
||||
assertEquals(1, myTracksOverlay.getNumWaypoints());
|
||||
myTracksOverlay.clearWaypoints();
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
mockMyTracksOverlay.addWaypoint(waypoint);
|
||||
assertEquals(1, mockMyTracksOverlay.getNumWaypoints());
|
||||
mockMyTracksOverlay.clearWaypoints();
|
||||
assertEquals(0, mockMyTracksOverlay.getNumWaypoints());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests {@link MapOverlay#draw(Canvas, MapView, boolean)}.
|
||||
*/
|
||||
public void testDrawing() {
|
||||
Location location = new Location("gps");
|
||||
location.setLatitude(10);
|
||||
@@ -147,30 +163,30 @@ public class MapOverlayTest extends AndroidTestCase {
|
||||
location.setLongitude(20 + i);
|
||||
Waypoint waypoint = new Waypoint();
|
||||
waypoint.setLocation(location);
|
||||
myTracksOverlay.addWaypoint(waypoint);
|
||||
mockMyTracksOverlay.addWaypoint(waypoint);
|
||||
}
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
location = new Location("gps");
|
||||
location.setLatitude(20 + i / 2);
|
||||
location.setLongitude(150 - i);
|
||||
myTracksOverlay.addLocation(location);
|
||||
mockMyTracksOverlay.addLocation(location);
|
||||
}
|
||||
|
||||
|
||||
// Shadow.
|
||||
myTracksOverlay.draw(canvas, mockView, true);
|
||||
// We don't expect to do anything if
|
||||
assertNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
assertEquals(40, myTracksOverlay.getNumWaypoints());
|
||||
assertEquals(100, myTracksOverlay.getNumLocations());
|
||||
mockMyTracksOverlay.draw(canvas, mapView, true);
|
||||
// We don't expect to do anything if
|
||||
assertFalse(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
assertEquals(40, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertEquals(100, mockMyTracksOverlay.getNumLocations());
|
||||
|
||||
// No shadow.
|
||||
myTracksOverlay.draw(canvas, mockView, false);
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
assertTrue(myTracksOverlay.getTrackPathPainter().getLastPath() instanceof MockPath);
|
||||
MockPath path = (MockPath) myTracksOverlay.getTrackPathPainter().getLastPath();
|
||||
assertEquals(40, myTracksOverlay.getNumWaypoints());
|
||||
assertEquals(100, myTracksOverlay.getNumLocations());
|
||||
assertEquals(100, path.totalPoints);
|
||||
// TODO: Check the points from the path (and the segments).
|
||||
mockMyTracksOverlay.draw(canvas, mapView, false);
|
||||
assertTrue(mockMyTracksOverlay.getTrackPathPainter().hasPath());
|
||||
SingleColorTrackPathPainter trackPathPainter = (SingleColorTrackPathPainter) mockMyTracksOverlay
|
||||
.getTrackPathPainter();
|
||||
MockPath path = (MockPath) trackPathPainter.getPath();
|
||||
assertEquals(40, mockMyTracksOverlay.getNumWaypoints());
|
||||
assertEquals(100, mockMyTracksOverlay.getNumLocations());
|
||||
assertEquals(100, path.getTotalPoints());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,30 +22,28 @@ import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
|
||||
/**
|
||||
* Elements for Tests for the MyTracks map overlay.
|
||||
* A mock {@link MapOverlay} for testing.
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
* @author Vangelis S.
|
||||
*
|
||||
* A mock version of {@code MapOverlay} that does not use
|
||||
* {@class MapView}.
|
||||
*/
|
||||
public class MockMyTracksOverlay extends MapOverlay {
|
||||
|
||||
private Projection mockProjection;
|
||||
private Projection projection;
|
||||
|
||||
public MockMyTracksOverlay(Context context) {
|
||||
super(context);
|
||||
mockProjection = new MockProjection();
|
||||
projection = new MockProjection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Projection getMapProjection(MapView mapView) {
|
||||
return mockProjection;
|
||||
return projection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rect getMapViewRect(MapView mapView) {
|
||||
return new Rect(0, 0, 100, 100);
|
||||
return new Rect(0, 0, (int) (100 * 1E6), (int) (100 * 1E6));
|
||||
}
|
||||
}
|
||||
@@ -26,20 +26,19 @@ import java.util.List;
|
||||
import junit.framework.Assert;
|
||||
|
||||
/**
|
||||
* Elements for Tests for the MyTracks map overlay.
|
||||
* A mock {@link Path}. Records calls to {@link Path#lineTo(float, float)} and
|
||||
* {@link Path#moveTo(float, float)}.
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
* @author Vangelis S.
|
||||
*
|
||||
* A mock class that intercepts {@code Path}'s and records calls to
|
||||
* {@code #moveTo()} and {@code #lineTo()}.
|
||||
*/
|
||||
public class MockPath extends Path {
|
||||
|
||||
// A list of disjointed path segments.
|
||||
private final List<List<PointF>> segments = new LinkedList<List<PointF>>();
|
||||
|
||||
/** A list of disjoined path segments. */
|
||||
public final List<List<PointF>> segments = new LinkedList<List<PointF>>();
|
||||
/** The total number of points in this path. */
|
||||
public int totalPoints;
|
||||
// The total number of points in this path.
|
||||
private int totalPoints;
|
||||
private List<PointF> currentSegment;
|
||||
|
||||
@Override
|
||||
@@ -49,12 +48,20 @@ public class MockPath extends Path {
|
||||
currentSegment.add(new PointF(x, y));
|
||||
totalPoints++;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void moveTo(float x, float y) {
|
||||
super.moveTo(x, y);
|
||||
segments.add(currentSegment =
|
||||
new ArrayList<PointF>(Arrays.asList(new PointF(x, y))));
|
||||
currentSegment = new ArrayList<PointF>(Arrays.asList(new PointF(x, y)));
|
||||
segments.add(currentSegment);
|
||||
totalPoints++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the total number of points in this path.
|
||||
*/
|
||||
public int getTotalPoints() {
|
||||
return totalPoints;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.android.apps.mytracks;
|
||||
|
||||
import com.google.android.maps.GeoPoint;
|
||||
@@ -21,18 +22,17 @@ import com.google.android.maps.Projection;
|
||||
import android.graphics.Point;
|
||||
|
||||
/**
|
||||
* Elements for Tests for the MyTracks map overlay.
|
||||
* A mock {@link Projection}. Acts as an identity matrix.
|
||||
*
|
||||
* @author Bartlomiej Niechwiej
|
||||
* @author Vangelis S.
|
||||
*
|
||||
* A mock {@code Projection} that acts as the identity matrix.
|
||||
*/
|
||||
public class MockProjection implements Projection {
|
||||
|
||||
@Override
|
||||
public Point toPixels(GeoPoint in, Point out) {
|
||||
return out;
|
||||
public Point toPixels(GeoPoint geoPoint, Point point) {
|
||||
return point;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+26
-22
@@ -51,6 +51,9 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
private static final String MOCK_DESC = "Mock Next Waypoint Desc!";
|
||||
private static final String TEST_DESC = "Test Desc!";
|
||||
private static final String TEST_DESC_NEW = "Test Desc new!";
|
||||
private double INITIAL_LATITUDE = 37.0;
|
||||
private double INITIAL_LONGITUDE = -57.0;
|
||||
private double ALTITUDE_INTERVAL = 2.5;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
@@ -273,13 +276,13 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
// Check whether all have been deleted.
|
||||
tracksCursor = contentResolver.query(TracksColumns.CONTENT_URI, null, null, null,
|
||||
TracksColumns._ID);
|
||||
assertTrue(tracksCursor.getCount() == 0);
|
||||
assertEquals(0, tracksCursor.getCount());
|
||||
tracksPointsCursor = contentResolver.query(TrackPointsColumns.CONTENT_URI, null, null,
|
||||
null, TrackPointsColumns._ID);
|
||||
assertTrue(tracksPointsCursor.getCount() == 0);
|
||||
assertEquals(0, tracksPointsCursor.getCount());
|
||||
waypointCursor = contentResolver.query(WaypointsColumns.CONTENT_URI, null, null,
|
||||
null, WaypointsColumns._ID);
|
||||
assertTrue(waypointCursor.getCount() == 0);
|
||||
assertEquals(0, waypointCursor.getCount());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -328,9 +331,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
@UsesMocks(Cursor.class)
|
||||
public void testCreateTrack() {
|
||||
Cursor cursorMock = AndroidMock.createNiceMock(Cursor.class);
|
||||
// The startColumnIndex can be any value, just make it to 2 in case it's
|
||||
// hard coded to 0 or 1 in some where.
|
||||
int startColumnIndex = 2;
|
||||
int startColumnIndex = 1;
|
||||
int columnIndex = startColumnIndex;
|
||||
AndroidMock.expect(cursorMock.getColumnIndexOrThrow(TracksColumns._ID))
|
||||
.andReturn(columnIndex++);
|
||||
@@ -359,7 +360,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
* Tests the method {@link MyTracksProviderUtilsImpl#createContentValues(Track)}.
|
||||
*/
|
||||
@UsesMocks(TripStatistics.class)
|
||||
public void testCreateContentValues_Track() {
|
||||
public void testCreateContentValues_track() {
|
||||
// ID
|
||||
long trackId = System.currentTimeMillis();
|
||||
// Name
|
||||
@@ -645,9 +646,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
@UsesMocks(Cursor.class)
|
||||
public void testCreateWaypoint() {
|
||||
Cursor cursorMock = AndroidMock.createNiceMock(Cursor.class);
|
||||
// The startColumnIndex can be any value, just make it to 2 in case it's
|
||||
// hard coded to 0 or 1 in some where.
|
||||
int startColumnIndex = 2;
|
||||
int startColumnIndex = 1;
|
||||
int columnIndex = startColumnIndex;
|
||||
AndroidMock.expect(cursorMock.getColumnIndexOrThrow(WaypointsColumns._ID))
|
||||
.andReturn(columnIndex++);
|
||||
@@ -683,7 +682,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
/**
|
||||
* Tests the method {@link MyTracksProviderUtilsImpl#createContentValues(Waypoint)}.
|
||||
*/
|
||||
public void testCreateContentValues_Waypoint() {
|
||||
public void testCreateContentValues_waypoint() {
|
||||
long trackId = System.currentTimeMillis();
|
||||
Track track = getTrack(trackId, 10);
|
||||
providerUtils.insertTrack(track);
|
||||
@@ -819,10 +818,10 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
|
||||
LocationIterator locationIterator = providerUtils.getLocationIterator(trackId,
|
||||
startTrackPointId, true, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
|
||||
assertEquals(startTrackPointId, locationIterator.getLocationId());
|
||||
for (int i = 1; i >= 0; i--) {
|
||||
assertTrue(locationIterator.hasNext());
|
||||
Location location = locationIterator.next();
|
||||
assertEquals(2 + (i - 1), locationIterator.getLocationId());
|
||||
checkLocation(i, location);
|
||||
}
|
||||
assertFalse(locationIterator.hasNext());
|
||||
@@ -843,10 +842,11 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
|
||||
LocationIterator locationIterator = providerUtils.getLocationIterator(trackId,
|
||||
startTrackPointId, false, MyTracksProviderUtils.DEFAULT_LOCATION_FACTORY);
|
||||
assertEquals(startTrackPointId, locationIterator.getLocationId());
|
||||
|
||||
for (int i = 1; i < 10; i++) {
|
||||
assertTrue(locationIterator.hasNext());
|
||||
Location location = locationIterator.next();
|
||||
assertEquals(2 + (i - 1), locationIterator.getLocationId());
|
||||
checkLocation(i, location);
|
||||
}
|
||||
assertFalse(locationIterator.hasNext());
|
||||
@@ -871,6 +871,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
* test also covers the method
|
||||
* {@link MyTracksProviderUtilsImpl#createContentValues(Location, long)}.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
public void testInsertTrackPoint() {
|
||||
// Insert track, point at first.
|
||||
long trackId = System.currentTimeMillis();
|
||||
@@ -888,6 +889,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
* {@link MyTracksProviderUtilsImpl#createContentValues(Location, long)} and
|
||||
* the inner class {@link MyTracksProviderUtilsImpl.CachedTrackPointsIndexes}.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
public void testBulkInsertTrackPoints() {
|
||||
// Insert track, point at first.
|
||||
long trackId = System.currentTimeMillis();
|
||||
@@ -908,6 +910,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
* and the inner class
|
||||
* {@link MyTracksProviderUtilsImpl.CachedTrackPointsIndexes}.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
@UsesMocks(Cursor.class)
|
||||
public void testCreateLocation() {
|
||||
Cursor cursorMock = AndroidMock.createNiceMock(Cursor.class);
|
||||
@@ -984,7 +987,7 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
track.setId(id);
|
||||
track.setName("Test: " + id);
|
||||
track.setNumberOfPoints(numPoints);
|
||||
for(int i=0; i < numPoints; i++) {
|
||||
for(int i = 0; i < numPoints; i++) {
|
||||
track.addLocation(createLocation(i));
|
||||
}
|
||||
return track;
|
||||
@@ -996,26 +999,27 @@ public class MyTracksProviderUtilsImplTest extends AndroidTestCase {
|
||||
* @return created location
|
||||
*/
|
||||
private Location createLocation(int i) {
|
||||
|
||||
Location loc = new Location("test");
|
||||
loc.setLatitude(37.0 + (double) i / 10000.0);
|
||||
loc.setLongitude(57.0 - (double) i / 10000.0);
|
||||
loc.setLatitude(INITIAL_LATITUDE + (double) i / 10000.0);
|
||||
loc.setLongitude(INITIAL_LONGITUDE - (double) i / 10000.0);
|
||||
loc.setAccuracy((float) i / 100.0f);
|
||||
loc.setAltitude(i * 2.5);
|
||||
loc.setAltitude(i * ALTITUDE_INTERVAL);
|
||||
return loc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the value of a location.
|
||||
*
|
||||
* @param i the index of this location which created in the method {@link
|
||||
* this#getTrack(long, int)}
|
||||
* @param i the index of this location which created in the method
|
||||
* {@link MyTracksProviderUtilsImplTest#getTrack(long, int)}
|
||||
* @param location the location to be checked
|
||||
*/
|
||||
private void checkLocation(int i, Location location) {
|
||||
assertEquals(37.0 + (double) i / 10000.0, location.getLatitude());
|
||||
assertEquals(57.0 - (double) i / 10000.0, location.getLongitude());
|
||||
assertEquals(INITIAL_LATITUDE + (double) i / 10000.0, location.getLatitude());
|
||||
assertEquals(INITIAL_LONGITUDE - (double) i / 10000.0, location.getLongitude());
|
||||
assertEquals((float) i / 100.0f, location.getAccuracy());
|
||||
assertEquals(i * 2.5, location.getAltitude());
|
||||
assertEquals(i * ALTITUDE_INTERVAL, location.getAltitude());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+10
-9
@@ -273,24 +273,25 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
|
||||
*/
|
||||
public void testSplitSetting() {
|
||||
EndToEndTestUtils.startRecording();
|
||||
|
||||
|
||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_split_frequency), true);
|
||||
boolean isFoundKM = EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.ONE_KM);
|
||||
if(isFoundKM) {
|
||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.ONE_KM);
|
||||
boolean isFoundKM = EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.KM);
|
||||
if (isFoundKM) {
|
||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.KM, 0);
|
||||
} else {
|
||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.ONE_MILE);
|
||||
EndToEndTestUtils.SOLO.clickOnText(EndToEndTestUtils.MILE, 0);
|
||||
}
|
||||
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||
|
||||
EndToEndTestUtils
|
||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||
// Send Gps to give a distance more than one kilometer or one mile.
|
||||
EndToEndTestUtils.sendGps(20);
|
||||
|
||||
|
||||
|
||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_markers), true);
|
||||
instrumentation.waitForIdleSync();
|
||||
assertTrue(EndToEndTestUtils.SOLO.getCurrentListViews().get(0).getCount() > 0);
|
||||
EndToEndTestUtils.SOLO.goBack();
|
||||
|
||||
|
||||
EndToEndTestUtils.stopRecording(true);
|
||||
}
|
||||
|
||||
|
||||
+21
-19
@@ -77,18 +77,20 @@ public class EndToEndTestUtils {
|
||||
// Following is some check strings in English and Chinese
|
||||
private static final HashMap<String, String> RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> VIEW_MODE_MULTILINGUAL = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> ONE_KM_MULTILINGUAL = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> ONE_MILE_MULTILINGUAL = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> KM_MULTILINGUAL = new HashMap<String, String>();
|
||||
private static final HashMap<String, String> MILE_MULTILINGUAL = new HashMap<String, String>();
|
||||
public static String RELATIVE_STARTTIME_POSTFIX = "";
|
||||
public static String VIEW_MODE = "";
|
||||
public static String ONE_KM = "";
|
||||
public static String ONE_MILE = "";
|
||||
public static String KM = "";
|
||||
public static String MILE = "";
|
||||
|
||||
public static int SHORT_WAIT_TIME = 2000;
|
||||
public static int NORMAL_WAIT_TIME = 8000;
|
||||
public static int LONG_WAIT_TIME = 15000;
|
||||
public static int SUPER_LONG_WAIT_TIME = 100000;
|
||||
|
||||
public static String deviceLanguage = "";
|
||||
|
||||
static {
|
||||
RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL.put("es", "mins ago");
|
||||
RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL.put("de", "Minuten");
|
||||
@@ -102,17 +104,17 @@ public class EndToEndTestUtils {
|
||||
VIEW_MODE_MULTILINGUAL.put("ar", "وضع");
|
||||
VIEW_MODE_MULTILINGUAL.put("zh", "模式");
|
||||
|
||||
ONE_KM_MULTILINGUAL.put("es", "1 km");
|
||||
ONE_KM_MULTILINGUAL.put("de", "1 km");
|
||||
ONE_KM_MULTILINGUAL.put("fr", "1 km");
|
||||
ONE_KM_MULTILINGUAL.put("ar", "١ كم");
|
||||
ONE_KM_MULTILINGUAL.put("zh", "1 公里");
|
||||
KM_MULTILINGUAL.put("es", "km");
|
||||
KM_MULTILINGUAL.put("de", "km");
|
||||
KM_MULTILINGUAL.put("fr", "km");
|
||||
KM_MULTILINGUAL.put("ar", "كم");
|
||||
KM_MULTILINGUAL.put("zh", "公里");
|
||||
|
||||
ONE_MILE_MULTILINGUAL.put("es", "1 mi");
|
||||
ONE_MILE_MULTILINGUAL.put("de", "1 mi");
|
||||
ONE_MILE_MULTILINGUAL.put("fr", "1 mile");
|
||||
ONE_MILE_MULTILINGUAL.put("ar", "١ ميل");
|
||||
ONE_MILE_MULTILINGUAL.put("zh", "1 英里");
|
||||
MILE_MULTILINGUAL.put("es", "mi");
|
||||
MILE_MULTILINGUAL.put("de", "mi");
|
||||
MILE_MULTILINGUAL.put("fr", "mile");
|
||||
MILE_MULTILINGUAL.put("ar", "ميل");
|
||||
MILE_MULTILINGUAL.put("zh", "英里");
|
||||
}
|
||||
|
||||
static Solo SOLO;
|
||||
@@ -130,17 +132,17 @@ public class EndToEndTestUtils {
|
||||
* Checks the language, then sets the fields with right string.
|
||||
*/
|
||||
private static void checkLanguage() {
|
||||
String deviceLanguage = instrumentation.getContext().getResources().getConfiguration().locale.getLanguage();
|
||||
deviceLanguage = instrumentation.getContext().getResources().getConfiguration().locale.getLanguage();
|
||||
if (RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL.get(deviceLanguage) != null) {
|
||||
RELATIVE_STARTTIME_POSTFIX = RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL.get(deviceLanguage);
|
||||
VIEW_MODE = VIEW_MODE_MULTILINGUAL.get(deviceLanguage);
|
||||
ONE_KM = ONE_KM_MULTILINGUAL.get(deviceLanguage);
|
||||
ONE_MILE = ONE_MILE_MULTILINGUAL.get(deviceLanguage);
|
||||
KM = KM_MULTILINGUAL.get(deviceLanguage);
|
||||
MILE = MILE_MULTILINGUAL.get(deviceLanguage);
|
||||
} else {
|
||||
RELATIVE_STARTTIME_POSTFIX = RELATIVE_STARTTIME_POSTFIX_MULTILINGUAL.get("es");
|
||||
VIEW_MODE = VIEW_MODE_MULTILINGUAL.get("es");
|
||||
ONE_KM = ONE_KM_MULTILINGUAL.get("es");
|
||||
ONE_MILE = ONE_MILE_MULTILINGUAL.get("es");
|
||||
KM = KM_MULTILINGUAL.get("es");
|
||||
MILE = MILE_MULTILINGUAL.get("es");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-34
@@ -57,35 +57,6 @@ public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
|
||||
* String)} when the key is null.
|
||||
*/
|
||||
public void testOnSharedPreferenceChanged_nullKey() {
|
||||
DynamicSpeedTrackPathDescriptor dynamicSpeedTrackPathDescriptor = new DynamicSpeedTrackPathDescriptor(
|
||||
context);
|
||||
int speedMargin = dynamicSpeedTrackPathDescriptor.getSpeedMargin();
|
||||
// Change value in shared preferences.
|
||||
PreferencesUtils.setInt(context, R.string.track_color_mode_percentage_key, speedMargin + 2);
|
||||
|
||||
dynamicSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences, null);
|
||||
assertEquals(speedMargin, dynamicSpeedTrackPathDescriptor.getSpeedMargin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
|
||||
* String)} when the key is not null, and not trackColorModeDynamicVariation.
|
||||
*/
|
||||
public void testOnSharedPreferenceChanged_otherKey() {
|
||||
DynamicSpeedTrackPathDescriptor dynamicSpeedTrackPathDescriptor = new DynamicSpeedTrackPathDescriptor(
|
||||
context);
|
||||
int speedMargin = dynamicSpeedTrackPathDescriptor.getSpeedMargin();
|
||||
// Change value in shared preferences.
|
||||
PreferencesUtils.setInt(context, R.string.track_color_mode_percentage_key, speedMargin + 2);
|
||||
dynamicSpeedTrackPathDescriptor.onSharedPreferenceChanged(sharedPreferences, "anyKey");
|
||||
assertEquals(speedMargin, dynamicSpeedTrackPathDescriptor.getSpeedMargin());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#onSharedPreferenceChanged(SharedPreferences,
|
||||
* String)} when the key is trackColorModeDynamicVariation.
|
||||
@@ -120,7 +91,7 @@ public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#needsRedraw()} by wrong track
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#updateState()} by wrong track
|
||||
* id.
|
||||
*/
|
||||
public void testNeedsRedraw_WrongTrackId() {
|
||||
@@ -128,11 +99,11 @@ public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
|
||||
context, R.string.selected_track_id_key, PreferencesUtils.SELECTED_TRACK_ID_DEFAULT);
|
||||
DynamicSpeedTrackPathDescriptor dynamicSpeedTrackPathDescriptor = new DynamicSpeedTrackPathDescriptor(
|
||||
context);
|
||||
assertEquals(false, dynamicSpeedTrackPathDescriptor.needsRedraw());
|
||||
assertEquals(false, dynamicSpeedTrackPathDescriptor.updateState());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#needsRedraw()} by different
|
||||
* Tests {@link DynamicSpeedTrackPathDescriptor#updateState()} by different
|
||||
* averageMovingSpeed.
|
||||
*/
|
||||
public void testIsDiffereceSignificant() {
|
||||
@@ -145,8 +116,7 @@ public class DynamicSpeedTrackPathDescriptorTest extends AndroidTestCase {
|
||||
// Difference is more than CRITICAL_DIFFERENCE_PERCENTAGE
|
||||
30 * (1 + (DynamicSpeedTrackPathDescriptor.CRITICAL_DIFFERENCE_PERCENTAGE / 100.00) * 2) };
|
||||
boolean[] expectedValues = { true, false, false, true };
|
||||
double[] expectedAverageMovingSpeed = { 20, 30, 30,
|
||||
30 * (1 + (DynamicSpeedTrackPathDescriptor.CRITICAL_DIFFERENCE_PERCENTAGE / 100.00) * 2) };
|
||||
double[] expectedAverageMovingSpeed = { 0, 30, 30, 30 };
|
||||
// Test
|
||||
for (int i = 0; i < newAverageMovingSpeed.length; i++) {
|
||||
dynamicSpeedTrackPathDescriptor.setAverageMovingSpeed(averageMovingSpeeds[i]);
|
||||
|
||||
+3
-3
@@ -62,7 +62,7 @@ public class DynamicSpeedTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
public void testUpdatePath_AllInvalidLocation() {
|
||||
List<CachedLocation> points = createCachedLocations(NUMBER_OF_LOCATIONS, INVALID_LATITUDE, -1);
|
||||
dynamicSpeedTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), 1, true, points);
|
||||
myTracksOverlay.getMapViewRect(mockView), 1, points);
|
||||
AndroidMock.verify(trackPathDescriptor);
|
||||
// Should be zero for there is no valid locations.
|
||||
assertEquals(0, dynamicSpeedTrackPathPainter.getColoredPaths().size());
|
||||
@@ -80,7 +80,7 @@ public class DynamicSpeedTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
// Gets a number as the start index of points.
|
||||
int startLocationIdx = NUMBER_OF_LOCATIONS / 2;
|
||||
dynamicSpeedTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, true, points);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, points);
|
||||
|
||||
AndroidMock.verify(trackPathDescriptor);
|
||||
assertEquals(NUMBER_OF_LOCATIONS - startLocationIdx, dynamicSpeedTrackPathPainter
|
||||
@@ -123,7 +123,7 @@ public class DynamicSpeedTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
slowSpeed));
|
||||
|
||||
dynamicSpeedTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, true, points);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, points);
|
||||
|
||||
AndroidMock.verify(trackPathDescriptor);
|
||||
List<ColoredPath> coloredPath = dynamicSpeedTrackPathPainter.getColoredPaths();
|
||||
|
||||
+16
-14
@@ -31,9 +31,10 @@ import java.util.List;
|
||||
*/
|
||||
public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
|
||||
private static final int NUMBER_OF_LOCATIONS = 10;
|
||||
private SingleColorTrackPathPainter singleColorTrackPathPainter;
|
||||
private Path pathMock;
|
||||
private static final int NUMBER_OF_LOCATIONS = 100;
|
||||
|
||||
|
||||
/**
|
||||
* Initials a mocked TrackPathDescriptor object and
|
||||
@@ -44,8 +45,8 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
pathMock = AndroidMock.createStrictMock(Path.class);
|
||||
singleColorTrackPathPainter = new SingleColorTrackPathPainter(getContext());
|
||||
pathMock = AndroidMock.createStrictMock(Path.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,11 +55,12 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
* method when all locations are valid.
|
||||
*/
|
||||
public void testUpdatePath_AllValidLocation() {
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS);
|
||||
List<CachedLocation> points = createCachedLocations(NUMBER_OF_LOCATIONS,
|
||||
TrackStubUtils.INITIAL_LATITUDE, -1);
|
||||
// Gets a number as the start index of points.
|
||||
int startLocationIdx = NUMBER_OF_LOCATIONS / 2;
|
||||
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS - startLocationIdx);
|
||||
List<CachedLocation> points = createCachedLocations(NUMBER_OF_LOCATIONS,
|
||||
TrackStubUtils.INITIAL_LATITUDE, -1);
|
||||
|
||||
for (int i = startLocationIdx; i < NUMBER_OF_LOCATIONS; i++) {
|
||||
pathMock.lineTo(0, 0);
|
||||
@@ -66,7 +68,7 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
|
||||
AndroidMock.replay(pathMock);
|
||||
singleColorTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, true, points, pathMock);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, points, pathMock);
|
||||
AndroidMock.verify(pathMock);
|
||||
}
|
||||
|
||||
@@ -76,20 +78,20 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
* method when all locations are invalid.
|
||||
*/
|
||||
public void testUpdatePath_AllInvalidLocation() {
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS);
|
||||
int startLocationIdx = NUMBER_OF_LOCATIONS / 2;
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS - startLocationIdx);
|
||||
List<CachedLocation> points = createCachedLocations(NUMBER_OF_LOCATIONS, INVALID_LATITUDE, -1);
|
||||
// Gets a random number from 1 to numberOfLocations.
|
||||
int startLocationIdx = NUMBER_OF_LOCATIONS / 2;
|
||||
AndroidMock.replay(pathMock);
|
||||
singleColorTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, true, points, pathMock);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, points, pathMock);
|
||||
AndroidMock.verify(pathMock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the
|
||||
* {@link SingleColorTrackPathPainter#updatePath(com.google.android.maps.Projection, android.graphics.Rect, int, Boolean, List, Path)}
|
||||
* method when there are three segments.
|
||||
* Tests the {@link SingleColorTrackPathPainter#updatePath(com.google.android.maps.Projection,
|
||||
* android.graphics.Rect, int, Boolean, List, Path)} method when there are
|
||||
* three segments.
|
||||
*/
|
||||
public void testUpdatePath_ThreeSegments() {
|
||||
// First segment.
|
||||
@@ -103,7 +105,7 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
points.addAll(createCachedLocations(NUMBER_OF_LOCATIONS, TrackStubUtils.INITIAL_LATITUDE, -1));
|
||||
// Gets a random number from 1 to numberOfLocations.
|
||||
int startLocationIdx = NUMBER_OF_LOCATIONS / 2;
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS *3 + 1 +1);
|
||||
pathMock.incReserve(NUMBER_OF_LOCATIONS *3 + 1 +1 - startLocationIdx);
|
||||
for (int i = 0; i < NUMBER_OF_LOCATIONS - startLocationIdx; i++) {
|
||||
pathMock.lineTo(0, 0);
|
||||
}
|
||||
@@ -118,7 +120,7 @@ public class SingleColorTrackPathPainterTest extends TrackPathPainterTestCase {
|
||||
|
||||
AndroidMock.replay(pathMock);
|
||||
singleColorTrackPathPainter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, true, points, pathMock);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, points, pathMock);
|
||||
AndroidMock.verify(pathMock);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -40,13 +40,12 @@ public class TrackPathDescriptorDynamicSpeedTest extends TrackPathPainterTestCas
|
||||
myTracksOverlay.setTrackPathPainter(painter);
|
||||
|
||||
int startLocationIdx = 0;
|
||||
Boolean alwaysVisible = true;
|
||||
|
||||
|
||||
assertNotNull(painter);
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
painter.drawTrack(canvas);
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().hasPath());
|
||||
painter.drawPath(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-6
@@ -40,13 +40,11 @@ public class TrackPathDescriptorFixedSpeedTest extends TrackPathPainterTestCase
|
||||
myTracksOverlay.setTrackPathPainter(painter);
|
||||
|
||||
int startLocationIdx = 0;
|
||||
Boolean alwaysVisible = true;
|
||||
|
||||
|
||||
assertNotNull(painter);
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
painter.drawTrack(canvas);
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().hasPath());
|
||||
painter.drawPath(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -55,8 +55,7 @@ public class TrackPathPainterFactoryTest extends TrackPathPainterTestCase {
|
||||
context, R.string.track_color_mode_key, context.getString(track_color_mode));
|
||||
|
||||
int startLocationIdx = 0;
|
||||
Boolean alwaysVisible = true;
|
||||
|
||||
|
||||
TrackPathPainter painter = TrackPathPainterFactory.getTrackPathPainter(context);
|
||||
myTracksOverlay.setTrackPathPainter(painter);
|
||||
|
||||
@@ -64,9 +63,9 @@ public class TrackPathPainterFactoryTest extends TrackPathPainterTestCase {
|
||||
assertTrue(c.isInstance(painter));
|
||||
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
painter.drawTrack(canvas);
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().hasPath());
|
||||
painter.drawPath(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-4
@@ -39,13 +39,12 @@ public class TrackPathPainterSingleColorTest extends TrackPathPainterTestCase {
|
||||
myTracksOverlay.setTrackPathPainter(painter);
|
||||
|
||||
int startLocationIdx = 0;
|
||||
Boolean alwaysVisible = true;
|
||||
|
||||
assertNotNull(painter);
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().getLastPath());
|
||||
painter.drawTrack(canvas);
|
||||
assertNotNull(myTracksOverlay.getTrackPathPainter().hasPath());
|
||||
painter.drawPath(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user