Fix failed view tests
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 6.3 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.3 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
@@ -48,6 +48,8 @@ public class BaseTest
|
||||
}
|
||||
|
||||
targetContext = InstrumentationRegistry.getTargetContext();
|
||||
targetContext.setTheme(R.style.AppBaseTheme);
|
||||
|
||||
testContext = InstrumentationRegistry.getContext();
|
||||
|
||||
DateHelper.setFixedLocalTime(FIXED_LOCAL_TIME);
|
||||
|
||||
@@ -52,7 +52,7 @@ public class HabitHistoryViewTest extends ViewTest
|
||||
|
||||
view = new HabitHistoryView(targetContext);
|
||||
view.setHabit(habit);
|
||||
measureView(dpToPixels(300), dpToPixels(100), view);
|
||||
measureView(dpToPixels(400), dpToPixels(200), view);
|
||||
refreshData(view);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ public class HabitHistoryViewTest extends ViewTest
|
||||
public void tapDate_withEditableView() throws Throwable
|
||||
{
|
||||
view.setIsEditable(true);
|
||||
tap(view, 270, 18); // today's square
|
||||
tap(view, 360, 36); // today's square
|
||||
waitForAsyncTasks();
|
||||
|
||||
long today = DateHelper.getStartOfToday();
|
||||
@@ -102,9 +102,9 @@ public class HabitHistoryViewTest extends ViewTest
|
||||
int expectedCheckmarkValues[] = habit.checkmarks.getAllValues();
|
||||
|
||||
view.setIsEditable(true);
|
||||
tap(view, 45, 5); // header
|
||||
tap(view, 270, 30); // tomorrow's square
|
||||
tap(view, 280, 30); // right axis
|
||||
tap(view, 118, 13); // header
|
||||
tap(view, 360, 60); // tomorrow's square
|
||||
tap(view, 390, 60); // right axis
|
||||
waitForAsyncTasks();
|
||||
|
||||
int actualCheckmarkValues[] = habit.checkmarks.getAllValues();
|
||||
@@ -115,7 +115,7 @@ public class HabitHistoryViewTest extends ViewTest
|
||||
public void tapDate_withReadOnlyView() throws Throwable
|
||||
{
|
||||
view.setIsEditable(false);
|
||||
tap(view, 270, 30);
|
||||
tap(view, 360, 36);
|
||||
waitForAsyncTasks();
|
||||
|
||||
long today = DateHelper.getStartOfToday();
|
||||
|
||||
@@ -49,7 +49,7 @@ public class HabitScoreViewTest extends ViewTest
|
||||
view.setHabit(habit);
|
||||
view.setBucketSize(7);
|
||||
refreshData(view);
|
||||
measureView(dpToPixels(300), dpToPixels(100), view);
|
||||
measureView(dpToPixels(300), dpToPixels(200), view);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -23,6 +23,7 @@ import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import org.isoron.uhabits.R;
|
||||
import org.isoron.uhabits.helpers.ColorHelper;
|
||||
import org.isoron.uhabits.views.NumberView;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -44,7 +45,7 @@ public class NumberViewTest extends ViewTest
|
||||
view = new NumberView(targetContext);
|
||||
view.setLabel("Hello world");
|
||||
view.setNumber(31);
|
||||
view.setColor(0);
|
||||
view.setColor(ColorHelper.CSV_PALETTE[0]);
|
||||
measureView(dpToPixels(100), dpToPixels(100), view);
|
||||
}
|
||||
|
||||
@@ -67,10 +68,10 @@ public class NumberViewTest extends ViewTest
|
||||
public void testRender_withDifferentParams() throws IOException
|
||||
{
|
||||
view.setNumber(500);
|
||||
view.setColor(5);
|
||||
view.setColor(ColorHelper.CSV_PALETTE[5]);
|
||||
view.setTextSize(targetContext.getResources().getDimension(R.dimen.tinyTextSize));
|
||||
|
||||
measureView(dpToPixels(200), dpToPixels(200), view);
|
||||
assertRenders(view, "NumberView/renderDifferentParams.png");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ package org.isoron.uhabits.unit.views;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
import android.test.suitebuilder.annotation.SmallTest;
|
||||
|
||||
import org.isoron.uhabits.helpers.ColorHelper;
|
||||
import org.isoron.uhabits.views.RingView;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -43,7 +44,7 @@ public class RingViewTest extends ViewTest
|
||||
view = new RingView(targetContext);
|
||||
view.setLabel("Hello world");
|
||||
view.setPercentage(0.6f);
|
||||
view.setColor(0);
|
||||
view.setColor(ColorHelper.CSV_PALETTE[0]);
|
||||
view.setMaxDiameter(dpToPixels(100));
|
||||
}
|
||||
|
||||
@@ -69,7 +70,7 @@ public class RingViewTest extends ViewTest
|
||||
view.setLabel("Habit Strength");
|
||||
view.setPercentage(0.25f);
|
||||
view.setMaxDiameter(dpToPixels(50));
|
||||
view.setColor(5);
|
||||
view.setColor(ColorHelper.CSV_PALETTE[5]);
|
||||
|
||||
measureView(dpToPixels(200), dpToPixels(200), view);
|
||||
assertRenders(view, "RingView/renderDifferentParams.png");
|
||||
|
||||
@@ -80,8 +80,8 @@ public class ViewTest extends BaseTest
|
||||
|
||||
if(!similarEnough)
|
||||
{
|
||||
saveBitmap(expectedImagePath, ".scaledExpected", scaledExpected);
|
||||
String path = saveBitmap(expectedImagePath, ".actual", actual);
|
||||
saveBitmap(expectedImagePath, ".expected", scaledExpected);
|
||||
String path = saveBitmap(expectedImagePath, "", actual);
|
||||
errorMessage.append(String.format("Actual rendered image " + "saved to %s", path));
|
||||
fail(errorMessage.toString());
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ info "Fetching failed generated files..."
|
||||
mkdir -p ${OUTPUT_DIR}/failed
|
||||
adb pull /sdcard/Android/data/${PACKAGE_NAME}/files/test-screenshots/ \
|
||||
${OUTPUT_DIR}/failed >> $LOG 2>> $LOG
|
||||
adb shell rm -r /sdcard/Android/data/${PACKAGE_NAME}/cache/ >> $LOG 2>> $LOG
|
||||
adb shell rm -r /sdcard/Android/data/${PACKAGE_NAME}/files/test-screenshots/ >> $LOG 2>> $LOG
|
||||
|
||||
info "Fetching logcat..."
|
||||
adb logcat -d > ${OUTPUT_DIR}/logcat.txt
|
||||
|
||||