use of org.javarosa.core.reference.ReferenceManager in project collect by opendatakit.
the class SignatureWidgetTest method whenPromptHasDefaultAnswer_showsInImageView.
@Test
public void whenPromptHasDefaultAnswer_showsInImageView() throws Exception {
String imagePath = File.createTempFile("default", ".bmp").getAbsolutePath();
ReferenceManager referenceManager = setupFakeReferenceManager(singletonList(new Pair<>(DrawWidgetTest.DEFAULT_IMAGE_ANSWER, imagePath)));
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public ReferenceManager providesReferenceManager() {
return referenceManager;
}
@Override
public ImageLoader providesImageLoader() {
return new SynchronousImageLoader();
}
});
formEntryPrompt = new MockFormEntryPromptBuilder().withAnswerDisplayText(DrawWidgetTest.DEFAULT_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.javarosa.core.reference.ReferenceManager in project collect by opendatakit.
the class PromptAutoplayerTest method setup.
@Before
public void setup() throws Exception {
ReferenceManager referenceManager = setupFakeReferenceManager(REFERENCES);
autoplayer = new PromptAutoplayer(audioHelper, referenceManager);
}
use of org.javarosa.core.reference.ReferenceManager in project collect by opendatakit.
the class ChoicesRecyclerViewTest method setUpReferenceManager.
private void setUpReferenceManager() throws InvalidReferenceException {
referenceManager = mock(ReferenceManager.class);
Reference reference = mock(Reference.class);
when(reference.getLocalURI()).thenReturn("");
when(referenceManager.deriveReference(any())).thenReturn(reference);
}
use of org.javarosa.core.reference.ReferenceManager in project collect by opendatakit.
the class ImageWidgetTest method whenPromptHasDefaultAnswer_doesNotShow.
@Test
public void whenPromptHasDefaultAnswer_doesNotShow() throws Exception {
String imagePath = File.createTempFile("default", ".bmp").getAbsolutePath();
ReferenceManager referenceManager = setupFakeReferenceManager(singletonList(new Pair<>(DrawWidgetTest.DEFAULT_IMAGE_ANSWER, imagePath)));
CollectHelpers.overrideAppDependencyModule(new AppDependencyModule() {
@Override
public ReferenceManager providesReferenceManager() {
return referenceManager;
}
@Override
public ImageLoader providesImageLoader() {
return new SynchronousImageLoader();
}
});
formEntryPrompt = new MockFormEntryPromptBuilder().withAnswerDisplayText(DrawWidgetTest.DEFAULT_IMAGE_ANSWER).build();
ImageWidget widget = createWidget();
ImageView imageView = widget.getImageView();
assertThat(imageView, nullValue());
}
use of org.javarosa.core.reference.ReferenceManager 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