use of android.content.Intent in project materialistic by hidroh.
the class FavoriteActivityTest method testShare.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Test
public void testShare() {
TestApplication.addResolver(new Intent(Intent.ACTION_SEND));
shadowAdapter.getViewHolder(0).itemView.findViewById(R.id.button_more).performClick();
PopupMenu popupMenu = ShadowPopupMenu.getLatestPopupMenu();
Assert.assertNotNull(popupMenu);
shadowOf(popupMenu).getOnMenuItemClickListener().onMenuItemClick(new RoboMenuItem(R.id.menu_contextual_share));
assertThat(shadowOf(activity).getNextStartedActivity()).hasAction(Intent.ACTION_SEND);
}
use of android.content.Intent in project materialistic by hidroh.
the class ItemActivityTest method testFullscreen.
@Config(shadows = { ShadowFloatingActionButton.class })
@Test
public void testFullscreen() {
Intent intent = new Intent();
WebItem webItem = new TestWebItem() {
@Override
public String getUrl() {
return "http://example.com";
}
@Override
public String getId() {
return "1";
}
};
intent.putExtra(ItemActivity.EXTRA_ITEM, webItem);
controller.withIntent(intent).create().start().resume().visible();
ShadowFloatingActionButton shadowFab = (ShadowFloatingActionButton) ShadowExtractor.extract(activity.findViewById(R.id.reply_button));
assertTrue(shadowFab.isVisible());
ShadowLocalBroadcastManager.getInstance(activity).sendBroadcast(new Intent(WebFragment.ACTION_FULLSCREEN).putExtra(WebFragment.EXTRA_FULLSCREEN, true));
assertFalse(shadowFab.isVisible());
ShadowLocalBroadcastManager.getInstance(activity).sendBroadcast(new Intent(WebFragment.ACTION_FULLSCREEN).putExtra(WebFragment.EXTRA_FULLSCREEN, false));
assertTrue(shadowFab.isVisible());
}
use of android.content.Intent in project materialistic by hidroh.
the class ItemActivityTest method testFullscreenBackPressed.
@Test
public void testFullscreenBackPressed() {
Intent intent = new Intent();
WebItem webItem = new TestWebItem() {
@Override
public String getUrl() {
return "http://example.com";
}
@Override
public String getId() {
return "1";
}
};
intent.putExtra(ItemActivity.EXTRA_ITEM, webItem);
controller.withIntent(intent).create().start().resume().visible();
ShadowLocalBroadcastManager.getInstance(activity).sendBroadcast(new Intent(WebFragment.ACTION_FULLSCREEN).putExtra(WebFragment.EXTRA_FULLSCREEN, true));
activity.onBackPressed();
assertThat(activity).isNotFinishing();
activity.onBackPressed();
assertThat(activity).isFinishing();
}
use of android.content.Intent in project materialistic by hidroh.
the class ItemActivityTest method testCustomScheme.
@Test
public void testCustomScheme() {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse(BuildConfig.APPLICATION_ID + "://item/1"));
controller.withIntent(intent).create().start().resume();
verify(hackerNewsClient).getItem(eq("1"), eq(ItemManager.MODE_DEFAULT), any(ResponseListener.class));
}
use of android.content.Intent in project materialistic by hidroh.
the class ItemActivityTest method testBackPressed.
@Test
public void testBackPressed() {
Intent intent = new Intent();
WebItem webItem = new TestWebItem() {
@Override
public String getUrl() {
return "http://example.com";
}
@Override
public String getId() {
return "1";
}
};
intent.putExtra(ItemActivity.EXTRA_ITEM, webItem);
controller.withIntent(intent).create().start().resume().visible();
activity.onKeyDown(KeyEvent.KEYCODE_BACK, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_BACK));
verify(keyDelegate).setBackInterceptor(any());
verify(keyDelegate).onKeyDown(anyInt(), any(KeyEvent.class));
}
Aggregations