/hg/gfx-test: Three new helper methods added into CommonBitmapOp...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Wed May 21 09:14:20 UTC 2014


changeset a1186fdfb52b in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=a1186fdfb52b
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed May 21 11:15:04 2014 +0200

	Three new helper methods added into CommonBitmapOperations.


diffstat:

 ChangeLog                                             |   5 +
 src/org/gfxtest/framework/CommonBitmapOperations.java |  78 +++++++++++++++++++
 2 files changed, 83 insertions(+), 0 deletions(-)

diffs (114 lines):

diff -r 8c51f9c636ab -r a1186fdfb52b ChangeLog
--- a/ChangeLog	Mon May 19 09:41:33 2014 +0200
+++ b/ChangeLog	Wed May 21 11:15:04 2014 +0200
@@ -1,3 +1,8 @@
+2014-05-21  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonBitmapOperations.java:
+	Three new helper methods added into CommonBitmapOperations.
+
 2014-05-19  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/CAGOperationsOnTwoOverlappingRectangles.java:
diff -r 8c51f9c636ab -r a1186fdfb52b src/org/gfxtest/framework/CommonBitmapOperations.java
--- a/src/org/gfxtest/framework/CommonBitmapOperations.java	Mon May 19 09:41:33 2014 +0200
+++ b/src/org/gfxtest/framework/CommonBitmapOperations.java	Wed May 21 11:15:04 2014 +0200
@@ -999,6 +999,32 @@
 
     /**
      * Create new buffered image containing black and white horizontal stripes 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 bgcolor
+     *            background color
+     */
+    public static TestResult doBitBltTestWithHorizontalStripesImage(TestImage image, Graphics2D graphics2d, int imageType, Color bgcolor)
+    {
+        // create new buffered bitmap with given type
+        // bitmap should contains horizontal stripes
+        BufferedImage bufferedImage = ImageFactory.createHorizontalStripesImage(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, no flipping and no cropping
+        return BitBltOperations.performBitBlt(bufferedImage, image, graphics2d, bgcolor) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing black and white horizontal stripes then perform basic BitBlt test.
      *
      * @param image
      *            image to which another image is to be drawn
@@ -1078,6 +1104,32 @@
 
     /**
      * Create new buffered image containing black and white vertical stripes 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 bgcolor
+     *            background color
+     */
+    public static TestResult doBitBltTestWithVerticalStripesImage(TestImage image, Graphics2D graphics2d, int imageType, Color bgcolor)
+    {
+        // create new buffered bitmap with given type
+        // bitmap should contains vertical stripes
+        BufferedImage bufferedImage = ImageFactory.createVerticalStripesImage(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, no flipping and no cropping
+        return BitBltOperations.performBitBlt(bufferedImage, image, graphics2d, bgcolor) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing black and white vertical stripes then perform basic BitBlt test.
      *
      * @param image
      *            image to which another image is to be drawn
@@ -1157,6 +1209,32 @@
 
     /**
      * Create new buffered image containing black and white diagonal stripes 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 bgcolor
+     *            background color
+     */
+    public static TestResult doBitBltTestWithDiagonalStripesImage(TestImage image, Graphics2D graphics2d, int imageType, Color bgcolor)
+    {
+        // create new buffered bitmap with given type
+        // bitmap should contains diagonal stripes
+        BufferedImage bufferedImage = ImageFactory.createDiagonalStripesImage(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, no flipping and no cropping
+        return BitBltOperations.performBitBlt(bufferedImage, image, graphics2d, bgcolor) ? TestResult.PASSED : TestResult.FAILED;
+    }
+
+    /**
+     * Create new buffered image containing black and white diagonal stripes then perform basic BitBlt test.
      *
      * @param image
      *            image to which another image is to be drawn


More information about the distro-pkg-dev mailing list