Search in sources :

Example 1 with IntentLauncher

use of org.odk.collect.androidshared.system.IntentLauncher in project collect by opendatakit.

the class ExImageWidgetTest method setup.

@Before
public void setup() {
    mediaUtils = mock(MediaUtils.class);
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
            return mediaUtils;
        }
    });
    when(mediaUtils.isImageFile(any())).thenReturn(true);
}
Also used : IntentLauncher(org.odk.collect.androidshared.system.IntentLauncher) MediaUtils(org.odk.collect.android.utilities.MediaUtils) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Before(org.junit.Before)

Example 2 with IntentLauncher

use of org.odk.collect.androidshared.system.IntentLauncher in project collect by opendatakit.

the class VideoWidgetTest method buttonsShouldLaunchCorrectIntents.

@Test
public void buttonsShouldLaunchCorrectIntents() {
    MediaUtils mediaUtils = mock(MediaUtils.class);
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
            return mediaUtils;
        }
    });
    stubAllRuntimePermissionsGranted(true);
    Intent intent = getIntentLaunchedByClick(R.id.capture_video);
    assertActionEquals(MediaStore.ACTION_VIDEO_CAPTURE, intent);
    intent = getIntentLaunchedByClick(R.id.choose_video);
    assertActionEquals(Intent.ACTION_GET_CONTENT, intent);
    assertTypeEquals("video/*", intent);
    getIntentLaunchedByClick(R.id.play_video);
    verify(mediaUtils).openFile(any(), any(), any());
}
Also used : IntentLauncher(org.odk.collect.androidshared.system.IntentLauncher) MediaUtils(org.odk.collect.android.utilities.MediaUtils) Intent(android.content.Intent) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Test(org.junit.Test) FileWidgetTest(org.odk.collect.android.widgets.base.FileWidgetTest)

Example 3 with IntentLauncher

use of org.odk.collect.androidshared.system.IntentLauncher in project collect by opendatakit.

the class ArbitraryFileWidgetTest method setup.

@Before
public void setup() {
    mediaUtils = mock(MediaUtils.class);
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
            return mediaUtils;
        }
    });
    when(mediaUtils.isAudioFile(any())).thenReturn(true);
}
Also used : IntentLauncher(org.odk.collect.androidshared.system.IntentLauncher) MediaUtils(org.odk.collect.android.utilities.MediaUtils) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Before(org.junit.Before)

Example 4 with IntentLauncher

use of org.odk.collect.androidshared.system.IntentLauncher in project collect by opendatakit.

the class ExVideoWidgetTest method setup.

@Before
public void setup() {
    mediaUtils = mock(MediaUtils.class);
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
            return mediaUtils;
        }
    });
    when(mediaUtils.isVideoFile(any())).thenReturn(true);
}
Also used : IntentLauncher(org.odk.collect.androidshared.system.IntentLauncher) MediaUtils(org.odk.collect.android.utilities.MediaUtils) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Before(org.junit.Before)

Example 5 with IntentLauncher

use of org.odk.collect.androidshared.system.IntentLauncher in project collect by opendatakit.

the class ExAudioWidgetTest method setup.

@Before
public void setup() {
    mediaUtils = mock(MediaUtils.class);
    CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {

        @Override
        public MediaUtils providesMediaUtils(IntentLauncher intentLauncher) {
            return mediaUtils;
        }
    });
    when(mediaUtils.isAudioFile(any())).thenReturn(true);
}
Also used : IntentLauncher(org.odk.collect.androidshared.system.IntentLauncher) MediaUtils(org.odk.collect.android.utilities.MediaUtils) AppDependencyModule(org.odk.collect.android.injection.config.AppDependencyModule) Before(org.junit.Before)

Aggregations

AppDependencyModule (org.odk.collect.android.injection.config.AppDependencyModule)6 MediaUtils (org.odk.collect.android.utilities.MediaUtils)6 IntentLauncher (org.odk.collect.androidshared.system.IntentLauncher)6 Before (org.junit.Before)5 Intent (android.content.Intent)1 Test (org.junit.Test)1 FileWidgetTest (org.odk.collect.android.widgets.base.FileWidgetTest)1