diff --git a/MyTracks/src/com/google/android/apps/mytracks/ChartView.java b/MyTracks/src/com/google/android/apps/mytracks/ChartView.java index 2e417ec74..932188c5d 100644 --- a/MyTracks/src/com/google/android/apps/mytracks/ChartView.java +++ b/MyTracks/src/com/google/android/apps/mytracks/ChartView.java @@ -22,6 +22,7 @@ import com.google.android.apps.mytracks.util.IntentUtils; import com.google.android.apps.mytracks.util.StringUtils; import com.google.android.apps.mytracks.util.UnitConversions; import com.google.android.maps.mytracks.R; +import com.google.common.annotations.VisibleForTesting; import android.content.Context; import android.content.Intent; @@ -999,4 +1000,14 @@ public class ChartView extends View { return false; } } + + /** + * Returns the status of metricUnits. + * + * @return the status of metricUnits + */ + @VisibleForTesting + public boolean isMetricUnits() { + return metricUnits; + } } diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java index 293a4e77a..51023396e 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/CreateAndSendTrackTest.java @@ -22,6 +22,7 @@ import android.app.Instrumentation; import android.test.ActivityInstrumentationTestCase2; import android.view.KeyEvent; import android.widget.CheckBox; +import android.widget.EditText; import java.util.ArrayList; @@ -93,18 +94,24 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2 editTexts = EndToEndTestUtils.SOLO.getCurrentEditTexts(); + + EndToEndTestUtils.SOLO.enterText(editTexts.get(0), newTrackName); + EndToEndTestUtils.SOLO.enterText(editTexts.get(1), newType); + // In landscape, there are only two visible edit texts. + if (editTexts.size() > 2) { + EndToEndTestUtils.SOLO.enterText(editTexts.get(2), newDesc); + } else { + EndToEndTestUtils.SOLO.scrollDown(); + editTexts = EndToEndTestUtils.SOLO.getCurrentEditTexts(); + EndToEndTestUtils.SOLO.enterText(editTexts.get(editTexts.size() - 1), newDesc); + } EndToEndTestUtils.SOLO.clickOnButton(activityMyTracks.getString(R.string.generic_save)); instrumentation.waitForIdleSync(); // Go back to track list. @@ -136,6 +143,10 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2 textViews = EndToEndTestUtils.SOLO.getCurrentTextViews(parent); + for (TextView textView : textViews) { + String text = (String) textView.getText(); + if (textView.isShown() && text.endsWith(findText)) { + return textView; + } + } + return null; + } + + /** + * Gets the ChartView. + * + * @return the ChartView or null if not find + */ + static ChartView getChartView() { + ArrayList views = EndToEndTestUtils.SOLO.getViews(); + for (View view : views) { + if (view instanceof ChartView) { + return (ChartView) view; + } + } + return null; + } } diff --git a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/GoToMyLocationTest.java b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/GoToMyLocationTest.java index d3687cb04..c711afc7a 100644 --- a/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/GoToMyLocationTest.java +++ b/MyTracksTest/src/com/google/android/apps/mytracks/endtoendtest/GoToMyLocationTest.java @@ -50,14 +50,16 @@ public class GoToMyLocationTest extends ActivityInstrumentationTestCase2Changes the setting of Sharing. * */ - public void testSetting() { + public void testChangeAndReset() { EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true); instrumentation.waitForIdleSync(); // Rotate on the settings page. @@ -81,13 +82,13 @@ public class SettingTest extends ActivityInstrumentationTestCase2 sharingCheckBoxs = EndToEndTestUtils.SOLO.getCurrentCheckBoxes(); boolean newMapsPublic = sharingCheckBoxs.get(0).isChecked(); EndToEndTestUtils.SOLO.clickOnCheckBox(0); instrumentation.waitForIdleSync(); assertTrue(EndToEndTestUtils.SOLO.waitForText( - activityMyTracks.getString(R.string.settings_sharing_map_public), 1, 5000)); + activityMyTracks.getString(R.string.settings_sharing_allow_access), 1, 5000)); assertEquals(!newMapsPublic, sharingCheckBoxs.get(0).isChecked()); EndToEndTestUtils.SOLO.goBack(); @@ -110,6 +111,95 @@ public class SettingTest extends ActivityInstrumentationTestCase2