Beispiel #1
0
  /** Upon adding a new podcast to the DAO, it should be displayed in the podcast list. */
  public void testAddPodcast() {
    Podcast p = insertPodcast();

    while (solo.scrollDown()) ;

    assertTrue(
        String.format("New podcast %s should be displayed in list", uuid), solo.searchText(uuid));
    assertTrue(
        String.format("New podcast %s should be in DAO", uuid),
        dao.getPodcastById(p.getId()) != null);
  }
 private boolean scrollDown() {
   int index = 0;
   while (index < 5) {
     if (solo.scrollDown()) return true;
     index++;
     try {
       Thread.sleep(250);
     } catch (InterruptedException e) {
     }
   }
   return false;
 }
Beispiel #3
0
  public void testRotation() {
    Podcast p = insertPodcast();

    solo.setActivityOrientation(Solo.LANDSCAPE);
    while (solo.scrollDown()) ;

    assertTrue(
        String.format("New podcast %s should be displayed in list", uuid), solo.searchText(uuid));
    assertTrue(
        String.format("New podcast %s should be in DAO", uuid),
        dao.getPodcastById(p.getId()) != null);
  }
Beispiel #4
0
 /** Traverses the items in listItems in order in the menu. */
 public void selectMenuItemByPath(String[] listItems) {
   int listLength = listItems.length;
   if (listLength > 0) {
     selectMenuItem(listItems[0]);
   }
   if (listLength > 1) {
     for (int i = 1; i < listLength; i++) {
       String itemName = "^" + listItems[i] + "$";
       if (!waitForEnabledText(itemName)) {
         mSolo.scrollDown();
       }
       mSolo.clickOnText(itemName);
     }
   }
 }
Beispiel #5
0
  /**
   * After deleting the newly added podcast, it should not be displayed in the podcast list, and
   * should not be contained in the podcast DAO.
   */
  public void testRemovePodcast() {
    Podcast p = insertPodcast();

    while (solo.scrollDown()) ;

    solo.clickLongOnText(uuid);
    solo.clickOnText(getActivity().getString(at.ac.tuwien.detlef.R.string.delete_feed));

    assertFalse(
        String.format("Deleted podcast %s should not be displayed in list", uuid),
        solo.searchText(uuid));
    assertFalse(
        String.format("Deleted podcast %s should not be in DAO", uuid),
        dao.getPodcastById(p.getId()) != null);
  }
Beispiel #6
0
 private void injectInteraction(View v, String interactionType, String value) {
   if (v != null) {
     requestView(v);
   }
   if (interactionType.equals(CLICK)) {
     click(v);
   } else if (interactionType.equals(LONG_CLICK)) {
     longClick(v);
   } else if (interactionType.equals(BACK)) {
     solo.goBack();
   } else if (interactionType.equals(CHANGE_ORIENTATION)) {
     changeOrientation();
   } else if (interactionType.equals(CLICK_ON_TEXT)) {
     clickOnText(value);
   } else if (interactionType.equals(PRESS_KEY)) {
     pressKey(value);
   } else if (interactionType.equals(OPEN_MENU)) {
     solo.sendKey(Solo.MENU);
   } else if (interactionType.equals(SCROLL_DOWN)) {
     solo.scrollDown();
   } else if (interactionType.equals(SWAP_TAB) && (value != null)) {
     if (v instanceof TabHost) {
       swapTab((TabHost) v, value);
     } else {
       swapTab(this.tabs, value);
     }
   } else if (interactionType.equals(LIST_SELECT)) {
     selectListItem((ListView) v, value);
   } else if (interactionType.equals(LIST_LONG_SELECT)) {
     selectListItem((ListView) v, value, true);
   } else if (interactionType.equals(SPINNER_SELECT)) {
     selectSpinnerItem((Spinner) v, value);
   } else if (interactionType.equals(TYPE_TEXT)) {
     typeText((EditText) v, value);
   } else if (interactionType.equals(WRITE_TEXT)) {
     writeText((EditText) v, value);
   } else if (interactionType.equals(SET_BAR)) {
     solo.setProgressBar((ProgressBar) v, Integer.parseInt(value));
   } else {
     return;
   }
 }