Search in sources :

Example 1 with ShadowFloatingActionButton

use of io.github.hidroh.materialistic.test.shadow.ShadowFloatingActionButton 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());
}
Also used : ShadowFloatingActionButton(io.github.hidroh.materialistic.test.shadow.ShadowFloatingActionButton) TestWebItem(io.github.hidroh.materialistic.test.TestWebItem) WebItem(io.github.hidroh.materialistic.data.WebItem) Intent(android.content.Intent) TestWebItem(io.github.hidroh.materialistic.test.TestWebItem) SlowTest(io.github.hidroh.materialistic.test.suite.SlowTest) Test(org.junit.Test) Config(org.robolectric.annotation.Config)

Aggregations

Intent (android.content.Intent)1 WebItem (io.github.hidroh.materialistic.data.WebItem)1 TestWebItem (io.github.hidroh.materialistic.test.TestWebItem)1 ShadowFloatingActionButton (io.github.hidroh.materialistic.test.shadow.ShadowFloatingActionButton)1 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)1 Test (org.junit.Test)1 Config (org.robolectric.annotation.Config)1