mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-02 09:33:06 +02:00
Fix unit tests
This commit is contained in:
@@ -63,7 +63,6 @@ public class MapOverlayTest extends AndroidTestCase {
|
||||
assertEquals(2, myTracksOverlay.getNumLocations());
|
||||
assertEquals(0, myTracksOverlay.getNumWaypoints());
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertEquals(2, ((MockPath)myTracksOverlay.getLastPath()).totalPoints);
|
||||
|
||||
myTracksOverlay.draw(canvas, mockView, true);
|
||||
assertEquals(2, myTracksOverlay.getNumLocations());
|
||||
@@ -152,11 +151,8 @@ public class MapOverlayTest extends AndroidTestCase {
|
||||
// No shadow.
|
||||
myTracksOverlay.draw(canvas, mockView, false);
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertTrue(myTracksOverlay.getLastPath() instanceof MockPath);
|
||||
MockPath path = (MockPath) myTracksOverlay.getLastPath();
|
||||
assertEquals(40, myTracksOverlay.getNumWaypoints());
|
||||
assertEquals(100, myTracksOverlay.getNumLocations());
|
||||
assertEquals(100, path.totalPoints);
|
||||
// TODO: Check the points from the path (and the segments).
|
||||
}
|
||||
}
|
||||
|
||||
+1
-6
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.maps;
|
||||
|
||||
import com.google.android.apps.mytracks.MockPath;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
@@ -45,9 +43,6 @@ public class TrackPathDescriptorDynamicSpeedTest extends TrackPathPainterTestCas
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertTrue(myTracksOverlay.getLastPath() instanceof MockPath);
|
||||
painter.drawTrack(canvas);
|
||||
|
||||
painter.drawTrack(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.maps;
|
||||
|
||||
import com.google.android.apps.mytracks.MockPath;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
@@ -45,8 +43,6 @@ public class TrackPathDescriptorFixedSpeedTest extends TrackPathPainterTestCase
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertTrue(myTracksOverlay.getLastPath() instanceof MockPath);
|
||||
painter.drawTrack(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-5
@@ -16,7 +16,6 @@
|
||||
package com.google.android.apps.mytracks.maps;
|
||||
|
||||
import com.google.android.apps.mytracks.Constants;
|
||||
import com.google.android.apps.mytracks.MockPath;
|
||||
import com.google.android.maps.mytracks.R;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -57,8 +56,8 @@ public class TrackPathPainterFactoryTest extends TrackPathPainterTestCase {
|
||||
|
||||
private <T> void testTrackPathPainterFactorySpecific(Context context, SharedPreferences prefs,
|
||||
int track_color_mode, Class <?> c) {
|
||||
prefs.edit().putString(context.getString(track_color_mode),
|
||||
context.getString(R.string.track_color_mode_key)).commit();
|
||||
prefs.edit().putString(context.getString(R.string.track_color_mode_key),
|
||||
context.getString(track_color_mode)).commit();
|
||||
|
||||
int startLocationIdx = 0;
|
||||
Boolean alwaysVisible = true;
|
||||
@@ -71,8 +70,6 @@ public class TrackPathPainterFactoryTest extends TrackPathPainterTestCase {
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertTrue(myTracksOverlay.getLastPath() instanceof MockPath);
|
||||
painter.drawTrack(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
-4
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package com.google.android.apps.mytracks.maps;
|
||||
|
||||
import com.google.android.apps.mytracks.MockPath;
|
||||
|
||||
import android.location.Location;
|
||||
|
||||
/**
|
||||
@@ -45,8 +43,6 @@ public class TrackPathPainterSingleColorTest extends TrackPathPainterTestCase {
|
||||
painter.updatePath(myTracksOverlay.getMapProjection(mockView),
|
||||
myTracksOverlay.getMapViewRect(mockView), startLocationIdx, alwaysVisible,
|
||||
myTracksOverlay.getPoints());
|
||||
assertNotNull(myTracksOverlay.getLastPath());
|
||||
assertTrue(myTracksOverlay.getLastPath() instanceof MockPath);
|
||||
painter.drawTrack(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
+7
-13
@@ -405,12 +405,10 @@ public class TrackRecordingServiceTest
|
||||
ITrackRecordingService service = bindAndGetService(createStartIntent());
|
||||
assertTrue(service.isRecording());
|
||||
|
||||
try {
|
||||
service.startNewTrack();
|
||||
fail("Expecting IllegalStateException");
|
||||
} catch (IllegalStateException e) {
|
||||
// Expected.
|
||||
}
|
||||
// Starting a new track when there is a recording should just return -1L.
|
||||
long newTrack = service.startNewTrack();
|
||||
assertEquals(-1L, newTrack);
|
||||
|
||||
assertEquals(123, sharedPreferences.getLong(
|
||||
context.getString(R.string.recording_track_key), 0));
|
||||
assertEquals(123, service.getRecordingTrackId());
|
||||
@@ -452,13 +450,9 @@ public class TrackRecordingServiceTest
|
||||
ITrackRecordingService service = bindAndGetService(createStartIntent());
|
||||
assertFalse(service.isRecording());
|
||||
|
||||
// End the current track.
|
||||
try {
|
||||
service.endCurrentTrack();
|
||||
fail("Expecting IllegalStateException");
|
||||
} catch (IllegalStateException e) {
|
||||
// Expected.
|
||||
}
|
||||
// Ending the current track when there is no recording should not result in any error.
|
||||
service.endCurrentTrack();
|
||||
|
||||
assertEquals(-1, sharedPreferences.getLong(
|
||||
context.getString(R.string.recording_track_key), 0));
|
||||
assertEquals(-1, service.getRecordingTrackId());
|
||||
|
||||
Reference in New Issue
Block a user