/hg/gfx-test: Support for linear and closed Path2D.Float and Pat...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Nov 15 01:06:47 PST 2012


changeset 6d5e5cd3917b in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=6d5e5cd3917b
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Nov 15 10:09:41 2012 +0100

	Support for linear and closed Path2D.Float and Path2D.Double:
	* src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java.


diffstat:

 ChangeLog                                                    |    5 +
 src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java |  379 ++++++++++-
 2 files changed, 359 insertions(+), 25 deletions(-)

diffs (truncated from 676 to 500 lines):

diff -r c88d4e4ba967 -r 6d5e5cd3917b ChangeLog
--- a/ChangeLog	Wed Nov 14 10:58:41 2012 +0100
+++ b/ChangeLog	Thu Nov 15 10:09:41 2012 +0100
@@ -1,3 +1,8 @@
+2012-11-15  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java:
+	Support for linear and closed Path2D.Float and Path2D.Double.
+
 2012-11-14  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/ClippingPathByEllipseShape.java:
diff -r c88d4e4ba967 -r 6d5e5cd3917b src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java
--- a/src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java	Wed Nov 14 10:58:41 2012 +0100
+++ b/src/org/gfxtest/testsuites/ClippingPathByRectangleShape.java	Thu Nov 15 10:09:41 2012 +0100
@@ -92,13 +92,14 @@
 
     /**
      * Draw path consisting of one line only clipped by rectangle shape.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
      * @param graphics2d
      *            graphics canvas
      */
-    private static void drawLinePathClippedByRectangleShape(TestImage image, Graphics2D graphics2d)
+    private static void drawLinePathFloatClippedByRectangleShape(TestImage image, Graphics2D graphics2d)
     {
         // prepare canvas for the rendering
         basicSetupForRendering(image, graphics2d);
@@ -109,6 +110,25 @@
     }
 
     /**
+     * Draw path consisting of one line only clipped by rectangle shape.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     */
+    private static void drawLinePathDoubleClippedByRectangleShape(TestImage image, Graphics2D graphics2d)
+    {
+        // prepare canvas for the rendering
+        basicSetupForRendering(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // draw the line path
+        graphics2d.draw(CommonPathsGenerator.createLinePathDouble(image));
+    }
+
+    /**
      * Draw quadratic path clipped by rectangle shape.
      * 
      * @param image
@@ -183,6 +203,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with default stroke width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -190,12 +211,33 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with default stroke width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -283,6 +325,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with zero stroke width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -290,7 +333,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeZeroStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeZeroStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -299,7 +342,32 @@
         // set stroke width
         CommonRenderingStyles.setStrokeZeroThick(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with zero stroke width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeZeroStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeZeroThick(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -403,6 +471,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is rendered
      * using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -410,7 +479,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLineFloatPathByRectangleShapeThickStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render rectangle which is used as a clip shape
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -419,7 +488,32 @@
         // set stroke width
         CommonRenderingStyles.setStrokeThickWidth(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is rendered
+     * using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLineDoublePathByRectangleShapeThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render rectangle which is used as a clip shape
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeThickWidth(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -523,6 +617,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is rendered
      * using stroke paint with extra thick width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -530,7 +625,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render rectangle which is used as a clip shape
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -539,7 +634,32 @@
         // set stroke width
         CommonRenderingStyles.setStrokeExtraThickWidth(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is rendered
+     * using stroke paint with extra thick width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render rectangle which is used as a clip shape
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeExtraThickWidth(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -643,6 +763,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with default stroke width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -650,14 +771,37 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeDashedStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeDashedStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
         // set dashed pattern
         CommonRenderingStyles.setDashedStrokePattern(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with default stroke width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeDashedStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set dashed pattern
+        CommonRenderingStyles.setDashedStrokePattern(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -753,6 +897,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Float()
      * 
      * @param image
      *            work image
@@ -760,7 +905,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeDashedThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeDashedThickStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -769,7 +914,32 @@
         // set dashed pattern
         CommonRenderingStyles.setDashedStrokePattern(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Double()
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeDashedThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeThickWidth(graphics2d);
+        // set dashed pattern
+        CommonRenderingStyles.setDashedStrokePattern(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -873,6 +1043,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Float().
      * 
      * @param image
      *            work image
@@ -880,7 +1051,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeDashedExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeDashedExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -889,7 +1060,32 @@
         // set dashed pattern
         CommonRenderingStyles.setDashedStrokePattern(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with thick stroke width.
+     * Line path is constructed using new Path.Double().
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeDashedExtraThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeExtraThickWidth(graphics2d);
+        // set dashed pattern
+        CommonRenderingStyles.setDashedStrokePattern(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -993,6 +1189,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is
      * rendered using stroke paint with zero stroke width.
+     * Line path is constructed using new Path.Float().
      * 
      * @param image
      *            work image
@@ -1000,7 +1197,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeDashedZeroThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeDashedZeroThickStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -1009,7 +1206,32 @@
         // set dashed pattern
         CommonRenderingStyles.setDashedStrokePattern(graphics2d);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is
+     * rendered using stroke paint with zero stroke width.
+     * Line path is constructed using new Path.Double().
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeDashedZeroThickStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeZeroThick(graphics2d);
+        // set dashed pattern
+        CommonRenderingStyles.setDashedStrokePattern(graphics2d);
+        // set clip region and draw the path
+        drawLinePathDoubleClippedByRectangleShape(image, graphics2d);
         // test result
         return TestResult.PASSED;
     }
@@ -1113,6 +1335,7 @@
     /**
      * Check if line path could be clipped by a rectangle shape. Path is rendered
      * using dotted stroke paint with normal stroke width.
+     * Line path is constructed using new Path.Float().
      * 
      * @param image
      *            work image
@@ -1120,7 +1343,7 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testClipLinePathByRectangleShapeDottedStrokePaint(TestImage image, Graphics2D graphics2d)
+    public TestResult testClipLinePathFloatByRectangleShapeDottedStrokePaint(TestImage image, Graphics2D graphics2d)
     {
         // render clip rectangle
         CommonClippingOperations.renderClipRectangle(image, graphics2d);
@@ -1129,7 +1352,33 @@
         // set dashed pattern
         CommonRenderingStyles.setDashedStrokePattern(graphics2d, DOTTED_PATTERN);
         // set clip region and draw the path
-        drawLinePathClippedByRectangleShape(image, graphics2d);
+        drawLinePathFloatClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+
+    /**
+     * Check if line path could be clipped by a rectangle shape. Path is rendered
+     * using dotted stroke paint with normal stroke width.
+     * Line path is constructed using new Path.Double().
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipLinePathDoubleByRectangleShapeDottedStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        //CommonRenderingStyles.setStrokeThickWidth(graphics2d, BasicStroke.CAP_ROUND);



More information about the distro-pkg-dev mailing list