use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.
the class RangeDecimalWidgetTest method clearAnswer_callsValueChangeListener.
@Test
public void clearAnswer_callsValueChangeListener() {
RangeDecimalWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, new StringData("2.5")));
WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
widget.clearAnswer();
verify(valueChangedListener).widgetValueChanged(widget);
}
use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.
the class RangeDecimalWidgetTest method changingSliderValue_callsValueChangeListener.
@Test
public void changingSliderValue_callsValueChangeListener() {
RangeDecimalWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, null));
WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
widget.slider.onTouchEvent(motionEvent);
verify(valueChangedListener).widgetValueChanged(widget);
}
use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.
the class RangePickerDecimalWidgetTest method clearAnswer_callsValueChangeListener.
@Test
public void clearAnswer_callsValueChangeListener() {
RangePickerDecimalWidget widget = createWidget(promptWithQuestionDefAndAnswer(rangeQuestion, null));
WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
widget.clearAnswer();
verify(valueChangedListener).widgetValueChanged(widget);
}
use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.
the class RatingWidgetTest method changingRating_callsValueChangeListeners_forRatingBarInSingleLine.
@Test
public void changingRating_callsValueChangeListeners_forRatingBarInSingleLine() {
RatingWidget widget = createWidget(promptWithQuestionAndAnswer(rangeQuestion, null));
WidgetValueChangedListener valueChangedListener = mockValueChangedListener(widget);
widget.setValueChangedListener(valueChangedListener);
widget.binding.ratingBar1.setRating(4.0F);
verify(valueChangedListener, atLeastOnce()).widgetValueChanged(widget);
}
use of org.odk.collect.android.listeners.WidgetValueChangedListener in project collect by opendatakit.
the class SelectOneMinimalWidgetTest method whenAnswerChanges_shouldValueChangeListenersBeCalled.
@Test
public void whenAnswerChanges_shouldValueChangeListenersBeCalled() {
WidgetValueChangedListener valueChangedListener = mockValueChangedListener(getSpyWidget());
SelectOneData answer = getInitialAnswer();
Selection selectedChoice = (Selection) answer.getValue();
getSpyWidget().setData(Collections.singletonList(selectedChoice));
verify(valueChangedListener).widgetValueChanged(getSpyWidget());
}
Aggregations