use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class ExArbitraryFileWidgetTest 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);
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class SignatureWidgetTest method whenPromptHasCurrentAnswer_showsInImageView.
@Test
public void whenPromptHasCurrentAnswer_showsInImageView() throws Exception {
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public ImageLoader providesImageLoader() {
return new SynchronousImageLoader();
}
});
String imagePath = File.createTempFile("current", ".bmp").getAbsolutePath();
currentFile = new File(imagePath);
formEntryPrompt = new MockFormEntryPromptBuilder().withAnswerDisplayText(DrawWidgetTest.USER_SPECIFIED_IMAGE_ANSWER).build();
SignatureWidget widget = createWidget();
ImageView imageView = widget.getImageView();
assertThat(imageView, notNullValue());
Drawable drawable = imageView.getDrawable();
assertThat(drawable, notNullValue());
String loadedPath = shadowOf(((BitmapDrawable) drawable).getBitmap()).getCreatedFromPath();
assertThat(loadedPath, equalTo(imagePath));
}
use of org.odk.collect.android.injection.config.AppDependencyModule in project collect by opendatakit.
the class SelectImageMapWidgetTest method overrideDependencyModule.
private void overrideDependencyModule() throws Exception {
ReferenceManager referenceManager = setupFakeReferenceManager(asList(new Pair<>("jr://images/body.svg", "body.svg")));
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public ReferenceManager providesReferenceManager() {
return referenceManager;
}
});
}
Aggregations