/hg/gfx-test: Added new tests to the test suite PrintTestRoundRe...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Jul 2 02:16:46 PDT 2012


changeset 6f8deba4ae11 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=6f8deba4ae11
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jul 02 11:19:23 2012 +0200

	Added new tests to the test suite PrintTestRoundRectangles.


diffstat:

 ChangeLog                                                |    5 +
 src/org/gfxtest/testsuites/PrintTestRoundRectangles.java |  423 +++++++++++++++
 2 files changed, 428 insertions(+), 0 deletions(-)

diffs (445 lines):

diff -r c3217fb92eaf -r 6f8deba4ae11 ChangeLog
--- a/ChangeLog	Thu Jun 28 17:17:25 2012 +0200
+++ b/ChangeLog	Mon Jul 02 11:19:23 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-02  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestRoundRectangles.java:
+	Added new tests.
+
 2012-06-28  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/PrintTestRectangles.java:
diff -r c3217fb92eaf -r 6f8deba4ae11 src/org/gfxtest/testsuites/PrintTestRoundRectangles.java
--- a/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java	Thu Jun 28 17:17:25 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java	Mon Jul 02 11:19:23 2012 +0200
@@ -351,6 +351,429 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to bevel style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to miter style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to round style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to bevel style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to miter style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to round style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to bevel style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to miter style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawRoundRect().
+     * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to round style.
+     * Color of all rendered lines are set to black.
+     *
+     * @param image
+     *            image to which circles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+        {
+            /**
+             * Stroke width which is changed in each iteration.
+             */
+            private float strokeWidth = MIN_STROKE_WIDTH;
+
+            /**
+             * Callback function called before each rectangle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+            {
+                // set stroke width
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
+                // and change it for the next iteration
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      *
      * @param args not used in this case



More information about the distro-pkg-dev mailing list