/hg/gfx-test: 2012-02-23 Pavel Tisnovsky <ptisnovs at redhat.com>
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Feb 23 03:16:20 PST 2012
changeset c32c07a7ddbc in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=c32c07a7ddbc
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Feb 23 12:18:52 2012 +0100
2012-02-23 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/framework/ColorPalette.java:
* src/org/gfxtest/framework/CommonBitmapOperations.java:
* src/org/gfxtest/framework/CubicCurvePointSet.java:
* src/org/gfxtest/framework/EntityRenderingStyle.java:
* src/org/gfxtest/framework/GfxTest.java:
* src/org/gfxtest/framework/Log.java: More changes which fix some
issues found by FindBugs.
diffstat:
ChangeLog | 10 +++
src/org/gfxtest/framework/ColorPalette.java | 2 +-
src/org/gfxtest/framework/CommonBitmapOperations.java | 63 ++++++++----------
src/org/gfxtest/framework/CubicCurvePointSet.java | 4 +-
src/org/gfxtest/framework/EntityRenderingStyle.java | 2 +-
src/org/gfxtest/framework/GfxTest.java | 24 +++---
src/org/gfxtest/framework/Log.java | 5 +-
7 files changed, 58 insertions(+), 52 deletions(-)
diffs (434 lines):
diff -r b320e45d2759 -r c32c07a7ddbc ChangeLog
--- a/ChangeLog Tue Feb 21 14:49:56 2012 +0100
+++ b/ChangeLog Thu Feb 23 12:18:52 2012 +0100
@@ -1,3 +1,13 @@
+2012-02-23 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/framework/ColorPalette.java:
+ * src/org/gfxtest/framework/CommonBitmapOperations.java:
+ * src/org/gfxtest/framework/CubicCurvePointSet.java:
+ * src/org/gfxtest/framework/EntityRenderingStyle.java:
+ * src/org/gfxtest/framework/GfxTest.java:
+ * src/org/gfxtest/framework/Log.java:
+ More changes which fix some issues found by FindBugs.
+
2012-02-21 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/ImageDiffer/ResultWriters/HtmlStructureWriter.java:
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/ColorPalette.java
--- a/src/org/gfxtest/framework/ColorPalette.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/ColorPalette.java Thu Feb 23 12:18:52 2012 +0100
@@ -99,6 +99,6 @@
*/
public static Color[] getColors()
{
- return colors;
+ return colors.clone();
}
}
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/CommonBitmapOperations.java
--- a/src/org/gfxtest/framework/CommonBitmapOperations.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/CommonBitmapOperations.java Thu Feb 23 12:18:52 2012 +0100
@@ -72,7 +72,7 @@
* @return if the image has completely loaded and its pixels are no longer
* being changed, then returns true. Otherwise, returns false
*/
- private static boolean BitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d)
+ private static boolean performBitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d)
{
// compute top-left corner coordinates
final int x = (destinationImage.getWidth() - DEFAULT_TEST_IMAGE_WIDTH) >> 1;
@@ -94,7 +94,7 @@
* @return if the image has completely loaded and its pixels are no longer
* being changed, then returns true. Otherwise, returns false
*/
- private static boolean BitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d, int width, int height)
+ private static boolean performBitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d, int width, int height)
{
// compute top-left corner coordinates
final int x = (destinationImage.getWidth() - width) >> 1;
@@ -118,7 +118,7 @@
* @return if the image has completely loaded and its pixels are no longer
* being changed, then returns true. Otherwise, returns false
*/
- private static boolean BitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d,
+ private static boolean performBitBlt(BufferedImage sourceImage, TestImage destinationImage, Graphics2D graphics2d,
boolean horizontalFlip, boolean verticalFlip)
{
// compute top-left corner coordinates of destination image
@@ -161,13 +161,8 @@
public static TestResult doBitBltTestWithEmptyImage(TestImage image, Graphics2D graphics2d, int type)
{
BufferedImage bufferedImage = createBufferedBitmap(type);
- // basic check if buffered image was created
- if (bufferedImage == null)
- {
- return TestResult.FAILED;
- }
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -190,7 +185,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -217,7 +212,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -246,7 +241,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, horizontalFlip, verticalFlip) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, horizontalFlip, verticalFlip) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -269,7 +264,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -296,7 +291,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -319,7 +314,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -346,7 +341,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -369,7 +364,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -396,7 +391,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -419,7 +414,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -446,7 +441,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -469,7 +464,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -496,7 +491,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -519,7 +514,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -546,7 +541,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -569,7 +564,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -596,7 +591,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -619,7 +614,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -646,7 +641,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -669,7 +664,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -696,7 +691,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -719,7 +714,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -746,7 +741,7 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -769,7 +764,7 @@
return TestResult.FAILED;
}
// BitBlt with 1:1 scaling
- return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
}
/**
@@ -796,6 +791,6 @@
return TestResult.FAILED;
}
// BitBlt with custom scaling
- return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+ return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
}
}
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/CubicCurvePointSet.java
--- a/src/org/gfxtest/framework/CubicCurvePointSet.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/CubicCurvePointSet.java Thu Feb 23 12:18:52 2012 +0100
@@ -412,7 +412,7 @@
*/
public int[] getXPointArray()
{
- return this.x;
+ return this.x == null ? null : (int[]) this.x.clone();
}
/**
@@ -424,7 +424,7 @@
*/
public int[] getYPointArray()
{
- return this.y;
+ return this.y == null ? null : (int[]) this.y.clone();
}
/**
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/EntityRenderingStyle.java
--- a/src/org/gfxtest/framework/EntityRenderingStyle.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/EntityRenderingStyle.java Thu Feb 23 12:18:52 2012 +0100
@@ -87,7 +87,7 @@
public float[] getDash()
{
- return this.dash;
+ return this.dash == null ? null : (float[]) this.dash.clone();
}
public int getArcWidth()
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/GfxTest.java
--- a/src/org/gfxtest/framework/GfxTest.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/GfxTest.java Thu Feb 23 12:18:52 2012 +0100
@@ -109,63 +109,63 @@
/**
* Default cap style.
*/
- protected static final int[] DEFAULT_CAP_STYLE = {BasicStroke.CAP_ROUND};
+ static final int[] DEFAULT_CAP_STYLE = {BasicStroke.CAP_ROUND};
/**
* All cap styles available.
*/
- protected static final int[] ALL_CAP_STYLES = { BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE };
+ static final int[] ALL_CAP_STYLES = { BasicStroke.CAP_BUTT, BasicStroke.CAP_ROUND, BasicStroke.CAP_SQUARE };
/**
* Default join style.
*/
- protected static final int[] DEFAULT_JOIN_STYLE = {BasicStroke.JOIN_ROUND};
+ static final int[] DEFAULT_JOIN_STYLE = {BasicStroke.JOIN_ROUND};
/**
* All available join styles.
*/
- protected static final int[] ALL_JOIN_STYLES = { BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.CAP_ROUND };
+ static final int[] ALL_JOIN_STYLES = { BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.CAP_ROUND };
/**
* Default line or curve width.
*/
- protected static final float[] DEFAULT_WIDTH = { 1.0f };
+ static final float[] DEFAULT_WIDTH = { 1.0f };
/**
* All line or curve widths used by test cases.
*/
- protected static final float[] ALL_WIDTHS = { 1.0f, 2.0f, 5.0f, 10.0f, 20.0f, 40.0f };
+ static final float[] ALL_WIDTHS = { 1.0f, 2.0f, 5.0f, 10.0f, 20.0f, 40.0f };
/**
* Default scale.
*/
- protected static final float[] DEFAULT_SCALE = { 1.0f };
+ static final float[] DEFAULT_SCALE = { 1.0f };
/**
* All scales used by test cases.
*/
- protected static final float[] ALL_SCALES = { 0.5f, 1.0f, 10.0f, 20.0f, 40.0f };
+ static final float[] ALL_SCALES = { 0.5f, 1.0f, 10.0f, 20.0f, 40.0f };
/**
* Default ellipse eccentricity.
*/
- protected static final float[] DEFAULT_ECCENTRICITY = { 1.0f };
+ static final float[] DEFAULT_ECCENTRICITY = { 1.0f };
/**
* Values used for rendering ellipses and similar geometric shapes.
*/
//protected static final float[] ECCENTRICITIES = {1/3.0f, 1/2.5f, 1/2.0f, 1/1.5f, 1.0f, 1.5f, 2.0f, 2.5f, 3.0f};
- protected static final float[] ECCENTRICITIES = {1/3.0f, 1/1.5f, 1.0f, 1.5f, 3.0f};
+ static final float[] ECCENTRICITIES = {1/3.0f, 1/1.5f, 1.0f, 1.5f, 3.0f};
/**
* Default pattern.
*/
- protected static final float[] DEFAULT_DASH_PATTERN = { 1.0f };
+ static final float[] DEFAULT_DASH_PATTERN = { 1.0f };
/**
* All dash patterns.
*/
- protected static final float[] ALL_DASH_PATTERNS = {1.0f, /*2.0f, */8.0f, 16.0f};
+ static final float[] ALL_DASH_PATTERNS = {1.0f, /*2.0f, */8.0f, 16.0f};
/**
* Write test suite duration to the log file.
diff -r b320e45d2759 -r c32c07a7ddbc src/org/gfxtest/framework/Log.java
--- a/src/org/gfxtest/framework/Log.java Tue Feb 21 14:49:56 2012 +0100
+++ b/src/org/gfxtest/framework/Log.java Thu Feb 23 12:18:52 2012 +0100
@@ -42,6 +42,7 @@
import java.util.Date;
import java.util.HashMap;
+import java.util.Locale;
/**
* Simple logger that writes everything out to standard output and can use color
@@ -130,11 +131,11 @@
for (String piece : pieces)
{
- if (colors.containsKey(piece.toUpperCase()))
+ if (colors.containsKey(piece.toUpperCase(Locale.ENGLISH)))
{
if (this.useColors)
{
- output.append("\033[0;" + colors.get(piece.toUpperCase()) + "m");
+ output.append("\033[0;" + colors.get(piece.toUpperCase(Locale.ENGLISH)) + "m");
}
}
else
More information about the distro-pkg-dev
mailing list