/hg/gfx-test: 2011-11-22 Pavel Tisnovsky <ptisnovs at redhat.com>

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Nov 22 02:10:44 PST 2011


changeset 2a1c2b41f808 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=2a1c2b41f808
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Nov 22 11:12:54 2011 +0100

	2011-11-22 Pavel Tisnovsky <ptisnovs at redhat.com>

	 *
	src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
	Added nine new tests to this test suite (incl. transparency tests).


diffstat:

 ChangeLog                                                      |    5 +
 src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java |  261 ++++++++++
 2 files changed, 266 insertions(+), 0 deletions(-)

diffs (291 lines):

diff -r 009c81195a99 -r 2a1c2b41f808 ChangeLog
--- a/ChangeLog	Mon Nov 21 12:02:48 2011 +0100
+++ b/ChangeLog	Tue Nov 22 11:12:54 2011 +0100
@@ -1,3 +1,8 @@
+2011-11-22  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
+	Added nine new tests to this test suite (incl. transparency tests).
+
 2011-11-21  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/ClippingCircleByEllipseShape.java:
diff -r 009c81195a99 -r 2a1c2b41f808 src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java
--- a/src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java	Mon Nov 21 12:02:48 2011 +0100
+++ b/src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java	Tue Nov 22 11:12:54 2011 +0100
@@ -40,7 +40,16 @@
 
 package org.gfxtest.testsuites;
 
+import java.awt.Graphics2D;
+
+
+
+import org.gfxtest.framework.CommonClippingOperations;
+import org.gfxtest.framework.CommonRenderingStyles;
+import org.gfxtest.framework.CommonShapesRenderer;
 import org.gfxtest.framework.GfxTest;
+import org.gfxtest.framework.TestImage;
+import org.gfxtest.framework.TestResult;
 import org.gfxtest.framework.annotations.GraphicsPrimitive;
 import org.gfxtest.framework.annotations.GraphicsPrimitives;
 import org.gfxtest.framework.annotations.TestType;
@@ -61,6 +70,258 @@
 @Zoom(1)
 public class ClippingCircleByRectangleShape extends GfxTest
 {
+    /**
+     * Prepare canvas for the rendering.
+     *
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     */
+    private static void basicSetupForRendering(TestImage image, Graphics2D graphics2d)
+    {
+        // create clip shape which is constructed from rectangular area
+        CommonClippingOperations.createClipUsingRectangleShape(image, graphics2d);
+    }
+
+    /**
+     * Draw empty circle clipped by rectangle shape.
+     *
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     */
+    private static void drawEmptyCircleClippedByRectangleShape(TestImage image, Graphics2D graphics2d)
+    {
+        // prepare canvas for the rendering
+        basicSetupForRendering(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // draw the shape
+        CommonShapesRenderer.drawCircle(image, graphics2d);
+    }
+
+    /**
+     * Draw empty circle clipped by rectangle shape.
+     *
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     */
+    private static void drawFilledCircleClippedByRectangleShape(TestImage image, Graphics2D graphics2d)
+    {
+        // prepare canvas for the rendering
+        basicSetupForRendering(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+    }
+
+    /**
+     * Draw circle clipped by rectangle. Circle is drawn using alpha paint with
+     * blue color.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @param transparency
+     *            selected transparency
+     */
+    private void drawCircleClippedByRectangleAlphaPaintBlue(TestImage image, Graphics2D graphics2d, int transparency)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
+        CommonRenderingStyles.setTransparentFillBlueColor(graphics2d, transparency);
+        // create clip area
+        CommonClippingOperations.createClipUsingRectangleShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangle shape. Circle is
+     * rendered using stroke paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set clip region and draw the circle
+        drawEmptyCircleClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangle shape. Circle is
+     * rendered using wide stroke paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeWideStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeThickWidth(graphics2d);
+        // set clip region and draw the circle
+        drawEmptyCircleClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangle shape. Circle is
+     * rendered using extra wide stroke paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeExtraWideStrokePaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke width
+        CommonRenderingStyles.setStrokeExtraThickWidth(graphics2d);
+        // set clip region and draw the circle
+        drawEmptyCircleClippedByRectangleShape(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangle shape. Circle is
+     * rendered using color paint.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeColorPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // render clip rectangle
+        CommonClippingOperations.renderClipRectangle(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
+        CommonRenderingStyles.setFillColor(graphics2d);
+        // create clip shape
+        CommonClippingOperations.createClipUsingRectangleShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangular shape. Circle is
+     * rendered using alpha paint with blue color at 0% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeAlphaPaintBlue000(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by rectangle using alpha paint with 0% transparency
+        drawCircleClippedByRectangleAlphaPaintBlue(image, graphics2d, 0);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangular shape. Circle is
+     * rendered using alpha paint with blue color at 25% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeAlphaPaintBlue025(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by rectangle using alpha paint with 25% transparency
+        drawCircleClippedByRectangleAlphaPaintBlue(image, graphics2d, 25);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangular shape. Circle is
+     * rendered using alpha paint with blue color at 50% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeAlphaPaintBlue050(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by rectangle using alpha paint with 50% transparency
+        drawCircleClippedByRectangleAlphaPaintBlue(image, graphics2d, 50);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangular shape. Circle is
+     * rendered using alpha paint with blue color at 75% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeAlphaPaintBlue075(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by rectangle using alpha paint with 75% transparency
+        drawCircleClippedByRectangleAlphaPaintBlue(image, graphics2d, 75);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a rectangular shape. Circle is
+     * rendered using alpha paint with blue color at 100% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByRectangleShapeAlphaPaintBlue100(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by rectangle using alpha paint with 100% transparency
+        drawCircleClippedByRectangleAlphaPaintBlue(image, graphics2d, 100);
+        // test result
+        return TestResult.PASSED;
+    }
 
     /**
      * Entry point to the test suite.



More information about the distro-pkg-dev mailing list