/hg/gfx-test: Added 7 new tests to the test suite src/org/gfxtes...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Aug 16 03:43:58 PDT 2012


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

	Added 7 new tests to the test suite src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java.


diffstat:

 ChangeLog                                                   |    5 +
 src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java |  287 +++++++++++-
 2 files changed, 286 insertions(+), 6 deletions(-)

diffs (358 lines):

diff -r 5d5d6a476881 -r eaaaa2701846 ChangeLog
--- a/ChangeLog	Thu Aug 16 12:39:17 2012 +0200
+++ b/ChangeLog	Thu Aug 16 12:46:30 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-16  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java:
+	Added 7 new tests to this test suite.
+
 2012-08-16  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/callbacks/QudraticCurveDrawCallbacks.java:
diff -r 5d5d6a476881 -r eaaaa2701846 src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java	Thu Aug 16 12:39:17 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java	Thu Aug 16 12:46:30 2012 +0200
@@ -41,6 +41,7 @@
 package org.gfxtest.testsuites;
 
 import java.awt.BasicStroke;
+import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.geom.Path2D;
 
@@ -193,7 +194,7 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with default width and default end caps.
+     * Cubic curves are rendered with default width and default end caps.
      * Color of all rendered curves are selected from a palette.
      * All rendered cubic curves are represented by a Path object.
      *
@@ -225,7 +226,7 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with default width and default end caps.
+     * Cubic curves are rendered with default width and default end caps.
      * Color of all rendered curves are selected from a grayscale palette.
      * All rendered cubic curves are represented by a Path object.
      *
@@ -259,7 +260,40 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with various width and default end caps.
+     * Cubic curves are rendered with default width and default end caps.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesColorScale(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // compute hue value
+                float hue = y1 * 1.0f / this.image.getHeight();
+                // set curve color
+                this.graphics.setColor(new Color(Color.HSBtoRGB(hue, 1.0f, 0.7f)));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and default end caps.
      * Color of all rendered curves are selected from a grayscale palette.
      * All rendered cubic curves are represented by a Path object.
      *
@@ -298,7 +332,7 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with various width and end caps set to CAP_BUTT.
+     * Cubic curves are rendered with various width and end caps set to CAP_BUTT.
      * Join style is set to bevel style.
      * Color of all rendered curves are selected from a grayscale palette.
      * All rendered cubic curves are represented by a Path object.
@@ -338,7 +372,7 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with various width and end caps set to CAP_ROUND.
+     * Cubic curves are rendered with various width and end caps set to CAP_ROUND.
      * Join style is set to bevel style.
      * Color of all rendered curves are selected from a grayscale palette.
      * All rendered cubic curves are represented by a Path object.
@@ -378,7 +412,7 @@
 
     /**
      * Test basic behavior of method Graphics.draw(Path).
-     * Quadratic curves are rendered with various width and end caps set to CAP_SQUARE.
+     * Cubic curves are rendered with various width and end caps set to CAP_SQUARE.
      * Join style is set to bevel style.
      * Color of all rendered curves are selected from a grayscale palette.
      * All rendered cubic curves are represented by a Path object.
@@ -417,6 +451,247 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to miter style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapButtJoinMiter(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to miter style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapRoundJoinMiter(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to miter style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapSquareJoinMiter(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to round style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapButtJoinRound(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to round style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapRoundJoinRound(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.draw(Path).
+     * Cubic curves are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to round style.
+     * Color of all rendered curves are selected from a grayscale palette.
+     * All rendered cubic curves are represented by a Path object.
+     *
+     * @param image
+     *            image to which lines are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawCubicCurvesChangeWidthCapSquareJoinRound(TestImage image, Graphics2D graphics)
+    {
+        drawCubicCurve(image, graphics, CUBIC_CURVE_STEP, new CubicCurveDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each cubic curve is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
+                // set new stroke width
+                this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      * 
      * @param args



More information about the distro-pkg-dev mailing list