/hg/gfx-test: * src/org/gfxtest/testsuites/PrintTestCircles.java:

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Wed Jun 6 03:06:23 PDT 2012


changeset 1c4af4ceea8d in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=1c4af4ceea8d
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jun 06 12:09:01 2012 +0200

	* src/org/gfxtest/testsuites/PrintTestCircles.java:
	Added ten new tests to this test suite.


diffstat:

 ChangeLog                                        |    5 +
 src/org/gfxtest/testsuites/PrintTestCircles.java |  503 +++++++++++++++++++++-
 2 files changed, 485 insertions(+), 23 deletions(-)

diffs (truncated from 681 to 500 lines):

diff -r fae3942e5a44 -r 1c4af4ceea8d ChangeLog
--- a/ChangeLog	Fri Jun 01 16:22:21 2012 +0200
+++ b/ChangeLog	Wed Jun 06 12:09:01 2012 +0200
@@ -1,3 +1,8 @@
+2012-06-06  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestCircles.java:
+	Added ten new tests to this test suite.
+
 2012-06-01  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/PrintTestLines.java:
diff -r fae3942e5a44 -r 1c4af4ceea8d src/org/gfxtest/testsuites/PrintTestCircles.java
--- a/src/org/gfxtest/testsuites/PrintTestCircles.java	Fri Jun 01 16:22:21 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestCircles.java	Wed Jun 06 12:09:01 2012 +0200
@@ -76,6 +76,10 @@
 public class PrintTestCircles extends PrintTest
 {
 
+    private static final float MIN_STROKE_WIDTH = 0.0f;
+    private static final float WIDTH_DELTA = 0.5f;
+    protected static final int MAX_COLOR_INDEX = 1000;
+
     /**
      * Method which renders set of circles using various colors and
      * stroke styles. For each circle, the callback function/method is called to
@@ -183,6 +187,36 @@
 
     /**
      * Test basic behavior of method Graphics.drawOval().
+     * Circles color are selected from a 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 testDrawCircleColorPaletteInv(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)
+            {
+                // set circle color
+                this.graphics.setColor(ColorPalette.getColor(MAX_COLOR_INDEX - index));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
      * Circles color are selected from a grayscale palette.
      *
      * @param image
@@ -260,7 +294,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -278,7 +312,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -302,7 +336,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -320,7 +354,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -344,7 +378,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -362,7 +396,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -386,7 +420,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -404,7 +438,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -428,7 +462,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -446,7 +480,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -470,7 +504,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -488,7 +522,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -512,7 +546,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -530,7 +564,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -554,7 +588,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -572,7 +606,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -596,7 +630,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -614,7 +648,7 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
             }
         });
 
@@ -638,7 +672,7 @@
     {
         drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
         {
-            private float strokeWidth = 0.0f;
+            private float strokeWidth = MIN_STROKE_WIDTH;
 
             /**
              * Callback function called before each circle is rendered.
@@ -656,7 +690,430 @@
              */
             private void changeStrokeWidth()
             {
-                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + 0.5f : this.strokeWidth;
+                this.strokeWidth  = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + WIDTH_DELTA : this.strokeWidth;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to bevel style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapButtJoinBevelInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth -= WIDTH_DELTA;
+                // stroke width should not be less than zero
+                if (this.strokeWidth < MIN_STROKE_WIDTH)
+                {
+                    this.strokeWidth = MIN_STROKE_WIDTH;
+                }
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to bevel style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapRoundJoinBevelInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth -= WIDTH_DELTA;
+                // stroke width should not be less than zero
+                if (this.strokeWidth < MIN_STROKE_WIDTH)
+                {
+                    this.strokeWidth = MIN_STROKE_WIDTH;
+                }
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to bevel style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapSquareJoinBevelInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth -= WIDTH_DELTA;
+                // stroke width should not be less than zero
+                if (this.strokeWidth < MIN_STROKE_WIDTH)
+                {
+                    this.strokeWidth = MIN_STROKE_WIDTH;
+                }
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_BUTT.
+     * Join style is set to miter style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapButtJoinMiterInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth -= WIDTH_DELTA;
+                // stroke width should not be less than zero
+                if (this.strokeWidth < MIN_STROKE_WIDTH)
+                {
+                    this.strokeWidth = MIN_STROKE_WIDTH;
+                }
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_ROUND.
+     * Join style is set to miter style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapRoundJoinMiterInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+            /**
+             * Callback function called before each circle is rendered.
+             */
+            @Override
+            public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+            {
+                this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+                changeStrokeWidth();
+                return;
+            }
+
+            /**
+             * Changes stroke width.
+             */
+            private void changeStrokeWidth()
+            {
+                this.strokeWidth -= WIDTH_DELTA;
+                // stroke width should not be less than zero
+                if (this.strokeWidth < MIN_STROKE_WIDTH)
+                {
+                    this.strokeWidth = MIN_STROKE_WIDTH;
+                }
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawOval().
+     * Circles are rendered with various width and end caps set to CAP_SQUARE.
+     * Join style is set to miter style.
+     * Color of all rendered circles 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 testDrawCircleChangeWidthCapSquareJoinMiterInv(TestImage image, Graphics2D graphics2d)
+    {
+        drawCircle(image, graphics2d, CIRCLE_RADIUS_STEP << 1, new CommonCircleDrawCallbacks()
+        {
+            private float strokeWidth = MAX_STROKE_WIDTH - 2;
+



More information about the distro-pkg-dev mailing list