forked from upstream-mirrors/OpenTracks
Merge heads
This commit is contained in:
+1
-1
@@ -257,7 +257,7 @@ public class CreateAndSendTrackTest extends ActivityInstrumentationTestCase2<Tra
|
|||||||
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.send_google_send_now),
|
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.send_google_send_now),
|
||||||
true, true);
|
true, true);
|
||||||
|
|
||||||
if(!GoogleUtils.checkAccountStatusDialog()) {
|
if(!GoogleUtils.isAccountAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -368,7 +368,7 @@ public class GoogleUtils {
|
|||||||
*
|
*
|
||||||
* @return true means the status of account is good for sending
|
* @return true means the status of account is good for sending
|
||||||
*/
|
*/
|
||||||
public static boolean checkAccountStatusDialog() {
|
public static boolean isAccountAvailable() {
|
||||||
// Check whether no account is binded with this device.
|
// Check whether no account is binded with this device.
|
||||||
if (EndToEndTestUtils.SOLO.waitForText(
|
if (EndToEndTestUtils.SOLO.waitForText(
|
||||||
EndToEndTestUtils.activityMytracks.getString(R.string.send_google_no_account_title), 1,
|
EndToEndTestUtils.activityMytracks.getString(R.string.send_google_no_account_title), 1,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
|
|
||||||
private Instrumentation instrumentation;
|
private Instrumentation instrumentation;
|
||||||
private TrackListActivity activityMyTracks;
|
private TrackListActivity activityMyTracks;
|
||||||
|
private final static String SHARE_ITEM_PARENT_VIEW_NAME = "RecycleListView";
|
||||||
|
|
||||||
@TargetApi(8)
|
@TargetApi(8)
|
||||||
public MenuItemsTest() {
|
public MenuItemsTest() {
|
||||||
@@ -99,8 +100,9 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
* Tests the share menu item. This test to check whether crash will happen during the share.
|
* Tests the share menu item. This test to check whether crash will happen during the share.
|
||||||
*/
|
*/
|
||||||
public void testShareActivity() {
|
public void testShareActivity() {
|
||||||
// Try all share item.
|
// Try all share items.
|
||||||
for (int i = 0;; i++) {
|
for (int i = 0;; i++) {
|
||||||
|
EndToEndTestUtils.createTrackIfEmpty(0, false);
|
||||||
View oneItemView = findShareItem(i);
|
View oneItemView = findShareItem(i);
|
||||||
if (oneItemView == null) {
|
if (oneItemView == null) {
|
||||||
break;
|
break;
|
||||||
@@ -108,7 +110,7 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
EndToEndTestUtils.SOLO.clickOnView(oneItemView);
|
EndToEndTestUtils.SOLO.clickOnView(oneItemView);
|
||||||
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true,
|
EndToEndTestUtils.getButtonOnScreen(activityMyTracks.getString(R.string.generic_ok), true,
|
||||||
true);
|
true);
|
||||||
if(!GoogleUtils.checkAccountStatusDialog()) {
|
if(!GoogleUtils.isAccountAvailable()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Waiting the send is finish.
|
// Waiting the send is finish.
|
||||||
@@ -131,18 +133,18 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the view to click the share item by item index.
|
* Gets the view to click the share item by item index.
|
||||||
|
*
|
||||||
* @param index of a share item
|
* @param index of a share item
|
||||||
* @return null when no such item
|
* @return null when no such item
|
||||||
*/
|
*/
|
||||||
private View findShareItem(int index) {
|
private View findShareItem(int index) {
|
||||||
EndToEndTestUtils.createTrackIfEmpty(0, false);
|
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_share), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_share), true);
|
||||||
ArrayList<View> cc = EndToEndTestUtils.SOLO.getViews();
|
ArrayList<View> views = EndToEndTestUtils.SOLO.getViews();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (View view : cc) {
|
for (View view : views) {
|
||||||
String name = view.getParent().getClass().getName();
|
String name = view.getParent().getClass().getName();
|
||||||
// Each share item is in one Linear layout which is the child view of
|
// Each share item is a child of a "RecycleListView"
|
||||||
if (name.indexOf("RecycleListView") > 0) {
|
if (name.indexOf(SHARE_ITEM_PARENT_VIEW_NAME) > 0) {
|
||||||
if (index == i) {
|
if (index == i) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
@@ -151,40 +153,38 @@ public class MenuItemsTest extends ActivityInstrumentationTestCase2<TrackListAct
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the voice frequency and split frequency menus when no track is
|
|
||||||
* recording.
|
|
||||||
*/
|
|
||||||
public void testFrequencyMenu_noRecording() {
|
|
||||||
EndToEndTestUtils.createTrackIfEmpty(0, false);
|
|
||||||
assertFalse(EndToEndTestUtils.findMenuItem(
|
|
||||||
activityMyTracks.getString(R.string.menu_voice_frequency), false));
|
|
||||||
assertFalse(EndToEndTestUtils.findMenuItem(
|
|
||||||
activityMyTracks.getString(R.string.menu_split_frequency), false));
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the voice frequency and split frequency menus during recording. When
|
||||||
|
* recording, they should be in both the menu and the recording settings. When
|
||||||
|
* not recording, they should only be in the recording settings.
|
||||||
|
*/
|
||||||
|
public void testFrequencyMenu() {
|
||||||
|
EndToEndTestUtils.startRecording();
|
||||||
|
|
||||||
|
assertTrue(EndToEndTestUtils.findMenuItem(
|
||||||
|
activityMyTracks.getString(R.string.menu_voice_frequency), false));
|
||||||
|
assertTrue(EndToEndTestUtils.findMenuItem(
|
||||||
|
activityMyTracks.getString(R.string.menu_split_frequency), false));
|
||||||
|
|
||||||
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
|
||||||
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_recording));
|
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_recording));
|
||||||
|
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_voice_frequency), 1, true, true));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_voice_frequency), 1, true, true));
|
||||||
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_split_frequency), 1, true, true));
|
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_split_frequency), 1, true, true));
|
||||||
}
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
|
EndToEndTestUtils.SOLO.goBack();
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks the voice frequency and split frequency menus during recording.
|
|
||||||
*/
|
|
||||||
public void testFrequencyMenu_underRecording() {
|
|
||||||
EndToEndTestUtils.startRecording();
|
|
||||||
assertTrue(EndToEndTestUtils.findMenuItem(
|
|
||||||
activityMyTracks.getString(R.string.menu_voice_frequency), false));
|
|
||||||
assertTrue(EndToEndTestUtils.findMenuItem(
|
|
||||||
activityMyTracks.getString(R.string.menu_split_frequency), false));
|
|
||||||
EndToEndTestUtils.stopRecording(true);
|
EndToEndTestUtils.stopRecording(true);
|
||||||
|
|
||||||
assertFalse(EndToEndTestUtils.findMenuItem(
|
assertFalse(EndToEndTestUtils.findMenuItem(
|
||||||
activityMyTracks.getString(R.string.menu_voice_frequency), false));
|
activityMyTracks.getString(R.string.menu_voice_frequency), false));
|
||||||
assertFalse(EndToEndTestUtils.findMenuItem(
|
assertFalse(EndToEndTestUtils.findMenuItem(
|
||||||
activityMyTracks.getString(R.string.menu_split_frequency), false));
|
activityMyTracks.getString(R.string.menu_split_frequency), false));
|
||||||
|
|
||||||
|
EndToEndTestUtils.findMenuItem(activityMyTracks.getString(R.string.menu_settings), true);
|
||||||
|
EndToEndTestUtils.SOLO.clickOnText(activityMyTracks.getString(R.string.settings_recording));
|
||||||
|
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_voice_frequency), 1, true, true));
|
||||||
|
assertTrue(EndToEndTestUtils.SOLO.searchText(activityMyTracks.getString(R.string.menu_split_frequency), 1, true, true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user