Search in sources :

Example 1 with IAccentColorController

use of com.waz.zclient.controllers.accentcolor.IAccentColorController in project wire-android by wireapp.

the class ConversationFragmentTest method assertCursorImagesGalleryButton.

@TargetApi(Build.VERSION_CODES.KITKAT)
public void assertCursorImagesGalleryButton() throws Exception {
    IConversation mockConversation = mock(IConversation.class);
    when(mockConversation.getType()).thenReturn(IConversation.Type.GROUP);
    when(mockConversation.isMemberOfConversation()).thenReturn(true);
    when(mockConversation.isActive()).thenReturn(true);
    IAccentColorController mockAccentColorController = activity.getControllerFactory().getAccentColorController();
    AccentColor mockAccentColor = mock(AccentColor.class);
    when(mockAccentColor.getColor()).thenReturn(Color.RED);
    when(mockAccentColorController.getAccentColor()).thenReturn(mockAccentColor);
    String action = Intent.ACTION_OPEN_DOCUMENT;
    Matcher<Intent> expectedIntent = allOf(hasAction(action), hasType("image/*"));
    Intent intent = new Intent();
    intent.setData(Uri.parse("file:///tmp/whatever.txt"));
    Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, intent);
    intending(expectedIntent).respondWith(result);
    MockHelper.setupConversationMocks(mockConversation, activity);
    attachFragment(ConversationFragment.newInstance(), ConversationFragment.TAG);
    onView(withId(R.id.cursor_menu_item_camera)).check(isVisible());
    onView(withId(R.id.cursor_menu_item_camera)).perform(click());
    Thread.sleep(500);
    onView(withId(R.id.rv__cursor_images)).check(isVisible());
    onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).check(isVisible());
//        onView(withId(R.id.gtv__cursor_image__nav_open_gallery)).perform(click());
}
Also used : AccentColor(com.waz.api.AccentColor) Instrumentation(android.app.Instrumentation) IConversation(com.waz.api.IConversation) Intent(android.content.Intent) IAccentColorController(com.waz.zclient.controllers.accentcolor.IAccentColorController) TargetApi(android.annotation.TargetApi)

Aggregations

TargetApi (android.annotation.TargetApi)1 Instrumentation (android.app.Instrumentation)1 Intent (android.content.Intent)1 AccentColor (com.waz.api.AccentColor)1 IConversation (com.waz.api.IConversation)1 IAccentColorController (com.waz.zclient.controllers.accentcolor.IAccentColorController)1