Search in sources :

Example 1 with TestListActivity

use of io.github.hidroh.materialistic.test.TestListActivity in project materialistic by hidroh.

the class AppUtilsTest method testFullscreenButton.

@Test
public void testFullscreenButton() {
    ActivityController<TestListActivity> controller = Robolectric.buildActivity(TestListActivity.class);
    TestListActivity activity = controller.create().get();
    FloatingActionButton fab = new FloatingActionButton(activity);
    AppUtils.toggleFabAction(fab, null, false);
    fab.performClick();
    assertThat(shadowOf(LocalBroadcastManager.getInstance(activity)).getSentBroadcastIntents()).isNotEmpty();
    controller.destroy();
}
Also used : TestListActivity(io.github.hidroh.materialistic.test.TestListActivity) FloatingActionButton(android.support.design.widget.FloatingActionButton) Test(org.junit.Test)

Example 2 with TestListActivity

use of io.github.hidroh.materialistic.test.TestListActivity in project materialistic by hidroh.

the class AppUtilsTest method testOpenExternalComment.

@Test
public void testOpenExternalComment() {
    ActivityController<TestListActivity> controller = Robolectric.buildActivity(TestListActivity.class);
    TestListActivity activity = controller.create().get();
    AppUtils.openExternal(activity, mock(PopupMenu.class), new View(activity), new TestHnItem(1), null);
    assertNull(ShadowAlertDialog.getLatestAlertDialog());
    AppUtils.openExternal(activity, mock(PopupMenu.class), new View(activity), new TestHnItem(1) {

        @Override
        public String getUrl() {
            return String.format(HackerNewsClient.WEB_ITEM_PATH, "1");
        }
    }, null);
    assertNull(ShadowAlertDialog.getLatestAlertDialog());
    controller.destroy();
}
Also used : TestListActivity(io.github.hidroh.materialistic.test.TestListActivity) TestHnItem(io.github.hidroh.materialistic.data.TestHnItem) View(android.view.View) TextView(android.widget.TextView) PopupMenu(io.github.hidroh.materialistic.widget.PopupMenu) Test(org.junit.Test)

Aggregations

TestListActivity (io.github.hidroh.materialistic.test.TestListActivity)2 Test (org.junit.Test)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 View (android.view.View)1 TextView (android.widget.TextView)1 TestHnItem (io.github.hidroh.materialistic.data.TestHnItem)1 PopupMenu (io.github.hidroh.materialistic.widget.PopupMenu)1