/hg/gfx-test: 2012-01-11 Pavel Tisnovsky <ptisnovs at redhat.com>
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Jan 11 04:10:02 PST 2012
changeset a92f5b0ae82b in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=a92f5b0ae82b
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jan 11 13:12:29 2012 +0100
2012-01-11 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/framework/ImageFactory.java: New class
containing (ATM) one helper method used by BitBlt tests.
* src/org/gfxtest/framework/ProceduralTextureFactory.java:
Updated.
* src/org/gfxtest/testsuites/BitBltBasicTests.java: Added
two new tests.
* Makefile: updated
diffstat:
ChangeLog | 10 ++
Makefile | 1 +
src/org/gfxtest/framework/ImageFactory.java | 80 ++++++++++++++++
src/org/gfxtest/framework/ProceduralTextureFactory.java | 6 +-
src/org/gfxtest/testsuites/BitBltBasicTests.java | 82 ++++++++++++++--
5 files changed, 162 insertions(+), 17 deletions(-)
diffs (344 lines):
diff -r adb101be6e61 -r a92f5b0ae82b ChangeLog
--- a/ChangeLog Tue Jan 10 11:03:38 2012 +0100
+++ b/ChangeLog Wed Jan 11 13:12:29 2012 +0100
@@ -1,3 +1,13 @@
+2012-01-11 Pavel Tisnovsky <ptisnovs at redhat.com>
+ * src/org/gfxtest/framework/ImageFactory.java:
+ New class containing (ATM) one helper method used by
+ BitBlt tests.
+ * src/org/gfxtest/framework/ProceduralTextureFactory.java:
+ Updated.
+ * src/org/gfxtest/testsuites/BitBltBasicTests.java:
+ Added two new tests.
+ * Makefile: updated
+
2012-01-10 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/BitBltBasicTests.java:
diff -r adb101be6e61 -r a92f5b0ae82b Makefile
--- a/Makefile Tue Jan 10 11:03:38 2012 +0100
+++ b/Makefile Wed Jan 11 13:12:29 2012 +0100
@@ -89,6 +89,7 @@
$(CLASSES)/$(FRAMEWORK_DIR)/GfxTest.class \
$(CLASSES)/$(FRAMEWORK_DIR)/Log.class \
$(CLASSES)/$(FRAMEWORK_DIR)/ProceduralTextureFactory.class \
+ $(CLASSES)/$(FRAMEWORK_DIR)/ImageFactory.class \
$(CLASSES)/$(IMAGE_DIFFER_DIR)/ComparisonResult.class \
$(CLASSES)/$(IMAGE_DIFFER_DIR)/Configuration.class \
$(CLASSES)/$(IMAGE_DIFFER_DIR)/ImageComparator.class \
diff -r adb101be6e61 -r a92f5b0ae82b src/org/gfxtest/framework/ImageFactory.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/gfxtest/framework/ImageFactory.java Wed Jan 11 13:12:29 2012 +0100
@@ -0,0 +1,80 @@
+/*
+ Java gfx-test framework
+
+ Copyright (C) 2010, 2011, 2012 Red Hat
+
+This file is part of IcedTea.
+
+IcedTea 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 2, or (at your option)
+any later version.
+
+IcedTea 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 IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package org.gfxtest.framework;
+
+import java.awt.image.BufferedImage;
+
+
+
+/**
+ * This class contains static method used for creating various procedural images
+ * which is used by (for example) BitBlt tests.
+ *
+ * @author Pavel Tisnovsky
+ */
+public class ImageFactory
+{
+ public static BufferedImage createCheckerImage(int gridSize, int width, int height, int imageType)
+ {
+ // used by test for a tile colors
+ int doubledGridSize = gridSize << 1;
+
+ // create new texture instead
+ BufferedImage image = new BufferedImage(width, height, imageType);
+
+ // for all lines in a raster image
+ for (int y = 0; y < height; y++)
+ {
+ // for all columns on a line
+ for (int x = 0; x < width; x++)
+ {
+ // compute color for each tile
+ boolean evenColumn = (x % doubledGridSize) >= gridSize;
+ boolean evenRow = (y % doubledGridSize) >= gridSize;
+ // compute color for each pixel
+ boolean whiteField = evenColumn ^ evenRow;
+ int color = whiteField ? 0x00ffffff: 0x00000000;
+ image.setRGB(x, y, color);
+ }
+ }
+ return image;
+ }
+}
diff -r adb101be6e61 -r a92f5b0ae82b src/org/gfxtest/framework/ProceduralTextureFactory.java
--- a/src/org/gfxtest/framework/ProceduralTextureFactory.java Tue Jan 10 11:03:38 2012 +0100
+++ b/src/org/gfxtest/framework/ProceduralTextureFactory.java Wed Jan 11 13:12:29 2012 +0100
@@ -122,7 +122,7 @@
/**
* Eight basic colors.
*/
- private static final int[] BASIC_COLORS = {
+ private static final int[] EIGHT_BASIC_COLOR_PALETTE = {
0xff000000,
0xff0000ff,
0xff00ffff,
@@ -397,7 +397,7 @@
for (int y = 0; y < height; y++)
{
// compute color for each pixel
- int color = BASIC_COLORS[y % 8];
+ int color = EIGHT_BASIC_COLOR_PALETTE[y % 8];
// for all columns on a line
for (int x = 0; x < width; x++)
{
@@ -434,7 +434,7 @@
for (int x = 0; x < width; x++)
{
// compute color for each pixel
- int color = BASIC_COLORS[x % 8];
+ int color = EIGHT_BASIC_COLOR_PALETTE[x % 8];
verticalColorStripesTexture.setRGB(x, y, color);
}
}
diff -r adb101be6e61 -r a92f5b0ae82b src/org/gfxtest/testsuites/BitBltBasicTests.java
--- a/src/org/gfxtest/testsuites/BitBltBasicTests.java Tue Jan 10 11:03:38 2012 +0100
+++ b/src/org/gfxtest/testsuites/BitBltBasicTests.java Wed Jan 11 13:12:29 2012 +0100
@@ -46,6 +46,7 @@
import org.gfxtest.framework.GfxTest;
+import org.gfxtest.framework.ImageFactory;
import org.gfxtest.framework.TestImage;
import org.gfxtest.framework.annotations.GraphicsPrimitive;
import org.gfxtest.framework.annotations.GraphicsPrimitives;
@@ -74,6 +75,11 @@
public class BitBltBasicTests extends GfxTest
{
/**
+ * Grid size for images with checker pattern.
+ */
+ private static final int GRID_SIZE = 20;
+
+ /**
* Width of tested buffered image.
*/
private final static int DEFAULT_TEST_IMAGE_WIDTH = 256;
@@ -117,13 +123,13 @@
* Create new buffered image and then do basic BitBlt test.
*
* @param image
- * image to which line is to be drawn
+ * image to which another image is to be drawn
* @param graphics2d
* graphics canvas
* @param type
* type of the created image
*/
- private TestResult doBitBltTest(TestImage image, Graphics2D graphics2d, int type)
+ private TestResult doBitBltTestWithEmptyImage(TestImage image, Graphics2D graphics2d, int type)
{
BufferedImage bufferedImage = createBufferedBitmap(type);
if (bufferedImage == null)
@@ -134,6 +140,26 @@
}
/**
+ * Create new buffered image containing checker pattern and then do basic BitBlt test.
+ *
+ * @param image
+ * image to which another image is to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @param imageType
+ * type of the created image
+ */
+ private TestResult doBitBltTestWithCheckerImage(TestImage image, Graphics2D graphics2d, int imageType)
+ {
+ BufferedImage bufferedImage = ImageFactory.createCheckerImage(GRID_SIZE, DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+ if (bufferedImage == null)
+ {
+ return TestResult.FAILED;
+ }
+ return BitBlt(image, graphics2d, bufferedImage) ? TestResult.PASSED : TestResult.FAILED;
+ }
+
+ /**
* Test basic BitBlt operation for empty buffered image with type TYPE_3BYTE_BGR.
*
* @param image
@@ -144,7 +170,7 @@
*/
public TestResult testBitBltEmptyBufferedImageType3ByteBGR(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_3BYTE_BGR);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_3BYTE_BGR);
}
/**
@@ -158,7 +184,7 @@
*/
public TestResult testBitBltEmptyBufferedImageType4ByteABGR(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_4BYTE_ABGR);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_4BYTE_ABGR);
}
/**
@@ -172,7 +198,7 @@
*/
public TestResult testBitBltEmptyBufferedImageType4ByteABGR_Pre(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_4BYTE_ABGR_PRE);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_4BYTE_ABGR_PRE);
}
/**
@@ -186,7 +212,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY);
}
/**
@@ -200,7 +226,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeIntRGB(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_INT_RGB);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_INT_RGB);
}
/**
@@ -214,7 +240,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeIntARGB(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_INT_ARGB);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_INT_ARGB);
}
/**
@@ -228,7 +254,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeIntARGB_Pre(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_INT_ARGB_PRE);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_INT_ARGB_PRE);
}
/**
@@ -242,7 +268,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeIntBGR(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_INT_BGR);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_INT_BGR);
}
/**
@@ -256,7 +282,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeUshort565RGB(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_USHORT_565_RGB);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_USHORT_565_RGB);
}
/**
@@ -270,7 +296,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeUshort555RGB(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_USHORT_555_RGB);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_USHORT_555_RGB);
}
/**
@@ -284,7 +310,7 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeByteGray(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_BYTE_GRAY);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_BYTE_GRAY);
}
/**
@@ -298,7 +324,35 @@
*/
public TestResult testBitBltEmptyBufferedImageTypeUshortGray(TestImage image, Graphics2D graphics2d)
{
- return doBitBltTest(image, graphics2d, BufferedImage.TYPE_USHORT_GRAY);
+ return doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_USHORT_GRAY);
+ }
+
+ /**
+ * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+ *
+ * @param image
+ * image to which line is to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return
+ */
+ public TestResult testBitBltCheckerBufferedImageTypeByteBinary(TestImage image, Graphics2D graphics2d)
+ {
+ return doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY);
+ }
+
+ /**
+ * Test basic BitBlt operation for checker buffered image with type TYPE_INT_RGB.
+ *
+ * @param image
+ * image to which line is to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return
+ */
+ public TestResult testBitBltCheckerBufferedImageTypeIntRGB(TestImage image, Graphics2D graphics2d)
+ {
+ return doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_INT_RGB);
}
/**
More information about the distro-pkg-dev
mailing list