Update tests

pull/84/merge
Alinson S. Xavier 10 years ago
parent d77c78249c
commit f172c69eed

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.6 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

@ -19,6 +19,7 @@
package org.isoron.uhabits.unit.views;
import android.graphics.Color;
import android.support.test.runner.AndroidJUnit4;
import android.test.suitebuilder.annotation.SmallTest;
@ -42,10 +43,11 @@ public class RingViewTest extends ViewTest
super.setup();
view = new RingView(targetContext);
// view.setLabel("Hello world");
view.setPercentage(0.6f);
view.setText("60%");
view.setColor(ColorHelper.CSV_PALETTE[0]);
// view.setMaxDiameter(dpToPixels(100));
view.setBackgroundColor(Color.WHITE);
view.setThickness(dpToPixels(3));
}
@Test
@ -55,21 +57,10 @@ public class RingViewTest extends ViewTest
assertRenders(view, "RingView/render.png");
}
@Test
public void testRender_withLongLabel() throws IOException
{
// view.setLabel("The quick brown fox jumps over the lazy fox");
measureView(dpToPixels(100), dpToPixels(100), view);
assertRenders(view, "RingView/renderLongLabel.png");
}
@Test
public void testRender_withDifferentParams() throws IOException
{
// view.setLabel("Habit Strength");
view.setPercentage(0.25f);
// view.setMaxDiameter(dpToPixels(50));
view.setColor(ColorHelper.CSV_PALETTE[5]);
measureView(dpToPixels(200), dpToPixels(200), view);

@ -123,7 +123,6 @@ public class CheckmarkWidgetView extends HabitWidgetView implements HabitDataVie
}
ring.setPercentage(percentage);
ring.setPrecision(0.125f);
ring.setColor(foregroundColor);
ring.setBackgroundColor(backgroundColor);
ring.setText(text);

@ -175,11 +175,14 @@ public class HabitScoreView extends ScrollableDataView implements HabitDataView
pGrid.setStrokeWidth(baseSize * 0.025f);
if(isTransparencyEnabled)
{
if (drawingCache != null) drawingCache.recycle();
drawingCache = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
cacheCanvas = new Canvas(drawingCache);
}
initCache(width, height);
}
private void initCache(int width, int height)
{
if (drawingCache != null) drawingCache.recycle();
drawingCache = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
cacheCanvas = new Canvas(drawingCache);
}
public void refreshData()
@ -222,6 +225,8 @@ public class HabitScoreView extends ScrollableDataView implements HabitDataView
if(isTransparencyEnabled)
{
if(drawingCache == null) initCache(getWidth(), getHeight());
activeCanvas = cacheCanvas;
drawingCache.eraseColor(Color.TRANSPARENT);
}

@ -19,7 +19,6 @@
package org.isoron.uhabits.views;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@ -41,22 +40,22 @@ public class RingView extends View
public static final PorterDuffXfermode XFERMODE_CLEAR =
new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
private float precision;
private boolean enableFontAwesome;
private int color;
private float precision;
private float percentage;
private TextPaint pRing;
private RectF rect;
private int diameter;
private float textSize;
private float thickness;
private RectF rect;
private TextPaint pRing;
private Integer backgroundColor;
private Integer inactiveColor;
private float em;
private String text;
private float textSize;
private boolean enableFontAwesome;
private Bitmap drawingCache;
private Canvas cacheCanvas;
@ -65,6 +64,14 @@ public class RingView extends View
public RingView(Context context)
{
super(context);
percentage = 0.0f;
precision = 0.01f;
color = ColorHelper.CSV_PALETTE[0];
thickness = UIHelper.dpToPixels(getContext(), 2);
text = "";
textSize = context.getResources().getDimension(R.dimen.smallTextSize);
init();
}
@ -149,7 +156,6 @@ public class RingView extends View
}
@Override
@SuppressLint("DrawAllocation")
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
super.onMeasure(widthMeasureSpec, heightMeasureSpec);

@ -40,6 +40,7 @@ grep -q "FAILURES\!\!\!" ${OUTPUT_DIR}/runner.txt && failed=1
info "Fetching failed generated files..."
mkdir -p ${OUTPUT_DIR}/failed
adb pull /mnt/sdcard/test-screenshots/ ${OUTPUT_DIR}/failed >> $LOG 2>> $LOG
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}/files/test-screenshots/ >> $LOG 2>> $LOG

Loading…
Cancel
Save