diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_above.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_above.png new file mode 100644 index 000000000..5bd20a34f Binary files /dev/null and b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_above.png differ diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_below.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_below.png new file mode 100644 index 000000000..ac4c0f5c9 Binary files /dev/null and b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_below.png differ diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_between.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_between.png new file mode 100644 index 000000000..b407ccd62 Binary files /dev/null and b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_at_most_between.png differ diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_below.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_below.png index e5a98fc89..5f6bf8c65 100644 Binary files a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_below.png and b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_below.png differ diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_between.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_between.png new file mode 100644 index 000000000..e5a98fc89 Binary files /dev/null and b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_between.png differ diff --git a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_zero.png b/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_zero.png deleted file mode 100644 index 5f6bf8c65..000000000 Binary files a/uhabits-android/src/androidTest/assets/views/habits/list/NumberButtonView/render_zero.png and /dev/null differ diff --git a/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/list/views/NumberButtonViewTest.kt b/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/list/views/NumberButtonViewTest.kt index c06aa5fb3..83609c9a0 100644 --- a/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/list/views/NumberButtonViewTest.kt +++ b/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/list/views/NumberButtonViewTest.kt @@ -44,7 +44,7 @@ class NumberButtonViewTest : BaseViewTest() { view = component.getNumberButtonViewFactory().create().apply { units = "steps" targetType = NumericalHabitType.AT_LEAST - lowerThreshold = 0.0 + lowerThreshold = 50.0 higherThreshold = 100.0 color = PaletteUtils.getAndroidTestColor(8) onEdit = { edited = true } @@ -71,28 +71,49 @@ class NumberButtonViewTest : BaseViewTest() { } @Test - fun testRender_aboveThreshold() { + fun testRender_aboveHigherThreshold() { view.value = 500.0 assertRenders(view, "$PATH/render_above.png") } @Test - fun testRender_emptyUnits() { + fun testRender_atMostAboveHigherThreshold() { view.value = 500.0 - view.units = "" - assertRenders(view, "$PATH/render_unitless.png") + view.targetType = NumericalHabitType.AT_MOST + assertRenders(view, "$PATH/render_at_most_above.png") } @Test - fun testRender_belowThreshold() { + fun testRender_betweenThresholds() { view.value = 99.0 + assertRenders(view, "$PATH/render_between.png") + } + + @Test + fun testRender_atMostBetweenThresholds() { + view.value = 99.0 + view.targetType = NumericalHabitType.AT_MOST + assertRenders(view, "$PATH/render_at_most_between.png") + } + + @Test + fun testRender_belowLowerThreshold() { + view.value = 0.0 assertRenders(view, "$PATH/render_below.png") } @Test - fun testRender_zero() { + fun testRender_atMostBelowLowerThreshold() { view.value = 0.0 - assertRenders(view, "$PATH/render_zero.png") + view.targetType = NumericalHabitType.AT_MOST + assertRenders(view, "$PATH/render_at_most_below.png") + } + + @Test + fun testRender_emptyUnits() { + view.value = 500.0 + view.units = "" + assertRenders(view, "$PATH/render_unitless.png") } @Test