/hg/gfx-test: 2012-01-16 Pavel Tisnovsky <ptisnovs at redhat.com>

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Jan 16 08:48:59 PST 2012


changeset 9fc077318e00 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=9fc077318e00
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jan 16 17:51:18 2012 +0100

	2012-01-16 Pavel Tisnovsky <ptisnovs at redhat.com>

	 * src/org/gfxtest/framework/CommonBitmapOperations.java:
	        * src/org/gfxtest/framework/ImageFactory.java: Added support
	for new pattern type.
	        * src/org/gfxtest/testsuites/BitBltScaleImage.java: Added
	new tests.


diffstat:

 ChangeLog                                             |   8 +
 src/org/gfxtest/framework/CommonBitmapOperations.java |  39 +++++++++
 src/org/gfxtest/framework/ImageFactory.java           |  57 +++++++++++++-
 src/org/gfxtest/testsuites/BitBltScaleImage.java      |  80 ++++++++++++++++++-
 4 files changed, 179 insertions(+), 5 deletions(-)

diffs (278 lines):

diff -r 70e12dbf96c3 -r 9fc077318e00 ChangeLog
--- a/ChangeLog	Thu Jan 12 11:54:02 2012 +0100
+++ b/ChangeLog	Mon Jan 16 17:51:18 2012 +0100
@@ -1,3 +1,11 @@
+2012-01-16  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonBitmapOperations.java:
+	* src/org/gfxtest/framework/ImageFactory.java:
+	Added support for new pattern type.
+	* src/org/gfxtest/testsuites/BitBltScaleImage.java:
+	Added new tests.
+
 2012-01-12  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/CommonBitmapOperations.java:
diff -r 70e12dbf96c3 -r 9fc077318e00 src/org/gfxtest/framework/CommonBitmapOperations.java
--- a/src/org/gfxtest/framework/CommonBitmapOperations.java	Thu Jan 12 11:54:02 2012 +0100
+++ b/src/org/gfxtest/framework/CommonBitmapOperations.java	Mon Jan 16 17:51:18 2012 +0100
@@ -174,4 +174,43 @@
         return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
     }
 
+    /**
+     * Create new buffered image containing diagonal 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
+     */
+    public static TestResult doBitBltTestWithDiagonalCheckerImage(TestImage image, Graphics2D graphics2d, int imageType)
+    {
+        BufferedImage bufferedImage = ImageFactory.createDiagonalCheckerImage(GRID_SIZE, DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        return BitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing diagonal 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
+     */
+    public static TestResult doBitBltTestWithDiagonalCheckerImage(TestImage image, Graphics2D graphics2d, int imageType, int width, int height)
+    {
+        BufferedImage bufferedImage = ImageFactory.createDiagonalCheckerImage(GRID_SIZE, DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        return BitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+    }
 }
diff -r 70e12dbf96c3 -r 9fc077318e00 src/org/gfxtest/framework/ImageFactory.java
--- a/src/org/gfxtest/framework/ImageFactory.java	Thu Jan 12 11:54:02 2012 +0100
+++ b/src/org/gfxtest/framework/ImageFactory.java	Mon Jan 16 17:51:18 2012 +0100
@@ -52,12 +52,25 @@
  */
 public class ImageFactory
 {
+    /**
+     * Create image containing checker pattern.
+     * 
+     * @param gridSize
+     *            size of a grid
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
     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
+        // create new image
         BufferedImage image = new BufferedImage(width, height, imageType);
 
         // for all lines in a raster image
@@ -77,4 +90,46 @@
         }
         return image;
     }
+
+    /**
+     * Create image containing diagonal checker pattern.
+     * 
+     * @param gridSize
+     *            size of a grid
+     * @param width
+     *            width of a buffered image
+     * @param height
+     *            height of a buffered image
+     * @param imageType
+     *            buffered image type
+     * @return buffered image containing checker pattern
+     */
+    public static BufferedImage createDiagonalCheckerImage(int gridSize, int width, int height, int imageType)
+    {
+        // used for computing checker texture
+        int width2 = width << 1;
+
+        // used by test for a tile colors
+        int doubledGridSize = gridSize << 1;
+
+        // create new image
+        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 + y) % doubledGridSize) >= gridSize;
+                boolean evenRow = ((width2 + x - y) % doubledGridSize) >= gridSize;
+                // compute color for each pixel
+                boolean whiteField = evenColumn ^ evenRow;
+                int color = whiteField ? 0xffffffff: 0xff000000;
+                image.setRGB(x, y, color);
+            }
+        }
+        return image;
+    }
 }
diff -r 70e12dbf96c3 -r 9fc077318e00 src/org/gfxtest/testsuites/BitBltScaleImage.java
--- a/src/org/gfxtest/testsuites/BitBltScaleImage.java	Thu Jan 12 11:54:02 2012 +0100
+++ b/src/org/gfxtest/testsuites/BitBltScaleImage.java	Mon Jan 16 17:51:18 2012 +0100
@@ -77,6 +77,7 @@
 {
     /**
      * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to a double size in both dimensions.
      *
      * @param image
      *            image to which line is to be drawn
@@ -84,7 +85,75 @@
      *            graphics canvas
      * @return
      */
-    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryHscale1(TestImage image, Graphics2D graphics2d)
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryScaleTwoTimes(TestImage image, Graphics2D graphics2d)
+    {
+        return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH * 2,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_HEIGHT * 2);
+    }
+
+    /**
+     * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to one half size in both dimensions.
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return
+     */
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryScaleOneHalf(TestImage image, Graphics2D graphics2d)
+    {
+        return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH / 2,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_HEIGHT / 2);
+    }
+
+    /**
+     * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to one third size in both dimensions.
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return
+     */
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryScaleOneThird(TestImage image, Graphics2D graphics2d)
+    {
+        return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH / 3,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_HEIGHT / 3);
+    }
+
+    /**
+     * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to two thirds size in both dimensions.
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return
+     */
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryScaleTwoThirds(TestImage image, Graphics2D graphics2d)
+    {
+        return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH * 2 / 3,
+                        CommonBitmapOperations.DEFAULT_TEST_IMAGE_HEIGHT * 2 / 3);
+    }
+
+    /**
+     * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to one half size in horizontal dimension.
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return
+     */
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryHscaleOneHalf(TestImage image, Graphics2D graphics2d)
     {
         return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
                         CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH / 2,
@@ -93,6 +162,7 @@
 
     /**
      * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to two times size in horizontal dimension.
      *
      * @param image
      *            image to which line is to be drawn
@@ -100,7 +170,7 @@
      *            graphics canvas
      * @return
      */
-    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryHscale2(TestImage image, Graphics2D graphics2d)
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryHscaleTwoTimes(TestImage image, Graphics2D graphics2d)
     {
         return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
                         CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH * 2,
@@ -109,6 +179,7 @@
 
     /**
      * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to one half size in vertical dimension.
      *
      * @param image
      *            image to which line is to be drawn
@@ -116,7 +187,7 @@
      *            graphics canvas
      * @return
      */
-    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryVscale1(TestImage image, Graphics2D graphics2d)
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryVscaleOneHalf(TestImage image, Graphics2D graphics2d)
     {
         return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
                         CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH,
@@ -125,6 +196,7 @@
 
     /**
      * Test basic BitBlt operation for checker buffered image with type TYPE_BYTE_BINARY.
+     * The image is scaled to two times size in vertical dimension.
      *
      * @param image
      *            image to which line is to be drawn
@@ -132,7 +204,7 @@
      *            graphics canvas
      * @return
      */
-    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryVscale2(TestImage image, Graphics2D graphics2d)
+    public TestResult testBitBltCheckerBufferedImageTypeByteBinaryVscaleTwoTimes(TestImage image, Graphics2D graphics2d)
     {
         return CommonBitmapOperations.doBitBltTestWithCheckerImage(image, graphics2d, BufferedImage.TYPE_BYTE_BINARY,
                         CommonBitmapOperations.DEFAULT_TEST_IMAGE_WIDTH,



More information about the distro-pkg-dev mailing list