mirror of
https://codeberg.org/OpenTracksApp/OpenTracks.git
synced 2026-10-11 13:33:07 +02:00
Test: update and re-enable ExportImportTest for csv_export.
This commit is contained in:
+7
-6
@@ -24,7 +24,6 @@ import androidx.test.rule.ServiceTestRule;
|
|||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -73,6 +72,9 @@ import de.dennisguse.opentracks.stats.TrackStatistics;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Export a track to {@link TrackFileFormat} and verify that the import is identical.
|
* Export a track to {@link TrackFileFormat} and verify that the import is identical.
|
||||||
|
* <p>
|
||||||
|
* Note: those tests are affected by {@link de.dennisguse.opentracks.sensors.sensorData.SensorData}.isRecent().
|
||||||
|
* If the test device is too slow (like in a CI) these are likely to fail as the sensor data will be omitted from actual.
|
||||||
*/
|
*/
|
||||||
@RunWith(AndroidJUnit4.class)
|
@RunWith(AndroidJUnit4.class)
|
||||||
public class ExportImportTest {
|
public class ExportImportTest {
|
||||||
@@ -157,12 +159,12 @@ public class ExportImportTest {
|
|||||||
mockBLESensorData(trackPointCreator, 15f, sensorDistance, 66f, 3f, 50f);
|
mockBLESensorData(trackPointCreator, 15f, sensorDistance, 66f, 3f, 50f);
|
||||||
|
|
||||||
trackPointCreator.setClock("2020-02-02T02:02:14Z");
|
trackPointCreator.setClock("2020-02-02T02:02:14Z");
|
||||||
mockBLESensorData(trackPointCreator, 15f, null, 66f, 3f, 50f);
|
mockBLESensorData(trackPointCreator, 15f, null, 67f, 3f, 50f);
|
||||||
trackPointCreator.setClock("2020-02-02T02:02:15Z");
|
trackPointCreator.setClock("2020-02-02T02:02:15Z");
|
||||||
mockBLESensorData(trackPointCreator, null, null, 66f, 3f, 50f);
|
mockBLESensorData(trackPointCreator, null, null, 68f, 3f, 50f);
|
||||||
|
|
||||||
trackPointCreator.setClock("2020-02-02T02:02:16Z");
|
trackPointCreator.setClock("2020-02-02T02:02:16Z");
|
||||||
mockBLESensorData(trackPointCreator, 5f, Distance.of(2), 66f, 3f, 50f); // Distance will be added to next TrackPoint
|
mockBLESensorData(trackPointCreator, 5f, Distance.of(2), 69f, 3f, 50f); // Distance will be added to next TrackPoint
|
||||||
|
|
||||||
sendLocation(trackPointCreator, "2020-02-02T02:02:17Z", 3, 14.001, 10, 13, 15, 10, 0);
|
sendLocation(trackPointCreator, "2020-02-02T02:02:17Z", 3, 14.001, 10, 13, 15, 10, 0);
|
||||||
service.insertMarker("Marker 2", "Marker 2 category", "Marker 2 desc", null);
|
service.insertMarker("Marker 2", "Marker 2 category", "Marker 2 desc", null);
|
||||||
@@ -359,7 +361,7 @@ public class ExportImportTest {
|
|||||||
.setAltitudeLoss(1f)
|
.setAltitudeLoss(1f)
|
||||||
.setAltitudeGain(1f)
|
.setAltitudeGain(1f)
|
||||||
.setSensorDistance(Distance.of(14))
|
.setSensorDistance(Distance.of(14))
|
||||||
.setHeartRate(66f)
|
.setHeartRate(69)
|
||||||
.setPower(50f)
|
.setPower(50f)
|
||||||
.setCadence(3f)
|
.setCadence(3f)
|
||||||
.setHorizontalAccuracy(Distance.of(10)),
|
.setHorizontalAccuracy(Distance.of(10)),
|
||||||
@@ -447,7 +449,6 @@ public class ExportImportTest {
|
|||||||
assertNull(trackImported);
|
assertNull(trackImported);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore(value = "TODO Fails on CI; works on API24 and API30 locally")
|
|
||||||
@LargeTest
|
@LargeTest
|
||||||
@Test
|
@Test
|
||||||
public void csv_export_only() throws TimeoutException, IOException {
|
public void csv_export_only() throws TimeoutException, IOException {
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#time,trackpoint_type,latitude,longitude,altitude,accuracy_horizontal,accuracy_vertical,speed,altitude_gain,altitude_loss,sensor_distance,heartrate,cadence,power
|
#time,trackpoint_type,latitude,longitude,altitude,accuracy_horizontal,accuracy_vertical,speed,altitude_gain,altitude_loss,sensor_distance,heartrate,cadence,power
|
||||||
"2020-02-02T03:02:02+01:00","SEGMENT_START_MANUAL",,,,,,,,,,,,
|
"2020-02-02T03:02:02+01:00","SEGMENT_START_MANUAL",,,,,,,,,,,,
|
||||||
"2020-02-02T03:02:03+01:00","TRACKPOINT",3,3,10,10,,54,1,1,,,,
|
"2020-02-02T03:02:03+01:00","TRACKPOINT",3,14,10,10,,54,1,1,,,,
|
||||||
"2020-02-02T03:02:04+01:00","SENSORPOINT",,,,,,54,1,1,10,66,3,50
|
"2020-02-02T03:02:04+01:00","SENSORPOINT",,,,,,54,1,1,10,66,3,50
|
||||||
"2020-02-02T03:02:05+01:00","TRACKPOINT",3,3,10,10,,18,0,0,2,66,3,50
|
"2020-02-02T03:02:15+01:00","SENSORPOINT",,,,,,,,,,68,3,50
|
||||||
"2020-02-02T03:02:06+01:00","SEGMENT_END_MANUAL",,,,,,,,,,,,
|
"2020-02-02T03:02:16+01:00","SENSORPOINT",,,,,,18,,,2,69,3,50
|
||||||
"2020-02-02T03:02:20+01:00","SEGMENT_START_MANUAL",,,,,,,,,,,,
|
"2020-02-02T03:02:17+01:00","TRACKPOINT",3,14.001,10,10,,18,0,0,2,69,3,50
|
||||||
"2020-02-02T03:02:21+01:00","TRACKPOINT",3,3,10,10,,54,0,0,,,,
|
"2020-02-02T03:02:18+01:00","SEGMENT_END_MANUAL",,,,,,,,,,,,
|
||||||
"2020-02-02T03:02:22+01:00","SEGMENT_START_AUTOMATIC",3,3,10,10,,54,0,0,,,,
|
"2020-02-02T03:03:20+01:00","SEGMENT_START_MANUAL",,,,,,,,,,,,
|
||||||
"2020-02-02T03:02:23+01:00","TRACKPOINT",3,3,10,10,,54,0,0,,,,
|
"2020-02-02T03:03:21+01:00","TRACKPOINT",3,14.002,10,10,,54,0,0,,,,
|
||||||
"2020-02-02T03:02:24+01:00","SEGMENT_END_MANUAL",,,,,,,,,,,,
|
"2020-02-02T03:03:22+01:00","SEGMENT_START_AUTOMATIC",3,16,10,10,,54,0,0,,,,
|
||||||
|
"2020-02-02T03:03:23+01:00","TRACKPOINT",3,16.001,10,10,,54,0,0,,,,
|
||||||
|
"2020-02-02T03:03:24+01:00","SEGMENT_END_MANUAL",,,,,,,,,,,,
|
||||||
|
@@ -56,7 +56,7 @@ public class BluetoothRemoteSensorManager implements BluetoothConnectionManager.
|
|||||||
|
|
||||||
private static final String TAG = BluetoothRemoteSensorManager.class.getSimpleName();
|
private static final String TAG = BluetoothRemoteSensorManager.class.getSimpleName();
|
||||||
|
|
||||||
public static final Duration MAX_SENSOR_DATE_SET_AGE_MS = Duration.ofSeconds(5);
|
public static final Duration MAX_SENSOR_DATE_SET_AGE = Duration.ofSeconds(5);
|
||||||
|
|
||||||
private final BluetoothAdapter bluetoothAdapter;
|
private final BluetoothAdapter bluetoothAdapter;
|
||||||
private final Context context;
|
private final Context context;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public abstract class SensorData<T> {
|
|||||||
*/
|
*/
|
||||||
private boolean isRecent() {
|
private boolean isRecent() {
|
||||||
return Instant.now()
|
return Instant.now()
|
||||||
.isBefore(time.plus(BluetoothRemoteSensorManager.MAX_SENSOR_DATE_SET_AGE_MS));
|
.isBefore(time.plus(BluetoothRemoteSensorManager.MAX_SENSOR_DATE_SET_AGE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|||||||
Reference in New Issue
Block a user