From fa7bc271248f737153a6d383aa6f9c1c2b083baf Mon Sep 17 00:00:00 2001 From: Rechee Date: Wed, 8 Jan 2020 19:36:54 -0800 Subject: [PATCH] add test for notes Card --- .../habits/show/views/NotesCardTest.kt | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 android/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/show/views/NotesCardTest.kt diff --git a/android/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/show/views/NotesCardTest.kt b/android/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/show/views/NotesCardTest.kt new file mode 100644 index 000000000..24517aa4b --- /dev/null +++ b/android/uhabits-android/src/androidTest/java/org/isoron/uhabits/activities/habits/show/views/NotesCardTest.kt @@ -0,0 +1,49 @@ +package org.isoron.uhabits.activities.habits.show.views + +import android.view.LayoutInflater +import android.view.View +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.filters.MediumTest +import org.isoron.uhabits.BaseViewTest +import org.isoron.uhabits.R +import org.isoron.uhabits.core.models.Habit +import org.isoron.uhabits.core.models.Reminder +import org.isoron.uhabits.core.models.WeekdayList +import org.junit.Before +import org.junit.Ignore +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +@MediumTest +class NotesCardTest: BaseViewTest() { + + val PATH = "habits/show/NotesCard/" + + private lateinit var view: SubtitleCard + + private lateinit var habit: Habit + + @Before + override fun setUp() { + super.setUp() + habit = fixtures.createLongHabit() + habit.setReminder(Reminder(8, 30, WeekdayList.EVERY_DAY)) + view = LayoutInflater + .from(targetContext) + .inflate(R.layout.show_habit, null) + .findViewById(R.id.subtitleCard) as SubtitleCard + view.apply { + habit = habit + refreshData() + measureView(this, 800f, 200f) + } + } + + @Ignore("how do I generate these shots?") + @Test + @Throws(Exception::class) + fun testRender() { + assertRenders(view, SubtitleCardTest.PATH + "render.png") + } +} \ No newline at end of file