Change some code style.

This commit is contained in:
youtaol
2012-07-12 12:59:08 +08:00
parent be3422cf59
commit a267708ab5
3 changed files with 63 additions and 35 deletions
@@ -192,24 +192,24 @@ public class EndToEndTestUtils {
setIsEmulator();
EndToEndTestUtils.instrumentation = instrumentation;
EndToEndTestUtils.activityMytracks = activityMyTracks;
EndToEndTestUtils.SOLO = new Solo(EndToEndTestUtils.instrumentation,
SOLO = new Solo(EndToEndTestUtils.instrumentation,
EndToEndTestUtils.activityMytracks);
// Check if open MyTracks first time after install. If so, there would be a
// welcome view with accept buttons. And makes sure only check once.
if (!EndToEndTestUtils.isCheckedFirstLaunch) {
if ((EndToEndTestUtils.getButtonOnScreen(EndToEndTestUtils.activityMytracks
if (!isCheckedFirstLaunch) {
if ((getButtonOnScreen(EndToEndTestUtils.activityMytracks
.getString(R.string.eula_accept), false, false) != null)) {
EndToEndTestUtils.verifyFirstLaunch();
} else if (EndToEndTestUtils.SOLO.waitForText(
verifyFirstLaunch();
} else if (SOLO.waitForText(
// After reset setting, welcome page will show again.
activityMytracks.getString(R.string.welcome_title), 0, 500)) {
resetPreferredUnits();
}
checkLanguage();
EndToEndTestUtils.isCheckedFirstLaunch = true;
EndToEndTestUtils.setHasActionBar();
EndToEndTestUtils.resetAllSettings(activityMyTracks, false);
} else if (EndToEndTestUtils.SOLO.waitForText(
isCheckedFirstLaunch = true;
setHasActionBar();
resetAllSettings(activityMyTracks, false);
} else if (SOLO.waitForText(
// After reset setting, welcome page will show again.
activityMytracks.getString(R.string.welcome_title), 0, 500)) {
resetPreferredUnits();
@@ -266,7 +266,7 @@ public class EndToEndTestUtils {
*/
static void createSimpleTrack(int numberOfGpsData) {
startRecording();
EndToEndTestUtils.sendGps(numberOfGpsData);
sendGps(numberOfGpsData);
instrumentation.waitForIdleSync();
stopRecording(true);
}
@@ -301,11 +301,11 @@ public class EndToEndTestUtils {
* activity
*/
static void createTrackIfEmpty(int gpsNumber, boolean showTrackList) {
if (EndToEndTestUtils.isTrackListEmpty(!showTrackList)) {
if (isTrackListEmpty(!showTrackList)) {
// Create a simple track.
EndToEndTestUtils.createSimpleTrack(gpsNumber);
createSimpleTrack(gpsNumber);
if (showTrackList) {
EndToEndTestUtils.SOLO.goBack();
SOLO.goBack();
}
}
}
@@ -374,17 +374,17 @@ public class EndToEndTestUtils {
SOLO.clickOnText(activityMytracks.getString(R.string.menu_stop_recording));
}
if (isSave) {
EndToEndTestUtils.SOLO.waitForText(activityMytracks.getString(R.string.generic_save), 1, 5000);
SOLO.waitForText(activityMytracks.getString(R.string.generic_save), 1, 5000);
// Make every track name is unique to make sure every check can be
// trusted.
EndToEndTestUtils.trackName = EndToEndTestUtils.TRACK_NAME_PREFIX
trackName = TRACK_NAME_PREFIX
+ System.currentTimeMillis();
SOLO.sendKey(KeyEvent.KEYCODE_DEL);
SOLO.enterText(0, trackName);
SOLO.enterText(1, DEFAULTACTIVITY);
if(!EndToEndTestUtils.isEmulator) {
if(!isEmulator) {
// Close soft keyboard.
EndToEndTestUtils.SOLO.goBack();
SOLO.goBack();
}
SOLO.clickLongOnText(activityMytracks.getString(R.string.generic_save));
instrumentation.waitForIdleSync();
@@ -494,7 +494,7 @@ public class EndToEndTestUtils {
* Rotates the current activity.
*/
static void rotateCurrentActivity() {
EndToEndTestUtils.rotateActivity(SOLO.getCurrentActivity());
rotateActivity(SOLO.getCurrentActivity());
instrumentation.waitForIdleSync();
}
@@ -504,7 +504,7 @@ public class EndToEndTestUtils {
static void rotateAllActivities() {
ArrayList<Activity> allActivities = SOLO.getAllOpenedActivities();
for (Activity activity : allActivities) {
EndToEndTestUtils.rotateActivity(activity);
rotateActivity(activity);
}
instrumentation.waitForIdleSync();
@@ -588,7 +588,7 @@ public class EndToEndTestUtils {
* @return the text view, null means can not find it
*/
static TextView findTextView(String findText, View parent) {
ArrayList<TextView> textViews = EndToEndTestUtils.SOLO.getCurrentTextViews(parent);
ArrayList<TextView> textViews = SOLO.getCurrentTextViews(parent);
for (TextView textView : textViews) {
String text = (String) textView.getText();
if (textView.isShown() && text.endsWith(findText)) {
@@ -604,7 +604,7 @@ public class EndToEndTestUtils {
* @return the ChartView or null if not find
*/
static ChartView getChartView() {
ArrayList<View> views = EndToEndTestUtils.SOLO.getViews();
ArrayList<View> views = SOLO.getViews();
for (View view : views) {
if (view instanceof ChartView) {
return (ChartView) view;
@@ -620,13 +620,13 @@ public class EndToEndTestUtils {
* @param keepInSettingList whether keep in setting list or not
*/
public static void resetAllSettings(Activity activityMyTracks, boolean keepInSettingList) {
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
SOLO.waitForText(activityMyTracks.getString(R.string.settings_reset));
SOLO.clickOnText(activityMyTracks.getString(R.string.settings_reset));
getButtonOnScreen(activityMytracks.getString(R.string.generic_ok), true, true);
instrumentation.waitForIdleSync();
if (!keepInSettingList) {
EndToEndTestUtils.SOLO.goBack();
SOLO.goBack();
}
}