/hg/gfx-test: Added new tests - using HSB color scale to these t...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Aug 21 03:43:29 PDT 2012


changeset e7900ffb0c6e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=e7900ffb0c6e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Aug 21 12:46:04 2012 +0200

	Added new tests - using HSB color scale to these test suites:
	PrintTestPolygons.java, PrintTestPolylines.java,
	PrintTestRectangles.java and PrintTestRoundRectangles.java.


diffstat:

 ChangeLog                                                |   8 +
 src/org/gfxtest/testsuites/PrintTestPolygons.java        |  77 ++++++++++++++-
 src/org/gfxtest/testsuites/PrintTestPolylines.java       |  65 +++++++++++++
 src/org/gfxtest/testsuites/PrintTestRectangles.java      |  67 +++++++++++++
 src/org/gfxtest/testsuites/PrintTestRoundRectangles.java |  67 +++++++++++++
 5 files changed, 279 insertions(+), 5 deletions(-)

diffs (401 lines):

diff -r a4e7d1976767 -r e7900ffb0c6e ChangeLog
--- a/ChangeLog	Mon Aug 20 11:38:54 2012 +0200
+++ b/ChangeLog	Tue Aug 21 12:46:04 2012 +0200
@@ -1,3 +1,11 @@
+2012-08-21  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestPolygons.java:
+	* src/org/gfxtest/testsuites/PrintTestPolylines.java:
+	* src/org/gfxtest/testsuites/PrintTestRectangles.java:
+	* src/org/gfxtest/testsuites/PrintTestRoundRectangles.java:
+	Added new tests - using HSB color scale in these test suites.
+
 2012-08-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/PrintTestArcs.java:
diff -r a4e7d1976767 -r e7900ffb0c6e src/org/gfxtest/testsuites/PrintTestPolygons.java
--- a/src/org/gfxtest/testsuites/PrintTestPolygons.java	Mon Aug 20 11:38:54 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestPolygons.java	Tue Aug 21 12:46:04 2012 +0200
@@ -48,6 +48,7 @@
 import org.gfxtest.callbacks.PolygonDrawCallbacks;
 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;
@@ -159,7 +160,7 @@
     }
 
     /**
-     * Test basic behavior of method Graphics.drawPolyhon(). Polygon are
+     * Test basic behavior of method Graphics.drawPolygon(). Polygon are
      * rendered with default width and default end caps. Color of all rendered
      * polygons are selected from a palette.
      * 
@@ -169,7 +170,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testDrawPolylinesColorPalette(TestImage image, Graphics2D graphics2d)
+    public TestResult testDrawPolygonsColorPalette(TestImage image, Graphics2D graphics2d)
     {
         drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
         {
@@ -200,7 +201,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testDrawPolylinesColorPaletteInv(TestImage image, Graphics2D graphics2d)
+    public TestResult testDrawPolygonsColorPaletteInv(TestImage image, Graphics2D graphics2d)
     {
         drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
         {
@@ -231,7 +232,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testDrawPolylinesGrayscale(TestImage image, Graphics2D graphics2d)
+    public TestResult testDrawPolygonsGrayscale(TestImage image, Graphics2D graphics2d)
     {
         drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
         {
@@ -264,7 +265,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testDrawPolylinesGrayscaleInv(TestImage image, Graphics2D graphics2d)
+    public TestResult testDrawPolygonsGrayscaleInv(TestImage image, Graphics2D graphics2d)
     {
         drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
         {
@@ -287,6 +288,72 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.drawPolygon(). Polygon are
+     * rendered with default width and default end caps. Color of all rendered
+     * polygons are selected from a grayscale palette.
+     * 
+     * @param image
+     *            image to which polygons are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolygonsColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+        {
+            /**
+             * Callback function called before each polygon is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = (y1 - BORDER) * 4.0f / this.image.getHeight();
+                // set polygon color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawPolygon(). Polygon are
+     * rendered with default width and default end caps. Color of all rendered
+     * polygons are selected from a hue palette.
+     * 
+     * @param image
+     *            image to which polygons are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolygonsColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+        {
+            /**
+             * Callback function called before each polygon is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - (y1 - BORDER) * 4.0f / this.image.getHeight();
+                // set polygon color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      * 
      * @param args
diff -r a4e7d1976767 -r e7900ffb0c6e src/org/gfxtest/testsuites/PrintTestPolylines.java
--- a/src/org/gfxtest/testsuites/PrintTestPolylines.java	Mon Aug 20 11:38:54 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestPolylines.java	Tue Aug 21 12:46:04 2012 +0200
@@ -48,6 +48,7 @@
 import org.gfxtest.callbacks.PolylineDrawCallbacks;
 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;
@@ -224,6 +225,38 @@
     /**
      * Test basic behavior of method Graphics.drawPolyline(). Polyline are
      * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a hue palette.
+     * 
+     * @param image
+     *            image to which polylines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP, new PolylineDrawCallbacks()
+        {
+            /**
+             * Callback function called before each polyline is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = (y1 - BORDER) * 4.0f / this.image.getHeight();
+                // set polyline color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
      * polylines are selected from a grayscale palette.
      * 
      * @param image
@@ -634,6 +667,38 @@
     /**
      * Test basic behavior of method Graphics.drawPolyline(). Polyline are
      * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a hue palette.
+     * 
+     * @param image
+     *            image to which polylines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP, new PolylineDrawCallbacks()
+        {
+            /**
+             * Callback function called before each polyline is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - (y1 - BORDER) * 4.0f / this.image.getHeight();
+                // set polyline color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
      * polylines are selected from a grayscale palette.
      * 
      * @param image
diff -r a4e7d1976767 -r e7900ffb0c6e src/org/gfxtest/testsuites/PrintTestRectangles.java
--- a/src/org/gfxtest/testsuites/PrintTestRectangles.java	Mon Aug 20 11:38:54 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestRectangles.java	Tue Aug 21 12:46:04 2012 +0200
@@ -50,6 +50,7 @@
 import org.gfxtest.callbacks.RectangleDrawCallbacks;
 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;
@@ -299,6 +300,72 @@
 
     /**
      * Test basic behavior of method Graphics.drawRect(). Rectangles are
+     * rendered with default width and default end caps. Color of all rendered
+     * rectangles are selected from a color 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 testDrawRectanglesColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawRectangles(image, graphics2d, RECTANGLE_STEP, new RectangleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = (x2 - x1) * 1.0f / (this.image.getWidth());
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRect(). Rectangles are
+     * rendered with default width and default end caps. Color of all rendered
+     * rectangles are selected from a color 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 testDrawRectanglesColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawRectangles(image, graphics2d, RECTANGLE_STEP, new RectangleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - (x2 - x1) * 1.0f / (this.image.getWidth());
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRect(). Rectangles are
      * rendered with various width and default end caps. Color of all rendered
      * rectangles are set to black.
      *
diff -r a4e7d1976767 -r e7900ffb0c6e src/org/gfxtest/testsuites/PrintTestRoundRectangles.java
--- a/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java	Mon Aug 20 11:38:54 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java	Tue Aug 21 12:46:04 2012 +0200
@@ -50,6 +50,7 @@
 import org.gfxtest.callbacks.RectangleDrawCallbacks;
 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;
@@ -229,6 +230,72 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.drawRect(). Rectangles are
+     * rendered with default width and default end caps. Color of all rendered
+     * rectangles are selected from a color 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 testDrawRoundRectanglesColorScale(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP, new RectangleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = (x2 - x1) * 1.0f / (this.image.getWidth());
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRect(). Rectangles are
+     * rendered with default width and default end caps. Color of all rendered
+     * rectangles are selected from a color 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 testDrawRoundRectanglesColorScaleInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP, new RectangleDrawCallbacks()
+        {
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // compute hue value
+                float hue = 1.0f - (x2 - x1) * 1.0f / (this.image.getWidth());
+                // set circle color
+                this.graphics.setColor(HSBPalette.createHsbColor(hue));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Test basic behavior of method Graphics.drawRoundRect(). Round rectangles are
      * rendered with default width and default end caps. Color of all rendered
      * rectangles are selected from a grascale palette.



More information about the distro-pkg-dev mailing list