Search in sources :

Example 21 with WidgetValueChangedListener

use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.

the class AudioWidgetTest method setData_whenFileExists_callsValueChangeListener.

@Test
public void setData_whenFileExists_callsValueChangeListener() throws Exception {
    AudioWidget widget = createWidget(promptWithAnswer(null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    File newFile = questionMediaManager.addAnswerFile(File.createTempFile("blah", ".mp3"));
    widget.setData(newFile);
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : File(java.io.File) WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 22 with WidgetValueChangedListener

use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.

the class BearingWidgetTest method setData_callsValueChangeListeners.

@Test
public void setData_callsValueChangeListeners() {
    BearingWidget widget = createWidget(promptWithAnswer(null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.setData("blah");
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 23 with WidgetValueChangedListener

use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.

the class GeoShapeWidgetTest method setData_callsValueChangeListener.

@Test
public void setData_callsValueChangeListener() {
    GeoShapeWidget widget = createWidget(promptWithAnswer(null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.setData(answer);
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 24 with WidgetValueChangedListener

use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.

the class QuestionWidgetHelpers method mockValueChangedListener.

public static <T extends QuestionWidget> WidgetValueChangedListener mockValueChangedListener(T widget) {
    WidgetValueChangedListener valueChangedListener = mock(WidgetValueChangedListener.class);
    widget.setValueChangedListener(valueChangedListener);
    return valueChangedListener;
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener)

Example 25 with WidgetValueChangedListener

use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.

the class TimeWidgetTest method clearAnswer_callsValueChangeListener.

@Test
public void clearAnswer_callsValueChangeListener() {
    TimeWidget widget = createWidget(promptWithQuestionDefAndAnswer(questionDef, new TimeData(timeAnswer.toDateTime().toDate())));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.clearAnswer();
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : TimeData(org.javarosa.core.model.data.TimeData) WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Aggregations

WidgetValueChangedListener (org.odk.collect.android.listeners.WidgetValueChangedListener)35 Test (org.junit.Test)34 StringData (org.javarosa.core.model.data.StringData)6 File (java.io.File)2 Selection (org.javarosa.core.model.data.helper.Selection)2 CheckBox (android.widget.CheckBox)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1 DateData (org.javarosa.core.model.data.DateData)1 DateTimeData (org.javarosa.core.model.data.DateTimeData)1 SelectMultiData (org.javarosa.core.model.data.SelectMultiData)1 SelectOneData (org.javarosa.core.model.data.SelectOneData)1 TimeData (org.javarosa.core.model.data.TimeData)1 QuestionWidget (org.odk.collect.android.widgets.QuestionWidget)1 GeneralSelectMultiWidgetTest (org.odk.collect.android.widgets.base.GeneralSelectMultiWidgetTest)1 GeneralSelectOneWidgetTest (org.odk.collect.android.widgets.base.GeneralSelectOneWidgetTest)1