use of android.widget.EditText in project materialistic by hidroh.
the class ComposeActivityTest method testExitSaveDraft.
@Test
public void testExitSaveDraft() {
((EditText) activity.findViewById(R.id.edittext_body)).setText("Reply");
shadowOf(activity).clickMenuItem(android.R.id.home);
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).performClick();
assertThat(activity).isFinishing();
assertThat(Preferences.getDraft(activity, "1")).contains("Reply");
}
use of android.widget.EditText in project materialistic by hidroh.
the class ComposeActivityTest method testExitDiscardDraft.
@Test
public void testExitDiscardDraft() {
((EditText) activity.findViewById(R.id.edittext_body)).setText("Reply");
shadowOf(activity).clickMenuItem(android.R.id.home);
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE).performClick();
assertThat(activity).isFinishing();
assertThat(Preferences.getDraft(activity, "1")).isNullOrEmpty();
}
use of android.widget.EditText in project materialistic by hidroh.
the class SubmitActivityTest method testSubmitText.
@Test
public void testSubmitText() {
((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
((EditText) activity.findViewById(R.id.edittext_content)).setText("content");
shadowOf(activity).clickMenuItem(R.id.menu_send);
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertEquals(activity.getString(R.string.confirm_submit_question), shadowOf(alertDialog).getMessage());
}
use of android.widget.EditText in project materialistic by hidroh.
the class SubmitActivityTest method testSubmitUrl.
@Test
public void testSubmitUrl() {
((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
((EditText) activity.findViewById(R.id.edittext_content)).setText("http://example.com");
shadowOf(activity).clickMenuItem(R.id.menu_send);
AlertDialog alertDialog = ShadowAlertDialog.getLatestAlertDialog();
assertNotNull(alertDialog);
assertEquals(activity.getString(R.string.confirm_submit_url), shadowOf(alertDialog).getMessage());
}
use of android.widget.EditText in project materialistic by hidroh.
the class SubmitActivityTest method testSubmitDelayedError.
@Test
public void testSubmitDelayedError() {
((EditText) activity.findViewById(R.id.edittext_title)).setText("title");
((EditText) activity.findViewById(R.id.edittext_content)).setText("http://example.com");
shadowOf(activity).clickMenuItem(R.id.menu_send);
ShadowAlertDialog.getLatestAlertDialog().getButton(DialogInterface.BUTTON_POSITIVE).performClick();
verify(userServices).submit(any(Context.class), eq("title"), eq("http://example.com"), eq(true), submitCallback.capture());
shadowOf(activity).clickMenuItem(android.R.id.home);
ShadowAlertDialog.getLatestAlertDialog().getButton(DialogInterface.BUTTON_POSITIVE).performClick();
submitCallback.getValue().onError(new IOException());
assertEquals(activity.getString(R.string.submit_failed), ShadowToast.getTextOfLatestToast());
}
Aggregations