mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
fixed screenshot tests
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.7 KiB |
@@ -53,6 +53,7 @@ public class HabitFixtures
|
||||
Habit habit = modelFactory.buildHabit();
|
||||
habit.setName("Meditate");
|
||||
habit.setQuestion("Did you meditate this morning?");
|
||||
habit.setDescription("This is a test description");
|
||||
habit.setColor(5);
|
||||
habit.setFrequency(Frequency.DAILY);
|
||||
habit.setId(id);
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Álinson Santos Xavier <isoron@gmail.com>
|
||||
*
|
||||
* This file is part of Loop Habit Tracker.
|
||||
*
|
||||
* Loop Habit Tracker is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* Loop Habit Tracker is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.isoron.uhabits.activities.habits.show.views;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
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.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
@MediumTest
|
||||
public class NotesCardTest extends BaseViewTest
|
||||
{
|
||||
public static final String PATH = "habits/show/NotesCard/";
|
||||
|
||||
private NotesCard view;
|
||||
|
||||
private Habit habit;
|
||||
|
||||
@Before
|
||||
@Override
|
||||
public void setUp()
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
habit = fixtures.createLongHabit();
|
||||
habit.setReminder(new Reminder(8, 30, WeekdayList.EVERY_DAY));
|
||||
|
||||
view = LayoutInflater
|
||||
.from(targetContext)
|
||||
.inflate(R.layout.show_habit, null)
|
||||
.findViewById(R.id.notesCard);
|
||||
|
||||
view.setHabit(habit);
|
||||
view.refreshData();
|
||||
|
||||
measureView(view, 800, 200);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRender() throws Exception
|
||||
{
|
||||
assertRenders(view, PATH + "render.png");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRenderEmptyDescription() throws Exception
|
||||
{
|
||||
habit.setDescription("");
|
||||
view.refreshData();
|
||||
assertRenders(view, PATH + "render-empty-description.png");
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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<View>(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")
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class SubtitleCardTest extends BaseViewTest
|
||||
habit = fixtures.createLongHabit();
|
||||
habit.setReminder(new Reminder(8, 30, WeekdayList.EVERY_DAY));
|
||||
|
||||
view = (SubtitleCard) LayoutInflater
|
||||
view = LayoutInflater
|
||||
.from(targetContext)
|
||||
.inflate(R.layout.show_habit, null)
|
||||
.findViewById(R.id.subtitleCard);
|
||||
|
||||
@@ -7,7 +7,7 @@ import android.widget.TextView
|
||||
import org.isoron.uhabits.R
|
||||
import org.isoron.uhabits.core.tasks.Task
|
||||
|
||||
internal class NotesCard(context: Context?, attrs: AttributeSet?) : HabitCard(context, attrs) {
|
||||
class NotesCard(context: Context?, attrs: AttributeSet?) : HabitCard(context, attrs) {
|
||||
|
||||
private val notesTextView: TextView
|
||||
|
||||
|
||||
Reference in New Issue
Block a user