/hg/gfx-test: Four helper methods used by bitmap-related tests a...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Jan 8 02:43:17 PST 2013


changeset 7d09ee4ca61e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=7d09ee4ca61e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jan 08 11:46:26 2013 +0100

	Four helper methods used by bitmap-related tests added into CommonBitmapOperations.java.


diffstat:

 ChangeLog                                             |    7 +
 src/org/gfxtest/framework/CommonBitmapOperations.java |  107 +++++++++++++++++-
 src/org/gfxtest/framework/ImageFactory.java           |    2 +-
 3 files changed, 114 insertions(+), 2 deletions(-)

diffs (148 lines):

diff -r f58d79d0af5e -r 7d09ee4ca61e ChangeLog
--- a/ChangeLog	Mon Jan 07 11:45:55 2013 +0100
+++ b/ChangeLog	Tue Jan 08 11:46:26 2013 +0100
@@ -1,3 +1,10 @@
+2013-01-08  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonBitmapOperations.java:
+	Four helper methods used by bitmap-related tests added.
+	* src/org/gfxtest/framework/ImageFactory.java:
+	Updated (c) year.
+
 2013-01-07  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/ImageFactory.java:
diff -r f58d79d0af5e -r 7d09ee4ca61e src/org/gfxtest/framework/CommonBitmapOperations.java
--- a/src/org/gfxtest/framework/CommonBitmapOperations.java	Mon Jan 07 11:45:55 2013 +0100
+++ b/src/org/gfxtest/framework/CommonBitmapOperations.java	Tue Jan 08 11:46:26 2013 +0100
@@ -1,7 +1,7 @@
 /*
   Java gfx-test framework
 
-   Copyright (C) 2010, 2011, 2012  Red Hat
+   Copyright (C) 2010, 2011, 2012, 2013  Red Hat
 
 This file is part of IcedTea.
 
@@ -1409,4 +1409,109 @@
         // BitBlt with custom scaling
         return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
     }
+
+    /**
+     * Create new buffered image containing horizontal grayscale gradient and then perform 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 doBitBltTestWithHorizontalGrayscaleGradientImage(TestImage image, Graphics2D graphics2d, int imageType)
+    {
+        // create new buffered bitmap with given type
+        BufferedImage bufferedImage = ImageFactory.createHorizontalGrayscaleGradientImage(DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        // basic check if buffered image was created
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        // BitBlt with 1:1 scaling
+        return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing horizontal grayscale gradient and then perform
+     * 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
+     * @param width
+     *            width of a image after BitBlt operation is performed
+     * @param height
+     *            height of a image after BitBlt operation is performed
+     */
+    public static TestResult doBitBltTestWithHorizontalGrayscaleGradientImage(TestImage image, Graphics2D graphics2d, int imageType,
+                    int width, int height)
+    {
+        // create new buffered bitmap with given type
+        BufferedImage bufferedImage = ImageFactory.createHorizontalGrayscaleGradientImage(DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        // basic check if buffered image was created
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        // BitBlt with custom scaling
+        return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing vertical grayscale gradient and then perform 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 doBitBltTestWithVerticalGrayscaleGradientImage(TestImage image, Graphics2D graphics2d, int imageType)
+    {
+        // create new buffered bitmap with given type
+        BufferedImage bufferedImage = ImageFactory.createVerticalGrayscaleGradientImage(DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        // basic check if buffered image was created
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        // BitBlt with 1:1 scaling
+        return performBitBlt(bufferedImage, image, graphics2d) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing vertical grayscale gradient and then perform
+     * 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
+     * @param width
+     *            width of a image after BitBlt operation is performed
+     * @param height
+     *            height of a image after BitBlt operation is performed
+     */
+    public static TestResult doBitBltTestWithVerticalGrayscaleGradientImage(TestImage image, Graphics2D graphics2d, int imageType,
+                    int width, int height)
+    {
+        // create new buffered bitmap with given type
+        BufferedImage bufferedImage = ImageFactory.createVerticalGrayscaleGradientImage(DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, imageType);
+        // basic check if buffered image was created
+        if (bufferedImage == null)
+        {
+            return TestResult.FAILED;
+        }
+        // BitBlt with custom scaling
+        return performBitBlt(bufferedImage, image, graphics2d, width, height) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
 }
diff -r f58d79d0af5e -r 7d09ee4ca61e src/org/gfxtest/framework/ImageFactory.java
--- a/src/org/gfxtest/framework/ImageFactory.java	Mon Jan 07 11:45:55 2013 +0100
+++ b/src/org/gfxtest/framework/ImageFactory.java	Tue Jan 08 11:46:26 2013 +0100
@@ -1,7 +1,7 @@
 /*
   Java gfx-test framework
 
-   Copyright (C) 2010, 2011, 2012  Red Hat
+   Copyright (C) 2010, 2011, 2012, 2013  Red Hat
 
 This file is part of IcedTea.
 



More information about the distro-pkg-dev mailing list