Search in sources :

Example 11 with WidgetValueChangedListener

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

the class GeoTraceWidgetTest method clearAnswer_callsValueChangeListeners.

@Test
public void clearAnswer_callsValueChangeListeners() {
    GeoTraceWidget 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 12 with WidgetValueChangedListener

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

the class RangeIntegerWidgetTest method changingSliderValueProgramatically_doesNotCallValueChangeListener.

@Test
public void changingSliderValueProgramatically_doesNotCallValueChangeListener() {
    RangeIntegerWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.slider.setValue(4);
    verify(valueChangedListener, never()).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 13 with WidgetValueChangedListener

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

the class RangeIntegerWidgetTest method changingSliderValue_callsValueChangeListener.

@Test
public void changingSliderValue_callsValueChangeListener() {
    RangeIntegerWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.slider.onTouchEvent(motionEvent);
    verify(valueChangedListener).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 14 with WidgetValueChangedListener

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

the class RangeDecimalWidgetTest method changingSliderValueProgramatically_doesNotCallValueChangeListener.

@Test
public void changingSliderValueProgramatically_doesNotCallValueChangeListener() {
    RangeDecimalWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, null));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.slider.setValue(2.5F);
    verify(valueChangedListener, never()).widgetValueChanged(widget);
}
Also used : WidgetValueChangedListener(org.odk.collect.android.listeners.WidgetValueChangedListener) Test(org.junit.Test)

Example 15 with WidgetValueChangedListener

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

the class RatingWidgetTest method clearAnswer_callsValueChangeListeners.

@Test
public void clearAnswer_callsValueChangeListeners() {
    RatingWidget widget = createWidget(promptWithQuestionAndAnswer(rangeQuestion, new StringData("3")));
    WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
    widget.setValueChangedListener(valueChangedListener);
    widget.clearAnswer();
    verify(valueChangedListener, atLeastOnce()).widgetValueChanged(widget);
}
Also used : StringData(org.javarosa.core.model.data.StringData) 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