Exemplo n.º 1
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    Date tempDate = Calendar.getInstance().getTime();
    Picture tempPic = new Picture("temp", "temp", "temp", tempDate, new ArrayList<Tag>());

    // The EditPictureActivity will only use the ID of the given picture, as set below
    tempPic.setID(1);

    Intent editPicIntent = new Intent();
    editPicIntent.setClassName(
        "com.cs301w01.meatload", "com.cs301w01.meatload.activities.EditPicturesActivity");

    editPicIntent.putExtra("picture", tempPic);
    setActivityIntent(editPicIntent);

    mActivity = getActivity();
    mContext = mActivity.getBaseContext();
  }
Exemplo n.º 2
0
  public void testEditNameThenSave() {
    final Button saveButton =
        (Button) mActivity.findViewById(com.cs301w01.meatload.R.id.savePictureButton);
    assertNotNull(saveButton);

    final EditText pictureName = (EditText) mActivity.findViewById(R.id.pictureNameEditText);
    assertNotNull(pictureName);

    mActivity.runOnUiThread(
        new Runnable() {
          public void run() {
            pictureName.requestFocus();
            pictureName.setText("Moley Mole");
            saveButton.requestFocus();
            saveButton.performClick();
          }
        });
    sleep();

    PictureQueryGenerator picGen = new PictureQueryGenerator(mContext);
    Picture newPic = picGen.selectPictureByID(1);
    assertTrue(newPic.getName().equals("Moley Mole"));
  }