forked from upstream-mirrors/OpenTracks
merge heads
This commit is contained in:
+1
-1
@@ -454,7 +454,7 @@ public class SendFusionTablesAsyncTask extends AbstractSendAsyncTask {
|
|||||||
* @param total the number of total locations
|
* @param total the number of total locations
|
||||||
*/
|
*/
|
||||||
private void updateProgress(int uploaded, int total) {
|
private void updateProgress(int uploaded, int total) {
|
||||||
double totalPercentage = uploaded / total;
|
double totalPercentage = (double) uploaded / total;
|
||||||
double scaledPercentage = totalPercentage
|
double scaledPercentage = totalPercentage
|
||||||
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
||||||
publishProgress((int) scaledPercentage);
|
publishProgress((int) scaledPercentage);
|
||||||
|
|||||||
@@ -472,8 +472,8 @@ public class SendMapsAsyncTask extends AbstractSendAsyncTask {
|
|||||||
* @param total the number of total locations
|
* @param total the number of total locations
|
||||||
*/
|
*/
|
||||||
private void updateProgress(int uploaded, int total) {
|
private void updateProgress(int uploaded, int total) {
|
||||||
double totalPercentage = uploaded / total;
|
double totalPercentage = (double) uploaded / total;
|
||||||
double scaledPercentage = totalPercentage
|
double scaledPercentage = totalPercentage
|
||||||
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
* (PROGRESS_UPLOAD_DATA_MAX - PROGRESS_UPLOAD_DATA_MIN) + PROGRESS_UPLOAD_DATA_MIN;
|
||||||
publishProgress((int) scaledPercentage);
|
publishProgress((int) scaledPercentage);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,6 @@
|
|||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry combineaccessrules="false" kind="src" path="/MyTracks"/>
|
<classpathentry combineaccessrules="false" kind="src" path="/MyTracks"/>
|
||||||
<classpathentry kind="lib" path="libs/AndroidMockGenerator.jar"/>
|
<classpathentry kind="lib" path="libs/AndroidMockGenerator.jar"/>
|
||||||
<classpathentry kind="lib" path="libs/robotium-solo-2.1.jar" />
|
<classpathentry kind="lib" path="libs/robotium-solo-3.1.jar"/>
|
||||||
<classpathentry kind="output" path="bin/classes"/>
|
<classpathentry kind="output" path="bin/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -43,16 +43,16 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
private View zoomOut;
|
private View zoomOut;
|
||||||
private int currentZoomLevel;
|
private int currentZoomLevel;
|
||||||
|
|
||||||
private final String LOCATION_PROVIDER = "gps";
|
private static final String LOCATION_PROVIDER = "gps";
|
||||||
private final double INITIAL_LONGTITUDE = 22;
|
private static final double INITIAL_LONGTITUDE = 22;
|
||||||
private final double INITIAL_LATITUDE = 22;
|
private static final double INITIAL_LATITUDE = 22;
|
||||||
private final double INITIAL_ALTITUDE = 22;
|
private static final double INITIAL_ALTITUDE = 22;
|
||||||
private final float INITIAL_ACCURACY = 5;
|
private static final float INITIAL_ACCURACY = 5;
|
||||||
private final float INITIAL_SPEED = 10;
|
private static final float INITIAL_SPEED = 10;
|
||||||
private final float INITIAL_BEARING = 3.0f;
|
private static final float INITIAL_BEARING = 3.0f;
|
||||||
// 10 is same with the default value in ChartView
|
// 10 is same with the default value in ChartView
|
||||||
private final int MAX_ZOOM_LEVEL = 10;
|
private static final int MAX_ZOOM_LEVEL = 10;
|
||||||
private final int MIN_ZOOM_LEVEL = 1;
|
private static final int MIN_ZOOM_LEVEL = 1;
|
||||||
// The ratio from meter/second to kilometer/hour, the conversion is 60 * 60 /
|
// The ratio from meter/second to kilometer/hour, the conversion is 60 * 60 /
|
||||||
// 1000 = 3.6.
|
// 1000 = 3.6.
|
||||||
private final double METER_PER_SECOND_TO_KILOMETER_PER_HOUR = 3.6;
|
private final double METER_PER_SECOND_TO_KILOMETER_PER_HOUR = 3.6;
|
||||||
@@ -113,7 +113,7 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* There are two parts in this test. Tests
|
* There are two parts in this test. Tests
|
||||||
* {@link ChartActivity#OnCreateDialog()} which includes the logic to create
|
* {@link ChartActivity#onCreateDialog(int)} which includes the logic to create
|
||||||
* {@link ChartSettingsDialog}.
|
* {@link ChartSettingsDialog}.
|
||||||
*/
|
*/
|
||||||
public void testCreateSettingDialog() {
|
public void testCreateSettingDialog() {
|
||||||
@@ -134,7 +134,7 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to get the incorrect values of sensor in {@link
|
* Tests the logic to get the incorrect values of sensor in {@link
|
||||||
* ChartActivity#fillDataPoint(Location location, double result[])}.
|
* ChartActivity#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_sensorIncorrect() {
|
public void testFillDataPoint_sensorIncorrect() {
|
||||||
MyTracksLocation myTracksLocation = getMyTracksLocation();
|
MyTracksLocation myTracksLocation = getMyTracksLocation();
|
||||||
@@ -166,7 +166,7 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to get the correct values of sensor in {@link
|
* Tests the logic to get the correct values of sensor in {@link
|
||||||
* ChartActivity#fillDataPoint(Location location, double result[])}.
|
* ChartActivity#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_sensorCorrect() {
|
public void testFillDataPoint_sensorCorrect() {
|
||||||
MyTracksLocation myTracksLocation = getMyTracksLocation();
|
MyTracksLocation myTracksLocation = getMyTracksLocation();
|
||||||
@@ -197,7 +197,7 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to get the value of metric Distance in
|
* Tests the logic to get the value of metric Distance in
|
||||||
* {@link #fillDataPoint}.
|
* {@link ChartActivity#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_distanceMetric() {
|
public void testFillDataPoint_distanceMetric() {
|
||||||
// By distance.
|
// By distance.
|
||||||
@@ -237,7 +237,7 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to get the value of imperial Distance in
|
* Tests the logic to get the value of imperial Distance in
|
||||||
* {@link #fillDataPoint}.
|
* {@link ChartActivity#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_distanceImperial() {
|
public void testFillDataPoint_distanceImperial() {
|
||||||
// Setups to use imperial.
|
// Setups to use imperial.
|
||||||
@@ -274,11 +274,11 @@ public class ChartActivityTest extends ActivityInstrumentationTestCase2<ChartAct
|
|||||||
Location.distanceBetween(myTracksLocation2.getLatitude(), myTracksLocation2.getLongitude(),
|
Location.distanceBetween(myTracksLocation2.getLatitude(), myTracksLocation2.getLongitude(),
|
||||||
myTracksLocation3.getLatitude(), myTracksLocation3.getLongitude(), results);
|
myTracksLocation3.getLatitude(), myTracksLocation3.getLongitude(), results);
|
||||||
double distance2 = results[0] * UnitConversions.KM_TO_MI;
|
double distance2 = results[0] * UnitConversions.KM_TO_MI;
|
||||||
assertEquals((distance1 + distance2) / KILOMETER_TO_METER, point[0]);
|
assertEquals(distance1 / KILOMETER_TO_METER + distance2 / KILOMETER_TO_METER , point[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to get the values of time in {@link #fillDataPoint}.
|
* Tests the logic to get the values of time in {@link ChartActivity#fillDataPoint(Location, double[])}.
|
||||||
*/
|
*/
|
||||||
public void testFillDataPoint_time() {
|
public void testFillDataPoint_time() {
|
||||||
// By time
|
// By time
|
||||||
|
|||||||
@@ -76,8 +76,6 @@ public class ChooseMapActivityTest extends AndroidTestCase {
|
|||||||
* Tests the method
|
* Tests the method
|
||||||
* {@link ChooseMapActivity#onAsyncTaskCompleted(boolean, ArrayList, ArrayList)}
|
* {@link ChooseMapActivity#onAsyncTaskCompleted(boolean, ArrayList, ArrayList)}
|
||||||
* . An alert dialog should be shown when there is no map.
|
* . An alert dialog should be shown when there is no map.
|
||||||
*
|
|
||||||
* @throws InterruptedException
|
|
||||||
*/
|
*/
|
||||||
public void testOnAsyncTaskCompleted_fail() {
|
public void testOnAsyncTaskCompleted_fail() {
|
||||||
ChooseMapActivityMock chooseMapActivityMock = new ChooseMapActivityMock();
|
ChooseMapActivityMock chooseMapActivityMock = new ChooseMapActivityMock();
|
||||||
|
|||||||
+2
-2
@@ -245,7 +245,7 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link SendRequest#writeToParcel(Parcel in)} when all input values
|
* Tests {@link SendRequest#writeToParcel(Parcel, int)} when all input values
|
||||||
* are true or affirmative.
|
* are true or affirmative.
|
||||||
*/
|
*/
|
||||||
public void testWriteToParcel_allTrue() {
|
public void testWriteToParcel_allTrue() {
|
||||||
@@ -283,7 +283,7 @@ public class SendRequestTest extends AndroidTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@link SendRequest#writeToParcel(Parcel in)} when all input values
|
* Tests {@link SendRequest#writeToParcel(Parcel, int)} when all input values
|
||||||
* are false or negative.
|
* are false or negative.
|
||||||
*/
|
*/
|
||||||
public void testWriteToParcel_allFalse() {
|
public void testWriteToParcel_allFalse() {
|
||||||
|
|||||||
+5
-5
@@ -51,7 +51,7 @@ public class UploadServiceChooserActivityTest extends
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to control display all send options. This test cover code
|
* Tests the logic to control display all send options. This test cover code
|
||||||
* in method {@link UploadServiceChooserActivity#onCreateDialog()},
|
* in method {@link UploadServiceChooserActivity#onCreateDialog(int)},
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +91,7 @@ public class UploadServiceChooserActivityTest extends
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to check the send to Google Maps option. This test cover
|
* Tests the logic to check the send to Google Maps option. This test cover
|
||||||
* code in method {@link UploadServiceChooserActivity#onCreateDialog()},
|
* code in method {@link UploadServiceChooserActivity#onCreateDialog(int)},
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
||||||
*/
|
*/
|
||||||
@@ -120,7 +120,7 @@ public class UploadServiceChooserActivityTest extends
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to control display none. This test cover code in method
|
* Tests the logic to control display none. This test cover code in method
|
||||||
* {@link UploadServiceChooserActivity#onCreateDialog()},
|
* {@link UploadServiceChooserActivity#onCreateDialog(int)},
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
* {@link UploadServiceChooserActivity#updateStateBySendRequest()} and
|
||||||
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
* {@link UploadServiceChooserActivity#updateStateBySelection()}.
|
||||||
*/
|
*/
|
||||||
@@ -135,7 +135,7 @@ public class UploadServiceChooserActivityTest extends
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to initial state of check box to unchecked. This test cover
|
* Tests the logic to initial state of check box to unchecked. This test cover
|
||||||
* code in method {@link UploadServiceChooserActivity#onCreateDialog()},
|
* code in method {@link UploadServiceChooserActivity#onCreateDialog(int)},
|
||||||
* {@link UploadServiceChooserActivity#initState()}.
|
* {@link UploadServiceChooserActivity#initState()}.
|
||||||
*/
|
*/
|
||||||
public void testOnCreateDialog_initStateUnchecked() {
|
public void testOnCreateDialog_initStateUnchecked() {
|
||||||
@@ -162,7 +162,7 @@ public class UploadServiceChooserActivityTest extends
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests the logic to initial state of check box to checked. This test cover
|
* Tests the logic to initial state of check box to checked. This test cover
|
||||||
* code in method {@link UploadServiceChooserActivity#onCreateDialog()},
|
* code in method {@link UploadServiceChooserActivity#onCreateDialog(int)},
|
||||||
* {@link UploadServiceChooserActivity#initState()}.
|
* {@link UploadServiceChooserActivity#initState()}.
|
||||||
*/
|
*/
|
||||||
public void testOnCreateDialog_initStateChecked() {
|
public void testOnCreateDialog_initStateChecked() {
|
||||||
|
|||||||
Reference in New Issue
Block a user