/hg/gfx-test: Added new tests - using HSB color scale in followi...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Aug 20 02:36:22 PDT 2012


changeset a4e7d1976767 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=a4e7d1976767
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Aug 20 11:38:54 2012 +0200

	Added new tests - using HSB color scale in following test suites:
	src/org/gfxtest/testsuites/PrintTestArcs.java,
	src/org/gfxtest/testsuites/PrintTestCircles.java,
	src/org/gfxtest/testsuites/PrintTestEllipses.java.


diffstat:

 ChangeLog                                         |   7 ++
 src/org/gfxtest/testsuites/PrintTestArcs.java     |  65 +++++++++++++++++++++++
 src/org/gfxtest/testsuites/PrintTestCircles.java  |  65 +++++++++++++++++++++++
 src/org/gfxtest/testsuites/PrintTestEllipses.java |  65 +++++++++++++++++++++++
 4 files changed, 202 insertions(+), 0 deletions(-)

diffs (260 lines):

diff -r 148ec0ec4ea3 -r a4e7d1976767 ChangeLog
--- a/ChangeLog	Fri Aug 17 12:59:47 2012 +0200
+++ b/ChangeLog	Mon Aug 20 11:38:54 2012 +0200
@@ -1,3 +1,10 @@
+2012-08-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestArcs.java:
+	* src/org/gfxtest/testsuites/PrintTestCircles.java:
+	* src/org/gfxtest/testsuites/PrintTestEllipses.java:
+	Added new tests - using HSB color scale in these test suites.
+
 2012-08-17  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/HSBPalette.java:
diff -r 148ec0ec4ea3 -r a4e7d1976767 src/org/gfxtest/testsuites/PrintTestArcs.java
--- a/src/org/gfxtest/testsuites/PrintTestArcs.java	Fri Aug 17 12:59:47 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestArcs.java	Mon Aug 20 11:38:54 2012 +0200
@@ -48,6 +48,7 @@
 
 import org.gfxtest.framework.ColorPalette;
 import org.gfxtest.framework.GrayscalePalette;
+import org.gfxtest.framework.HSBPalette;
 import org.gfxtest.framework.PrintTest;
 import org.gfxtest.framework.TestImage;
 import org.gfxtest.framework.TestResult;
@@ -217,6 +218,70 @@
 
     /**
      * Test basic behavior of method Graphics.drawArc().
+     * Arc color are selected from a hue palette.
+     *
+     * @param image
+     *            image to which arcs are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawArcColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawArcs(image, graphics2d, ARC_RADIUS_STEP, new CommonArcDrawCallbacks()
+        {
+            /**
+             * Callback function called before each arc is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = radius * 1.0f / maxRadius;
+                // set arc color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawArc().
+     * Arc color are selected from a hue palette.
+     *
+     * @param image
+     *            image to which arcs are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawArcColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawArcs(image, graphics2d, ARC_RADIUS_STEP, new CommonArcDrawCallbacks()
+        {
+            /**
+             * Callback function called before each arc is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - radius * 1.0f / maxRadius;
+                // set arc color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawArc().
      * Arc color are selected from a grayscale palette.
      *
      * @param image
diff -r 148ec0ec4ea3 -r a4e7d1976767 src/org/gfxtest/testsuites/PrintTestCircles.java
--- a/src/org/gfxtest/testsuites/PrintTestCircles.java	Fri Aug 17 12:59:47 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestCircles.java	Mon Aug 20 11:38:54 2012 +0200
@@ -48,6 +48,7 @@
 import org.gfxtest.callbacks.CommonCircleDrawCallbacks;
 import org.gfxtest.framework.ColorPalette;
 import org.gfxtest.framework.GrayscalePalette;
+import org.gfxtest.framework.HSBPalette;
 import org.gfxtest.framework.PrintTest;
 import org.gfxtest.framework.TestImage;
 import org.gfxtest.framework.TestResult;
@@ -213,6 +214,70 @@
 
     /**
      * Test basic behavior of method Graphics.drawOval().
+     * Circles color are selected from a hue palette.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCircleColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP, new CommonCircleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = radius * 1.0f / maxRadius;
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles color are selected from a hue palette.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCircleColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP, new CommonCircleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - radius * 1.0f / maxRadius;
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
      * Circles color are selected from a grayscale palette.
      *
      * @param image
diff -r 148ec0ec4ea3 -r a4e7d1976767 src/org/gfxtest/testsuites/PrintTestEllipses.java
--- a/src/org/gfxtest/testsuites/PrintTestEllipses.java	Fri Aug 17 12:59:47 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestEllipses.java	Mon Aug 20 11:38:54 2012 +0200
@@ -48,6 +48,7 @@
 import org.gfxtest.callbacks.CommonEllipseDrawCallbacks;
 import org.gfxtest.framework.ColorPalette;
 import org.gfxtest.framework.GrayscalePalette;
+import org.gfxtest.framework.HSBPalette;
 import org.gfxtest.framework.PrintTest;
 import org.gfxtest.framework.TestImage;
 import org.gfxtest.framework.TestResult;
@@ -290,6 +291,70 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.drawOval(). ellipses color are
+     * selected from a hue palette.
+     * 
+     * @param image
+     *            image to which ellipses are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawEllipseColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawEllipse(image, graphics2d, ELLIPSE_RADIUS_STEP, new CommonEllipseDrawCallbacks()
+        {
+            /**
+             * Callback function called before each ellipse is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = radius * 1.0f / maxRadius;
+                // set ellipse color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+        
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval(). ellipses color are
+     * selected from a hue palette.
+     * 
+     * @param image
+     *            image to which ellipses are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawEllipseColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawEllipse(image, graphics2d, ELLIPSE_RADIUS_STEP, new CommonEllipseDrawCallbacks()
+        {
+            /**
+             * Callback function called before each ellipse is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - radius * 1.0f / maxRadius;
+                // set ellipse color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+        
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Test basic behavior of method Graphics.drawOval(). ellipses are rendered
      * with various width and default end caps. Color of all rendered ellipses
      * are set to black.



More information about the distro-pkg-dev mailing list