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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Feb 27 09:17:07 PST 2012


changeset 31433950c5cd in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=31433950c5cd
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Feb 27 18:19:42 2012 +0100

	*
	src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java:
	Refactored, added new test cases.


diffstat:

 ChangeLog                                                           |    5 +
 src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java |  142 +++++----
 2 files changed, 87 insertions(+), 60 deletions(-)

diffs (243 lines):

diff -r f05b4d988289 -r 31433950c5cd ChangeLog
--- a/ChangeLog	Fri Feb 24 17:06:23 2012 +0100
+++ b/ChangeLog	Mon Feb 27 18:19:42 2012 +0100
@@ -1,3 +1,8 @@
+2012-02-27  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java:
+	Refactored, added new test cases.
+
 2012-02-24  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
diff -r f05b4d988289 -r 31433950c5cd src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java
--- a/src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java	Fri Feb 24 17:06:23 2012 +0100
+++ b/src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java	Mon Feb 27 18:19:42 2012 +0100
@@ -60,7 +60,7 @@
 
 /**
  * This test check if clipping is working correctly for an empty, filled
- * and textured circle which is clipped by round rectangle shape.
+ * and textured circle which is clipped by round rectangle shape (not rectangular area!).
  * 
  * @author Pavel Tisnovsky
  */
@@ -119,42 +119,8 @@
     }
 
     /**
-     * Prepare for rendering shape using alpha paint.
-     *
-     * @param image
-     *            work image
-     * @param graphics2d
-     *            graphics canvas
-     */
-    private void prepareForAlphaPaint(TestImage image, Graphics2D graphics2d)
-    {
-        // render clip round rectangle
-        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
-        // set stroke color
-        CommonRenderingStyles.setStrokeColor(graphics2d);
-        // set fill color
-    }
-
-    /**
-     * Draw filled circle using alpha paint (fill color should be set before
-     * this method is called).
-     * 
-     * @param image
-     *            work image
-     * @param graphics2d
-     *            graphics canvas
-     */
-    private void drawFilledCircleUsingAlphaPaint(TestImage image, Graphics2D graphics2d)
-    {
-        // create clip area
-        CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
-        // fill the shape
-        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
-    }
-
-    /**
-     * Draw circle clipped by a round rectangle shape. Circle is drawn using
-     * alpha paint with red color.
+     * Draw circle clipped by a round rectangle shape. Circle is drawn using alpha paint with
+     * red color and selected transparency.
      * 
      * @param image
      *            work image
@@ -165,17 +131,21 @@
      */
     private void drawCircleClippedByRoundRectangleAlphaPaintRed(TestImage image, Graphics2D graphics2d, int transparency)
     {
-        // prepare for rendering shape using alpha paint
-        prepareForAlphaPaint(image, graphics2d);
-        // set transparent fill color
+        // render clip rectangle
+        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
         CommonRenderingStyles.setTransparentFillRedColor(graphics2d, transparency);
-        // and perform the drawing
-        drawFilledCircleUsingAlphaPaint(image, graphics2d);
+        // create clip area
+        CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
     }
 
     /**
-     * Draw circle clipped by a round rectangle shape. Circle is drawn using
-     * alpha paint with green color.
+     * Draw circle clipped by a round rectangle shape. Circle is drawn using alpha paint with
+     * green color and selected transparency.
      * 
      * @param image
      *            work image
@@ -186,17 +156,21 @@
      */
     private void drawCircleClippedByRoundRectangleAlphaPaintGreen(TestImage image, Graphics2D graphics2d, int transparency)
     {
-        // prepare for rendering shape using alpha paint
-        prepareForAlphaPaint(image, graphics2d);
-        // set transparent fill color
+        // render clip rectangle
+        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
         CommonRenderingStyles.setTransparentFillGreenColor(graphics2d, transparency);
-        // and perform the drawing
-        drawFilledCircleUsingAlphaPaint(image, graphics2d);
+        // create clip area
+        CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
     }
 
     /**
-     * Draw circle clipped by a round rectangle shape. Circle is drawn using
-     * alpha paint with blue color.
+     * Draw circle clipped by a round rectangle shape. Circle is drawn using alpha paint with
+     * blue color and selected transparency.
      * 
      * @param image
      *            work image
@@ -207,12 +181,16 @@
      */
     private void drawCircleClippedByRoundRectangleAlphaPaintBlue(TestImage image, Graphics2D graphics2d, int transparency)
     {
-        // prepare for rendering shape using alpha paint
-        prepareForAlphaPaint(image, graphics2d);
-        // set transparent fill color
+        // render clip rectangle
+        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
         CommonRenderingStyles.setTransparentFillBlueColor(graphics2d, transparency);
-        // and perform the drawing
-        drawFilledCircleUsingAlphaPaint(image, graphics2d);
+        // create clip area
+        CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
     }
 
     /**
@@ -227,7 +205,7 @@
      */
     public TestResult testClipCircleByRoundRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
     {
-        // render clip round rectangle
+        // render clip round rectangle which is used as a base for clip shape
         CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
         // set clip region and draw the circle
         drawEmptyCircleClippedByRoundRectangleShape(image, graphics2d);
@@ -247,7 +225,7 @@
      */
     public TestResult testClipCircleByRoundRectangleShapeWideStrokePaint(TestImage image, Graphics2D graphics2d)
     {
-        // render clip round rectangle
+        // render clip round rectangle which is used as a base for clip shape
         CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
         // set stroke width
         CommonRenderingStyles.setStrokeThickWidth(graphics2d);
@@ -269,7 +247,7 @@
      */
     public TestResult testClipCircleByRoundRectangleShapeExtraWideStrokePaint(TestImage image, Graphics2D graphics2d)
     {
-        // render clip round rectangle
+        // render clip round rectangle which is used as a base for clip shape
         CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
         // set stroke width
         CommonRenderingStyles.setStrokeExtraThickWidth(graphics2d);
@@ -281,6 +259,28 @@
 
     /**
      * Check if circle shape could be clipped by a round rectangle shape. Circle is
+     * rendered using zero wide stroke paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeZeroWideStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle which is used as a base for clip shape
+        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeZeroThick(graphics2d);
+        // set clip region and draw the circle
+        drawEmptyCircleClippedByRoundRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a round rectangle shape. Circle is
      * rendered using color paint.
      * 
      * @param image
@@ -291,7 +291,7 @@
      */
     public TestResult testClipCircleByRoundRectangleShapeColorPaint(TestImage image, Graphics2D graphics2d)
     {
-        // render clip round rectangle
+        // render clip round rectangle which is used as a base for clip shape
         CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
         // set stroke color
         CommonRenderingStyles.setStrokeColor(graphics2d);
@@ -679,6 +679,28 @@
     }
 
     /**
+     * Check if circle shape could be clipped by a round rectangle shape. Circle is
+     * rendered using texture paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRoundRectangleShapeCheckerTexturePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip round rectangle which is used as a base for clip shape
+        CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+        // set the texture
+        CommonRenderingStyles.setTextureFillUsingCheckerTexture(image, graphics2d);
+        // set clip region and render filled circle
+        drawFilledCircleClippedByRoundRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      * 
      * @param args



More information about the distro-pkg-dev mailing list