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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Jul 19 02:06:27 PDT 2012


changeset fe17c684bae1 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=fe17c684bae1
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Jul 19 11:08:39 2012 +0200

	Added ten new tests to the test suite PrintTestPolylines.java


diffstat:

 ChangeLog                                          |    5 +
 src/org/gfxtest/testsuites/PrintTestPolylines.java |  373 +++++++++++++++++++++
 2 files changed, 378 insertions(+), 0 deletions(-)

diffs (395 lines):

diff -r bbe4d2bd6894 -r fe17c684bae1 ChangeLog
--- a/ChangeLog	Tue Jul 17 10:35:26 2012 +0200
+++ b/ChangeLog	Thu Jul 19 11:08:39 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-18  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestPolylines.java:
+	Added ten new tests to this test suite.
+
 2012-07-17  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/PrintTestPaths.java:
diff -r bbe4d2bd6894 -r fe17c684bae1 src/org/gfxtest/testsuites/PrintTestPolylines.java
--- a/src/org/gfxtest/testsuites/PrintTestPolylines.java	Tue Jul 17 10:35:26 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestPolylines.java	Thu Jul 19 11:08:39 2012 +0200
@@ -259,6 +259,379 @@
     }
 
     /**
+     * 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.
+     * Join style is set to bevel style and end caps is set to CAP_BUTT.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapButtJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to miter style and end caps is set to CAP_BUTT.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapButtJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to round style and end caps is set to CAP_BUTT.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapButtJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to bevel style and end caps is set to CAP_ROUND.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapRoundJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to miter style and end caps is set to CAP_ROUND.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapRoundJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to round style and end caps is set to CAP_ROUND.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapRoundJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to bevel style and end caps is set to CAP_SQUARE.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapSquareJoinBevel(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to miter style and end caps is set to CAP_SQUARE.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapSquareJoinMiter(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a grayscale palette.
+     * Join style is set to round style and end caps is set to CAP_SQUARE.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesChangeWidthCapSquareJoinRound(TestImage image, Graphics2D graphics2d)
+    {
+        drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+        {
+            /**
+             * Stroke width.
+             */
+            float strokeWidth = 0.0f;
+
+            /**
+             * Callback function called before each polyline 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));
+                // set new stroke width
+                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.drawPolyline(). Polyline are
+     * rendered with default width and default end caps. Color of all rendered
+     * polylines are selected from a palette.
+     * 
+     * @param image
+     *            image to which rectangles are to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawPolylinesColorPaletteInv(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)
+            {
+                // set polyline color
+                this.graphics.setColor(ColorPalette.getColor(MAX_COLOR_INDEX - index));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      * 
      * @param args



More information about the distro-pkg-dev mailing list