forked from upstream-mirrors/OpenTracks
Change code style.
This commit is contained in:
+28
-9
@@ -54,6 +54,7 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
// Create a new track with 3 gps data.
|
// Create a new track with 3 gps data.
|
||||||
EndToEndTestUtils.createTrackIfEmpty(3, true);
|
EndToEndTestUtils.createTrackIfEmpty(3, true);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
|
|
||||||
// Create a empty track.
|
// Create a empty track.
|
||||||
EndToEndTestUtils.createSimpleTrack(0, true);
|
EndToEndTestUtils.createSimpleTrack(0, true);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -69,12 +70,14 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
// Create a new track with two markers.
|
// Create a new track with two markers.
|
||||||
EndToEndTestUtils.startRecording();
|
EndToEndTestUtils.startRecording();
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
|
|
||||||
// Send Gps before creating marker.
|
// Send Gps before creating marker.
|
||||||
EndToEndTestUtils.sendGps(2);
|
EndToEndTestUtils.sendGps(2);
|
||||||
EndToEndTestUtils.createWaypoint(0);
|
EndToEndTestUtils.createWaypoint(0);
|
||||||
EndToEndTestUtils.sendGps(2, 2);
|
EndToEndTestUtils.sendGps(2, 2);
|
||||||
EndToEndTestUtils.createWaypoint(1);
|
EndToEndTestUtils.createWaypoint(1);
|
||||||
EndToEndTestUtils.sendGps(2, 4);
|
EndToEndTestUtils.sendGps(2, 4);
|
||||||
|
|
||||||
// Back to tracks list.
|
// Back to tracks list.
|
||||||
EndToEndTestUtils.SOLO.goBack();
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -82,6 +85,7 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
|
|
||||||
// Export this track and then delete it.
|
// Export this track and then delete it.
|
||||||
EndToEndTestUtils.deleteExportedFiles(EndToEndTestUtils.GPX);
|
EndToEndTestUtils.deleteExportedFiles(EndToEndTestUtils.GPX);
|
||||||
|
|
||||||
// Click to export tracks(At least one track) to Gpx files.
|
// Click to export tracks(At least one track) to Gpx files.
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_save_all), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_save_all), true);
|
||||||
EndToEndTestUtils.SOLO
|
EndToEndTestUtils.SOLO
|
||||||
@@ -95,8 +99,11 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
// Import this tracks.
|
// Import this tracks.
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_import), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_import), true);
|
||||||
EndToEndTestUtils.SOLO.waitForText(getImportSuccessMessage(1, EndToEndTestUtils.GPX));
|
EndToEndTestUtils.SOLO.waitForText(getImportSuccessMessage(1, EndToEndTestUtils.GPX));
|
||||||
// Check import tracks should be equal with the sum of trackNumber and
|
|
||||||
// gpxFilesNumber;
|
/*
|
||||||
|
* Check import tracks should be equal with the sum of trackNumber and
|
||||||
|
* gpxFilesNumber;
|
||||||
|
*/
|
||||||
EndToEndTestUtils
|
EndToEndTestUtils
|
||||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -113,10 +120,12 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
|
|
||||||
// Check the markers.
|
// Check the markers.
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_markers), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_markers), true);
|
||||||
|
|
||||||
// The first marker.
|
// The first marker.
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_NAME + 1));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_NAME + 1));
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_TYPE + 1));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_TYPE + 1));
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_DESC + 1));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_DESC + 1));
|
||||||
|
|
||||||
// The second marker.
|
// The second marker.
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_NAME + 2));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_NAME + 2));
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_TYPE + 2));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(EndToEndTestUtils.WAYPOINT_TYPE + 2));
|
||||||
@@ -159,6 +168,7 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
EndToEndTestUtils.deleteExportedFiles(EndToEndTestUtils.KML);
|
EndToEndTestUtils.deleteExportedFiles(EndToEndTestUtils.KML);
|
||||||
int gpxFilesNumber = 0;
|
int gpxFilesNumber = 0;
|
||||||
File[] allGpxFiles = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX);
|
File[] allGpxFiles = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX);
|
||||||
|
|
||||||
// For the first export, there is no MyTracks folder.
|
// For the first export, there is no MyTracks folder.
|
||||||
if (allGpxFiles != null) {
|
if (allGpxFiles != null) {
|
||||||
gpxFilesNumber = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length;
|
gpxFilesNumber = EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length;
|
||||||
@@ -181,6 +191,7 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
EndToEndTestUtils.SOLO.waitForText(getSaveSuccessMessage(1, EndToEndTestUtils.GPX));
|
EndToEndTestUtils.SOLO.waitForText(getSaveSuccessMessage(1, EndToEndTestUtils.GPX));
|
||||||
EndToEndTestUtils
|
EndToEndTestUtils
|
||||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
|
|
||||||
// Check export file.
|
// Check export file.
|
||||||
assertEquals(gpxFilesNumber + trackNumber,
|
assertEquals(gpxFilesNumber + trackNumber,
|
||||||
EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length);
|
EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length);
|
||||||
@@ -192,12 +203,18 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
|
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_import), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_import), true);
|
||||||
EndToEndTestUtils.rotateAllActivities();
|
EndToEndTestUtils.rotateAllActivities();
|
||||||
// Wait for the prefix of import success string is much faster than wait
|
|
||||||
// the whole string.
|
/*
|
||||||
EndToEndTestUtils.SOLO.waitForText(
|
* Wait for the prefix of import success string is much faster than wait the
|
||||||
activityMyTracks.getString(R.string.import_success).split("%")[0]);
|
* whole string.
|
||||||
// Check import tracks should be equal with the sum of trackNumber and
|
*/
|
||||||
// gpxFilesNumber;
|
EndToEndTestUtils.SOLO.waitForText(activityMyTracks.getString(R.string.import_success).split(
|
||||||
|
"%")[0]);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check import tracks should be equal with the sum of trackNumber and
|
||||||
|
* gpxFilesNumber;
|
||||||
|
*/
|
||||||
EndToEndTestUtils
|
EndToEndTestUtils
|
||||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
instrumentation.waitForIdleSync();
|
instrumentation.waitForIdleSync();
|
||||||
@@ -215,6 +232,7 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
EndToEndTestUtils.SOLO.waitForText(getSaveSuccessMessage(2, EndToEndTestUtils.KM));
|
EndToEndTestUtils.SOLO.waitForText(getSaveSuccessMessage(2, EndToEndTestUtils.KM));
|
||||||
EndToEndTestUtils
|
EndToEndTestUtils
|
||||||
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true, true);
|
||||||
|
|
||||||
// Check export files.
|
// Check export files.
|
||||||
assertEquals(gpxFilesNumber, EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length);
|
assertEquals(gpxFilesNumber, EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.GPX).length);
|
||||||
assertEquals(trackNumber, EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.KML).length);
|
assertEquals(trackNumber, EndToEndTestUtils.getExportedFiles(EndToEndTestUtils.KML).length);
|
||||||
@@ -227,7 +245,8 @@ public class ExportAndImportTest extends ActivityInstrumentationTestCase2<TrackL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getSaveSuccessMessage(int count, String type) {
|
private String getSaveSuccessMessage(int count, String type) {
|
||||||
String tracks = activityMyTracks.getResources().getQuantityString(R.plurals.tracks, count, count);
|
String tracks = activityMyTracks.getResources().getQuantityString(R.plurals.tracks, count,
|
||||||
|
count);
|
||||||
String directoryName = FileUtils.buildExternalDirectoryPath(type);
|
String directoryName = FileUtils.buildExternalDirectoryPath(type);
|
||||||
return activityMyTracks.getString(R.string.save_success, tracks, directoryName);
|
return activityMyTracks.getString(R.string.save_success, tracks, directoryName);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user