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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Apr 4 01:55:30 PDT 2013


changeset e3f6ec64979e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=e3f6ec64979e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Apr 04 10:58:44 2013 +0200

	Added ten new tests to the test suite ClippingCircleByConcavePolygonalShape.
	Added two new static helper methods used by some test cases.


diffstat:

 ChangeLog                                                             |    7 +
 src/org/gfxtest/framework/CommonRenderingStyles.java                  |   28 +
 src/org/gfxtest/testsuites/ClippingCircleByConcavePolygonalShape.java |  230 ++++++++++
 3 files changed, 265 insertions(+), 0 deletions(-)

diffs (320 lines):

diff -r 2ac0d3616507 -r e3f6ec64979e ChangeLog
--- a/ChangeLog	Wed Apr 03 09:40:52 2013 +0200
+++ b/ChangeLog	Thu Apr 04 10:58:44 2013 +0200
@@ -1,3 +1,10 @@
+2013-04-04  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonRenderingStyles.java:
+	Added two new static helper methods used by some test cases.
+	* src/org/gfxtest/testsuites/ClippingCircleByConcavePolygonalShape.java:
+	Added ten new tests to this test suite.
+
 2013-04-03  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/BitBltBasicTests.java:
diff -r 2ac0d3616507 -r e3f6ec64979e src/org/gfxtest/framework/CommonRenderingStyles.java
--- a/src/org/gfxtest/framework/CommonRenderingStyles.java	Wed Apr 03 09:40:52 2013 +0200
+++ b/src/org/gfxtest/framework/CommonRenderingStyles.java	Thu Apr 04 10:58:44 2013 +0200
@@ -182,6 +182,20 @@
     }
 
     /**
+     * Set transparent black color.
+     * 
+     * @param graphics
+     *            graphics context for image
+     * @param transparency
+     *            color transparency represented in percents (0..100)
+     */
+    public static void setTransparentFillBlackColor(Graphics2D graphics, int transparency)
+    {
+        float value = transparencyToBounds(transparency / 100.0f);
+        graphics.setPaint(new Color(0.0f, 0.0f, 0.0f, value));
+    }
+
+    /**
      * Set transparent red color.
      * 
      * @param graphics
@@ -252,6 +266,20 @@
     }
 
     /**
+     * Set transparent yellow color.
+     * 
+     * @param graphics
+     *            graphics context for image
+     * @param transparency
+     *            color transparency represented in percents (0..100)
+     */
+    public static void setTransparentFillYellowColor(Graphics2D graphics, int transparency)
+    {
+        float value = transparencyToBounds(transparency / 100.0f);
+        graphics.setPaint(new Color(1.0f, 1.0f, 0.0f, value));
+    }
+
+    /**
      * Set horizontal gradient fill for given graphics context.
      *
      * @param image
diff -r 2ac0d3616507 -r e3f6ec64979e src/org/gfxtest/testsuites/ClippingCircleByConcavePolygonalShape.java
--- a/src/org/gfxtest/testsuites/ClippingCircleByConcavePolygonalShape.java	Wed Apr 03 09:40:52 2013 +0200
+++ b/src/org/gfxtest/testsuites/ClippingCircleByConcavePolygonalShape.java	Thu Apr 04 10:58:44 2013 +0200
@@ -120,6 +120,31 @@
 
     /**
      * Draw circle clipped by a concave polygonal shape. Circle is drawn using alpha
+     * paint with black color and selected transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @param transparency
+     *            selected transparency (0..100 percent)
+     */
+    private void drawCircleClippedByPolygonalShapeAlphaPaintBlack(TestImage image, Graphics2D graphics2d, int transparency)
+    {
+        // render clip polygon
+        CommonClippingOperations.renderConcaveClipPolygon(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
+        CommonRenderingStyles.setTransparentFillBlackColor(graphics2d, transparency);
+        // create clip area
+        CommonClippingOperations.createClipUsingConcavePolygonalShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+    }
+
+    /**
+     * Draw circle clipped by a concave polygonal shape. Circle is drawn using alpha
      * paint with red color and selected transparency.
      * 
      * @param image
@@ -244,6 +269,31 @@
     }
 
     /**
+     * Draw circle clipped by a concave polygonal shape. Circle is drawn using alpha
+     * paint with yellow color and selected transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @param transparency
+     *            selected transparency (0..100 percent)
+     */
+    private void drawCircleClippedByPolygonalShapeAlphaPaintYellow(TestImage image, Graphics2D graphics2d, int transparency)
+    {
+        // render clip polygon
+        CommonClippingOperations.renderConcaveClipPolygon(image, graphics2d);
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics2d);
+        // set fill color
+        CommonRenderingStyles.setTransparentFillYellowColor(graphics2d, transparency);
+        // create clip area
+        CommonClippingOperations.createClipUsingConcavePolygonalShape(image, graphics2d);
+        // fill the shape
+        CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+    }
+
+    /**
      * Check if circle shape could be clipped by a concave polygonal shape. Circle is
      * rendered using stroke paint.
      * 
@@ -355,6 +405,96 @@
 
     /**
      * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with black color at 0% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintBlack000(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 0% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintBlack(image, graphics2d, 0);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with black color at 25% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintBlack025(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 25% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintBlack(image, graphics2d, 25);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with black color at 50% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintBlack050(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 50% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintBlack(image, graphics2d, 50);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with black color at 75% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintBlack075(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 75% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintBlack(image, graphics2d, 75);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with black color at 100% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintBlack100(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 100% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintBlack(image, graphics2d, 100);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
      * rendered using alpha paint with red color at 0% transparency.
      * 
      * @param image
@@ -805,6 +945,96 @@
 
     /**
      * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with yellow color at 0% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintYellow000(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 0% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintYellow(image, graphics2d, 0);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with yellow color at 25% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintYellow025(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 25% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintYellow(image, graphics2d, 25);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with yellow color at 50% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintYellow050(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 50% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintYellow(image, graphics2d, 50);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with yellow color at 75% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintYellow075(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 75% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintYellow(image, graphics2d, 75);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
+     * rendered using alpha paint with yellow color at 100% transparency.
+     * 
+     * @param image
+     *            work image
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testClipCircleByPolygonalShapeAlphaPaintYellow100(TestImage image, Graphics2D graphics2d)
+    {
+        // draw circle clipped by concave polygonal shape using alpha paint with 100% transparency
+        drawCircleClippedByPolygonalShapeAlphaPaintYellow(image, graphics2d, 100);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Check if circle shape could be clipped by a concave polygonal shape. Circle is
      * rendered using horizontal gradient paint.
      * 
      * @param image



More information about the distro-pkg-dev mailing list