Search in sources :

Example 16 with WidgetValueChangedListener

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

the class RatingWidgetTest method changingRating_callsValueChangeListeners_forRatingBarInMultipleLines.

@Test
public void changingRating_callsValueChangeListeners_forRatingBarInMultipleLines() {
    when(rangeQuestion.getRangeEnd()).thenReturn(BigDecimal.valueOf(10));
    RatingWidget widget = createWidget(promptWithQuestionAndAnswer(rangeQuestion, null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.setValueChangedListener(valueChangedListener);
    widget.binding.ratingBar2.setRating(4.0F);
    verify(valueChangedListener, atLeastOnce()).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 17 with WidgetValueChangedListener

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

the class GeoPointMapWidgetTest method setData_callsValueChangeListener.

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

Example 18 with WidgetValueChangedListener

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

the class GeoPointMapWidgetTest method clearAnswer_callsValueChangeListeners.

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

Example 19 with WidgetValueChangedListener

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

the class GeoShapeWidgetTest method clearAnswer_callsValueChangeListeners.

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

Example 20 with WidgetValueChangedListener

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

the class DateWidgetTest method clearAnswer_callsValueChangeListener.

@Test
public void clearAnswer_callsValueChangeListener() {
    DateWidget widget = createWidget(promptWithQuestionDefAndAnswer(questionDef, new DateData(dateAnswer.toDate())));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.clearAnswer();
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : DateData(org.javarosa.core.model.data.DateData) 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