/hg/gfx-test: 2011-11-23 Pavel Tisnovsky <ptisnovs at redhat.com>
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Nov 23 04:17:03 PST 2011
changeset 15cc4f8f742a in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=15cc4f8f742a
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Nov 23 13:19:16 2011 +0100
2011-11-23 Pavel Tisnovsky <ptisnovs at redhat.com>
*
src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
Improved javadoc.
* src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java:
Added five new tests to this test suite.
diffstat:
ChangeLog | 7 +
src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java | 2 +-
src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java | 262 ++++++++++
3 files changed, 270 insertions(+), 1 deletions(-)
diffs (306 lines):
diff -r 2a1c2b41f808 -r 15cc4f8f742a ChangeLog
--- a/ChangeLog Tue Nov 22 11:12:54 2011 +0100
+++ b/ChangeLog Wed Nov 23 13:19:16 2011 +0100
@@ -1,3 +1,10 @@
+2011-11-23 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
+ Improved javadoc.
+ * src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java:
+ Added five new tests to this test suite.
+
2011-11-22 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java:
diff -r 2a1c2b41f808 -r 15cc4f8f742a src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java
--- a/src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java Tue Nov 22 11:12:54 2011 +0100
+++ b/src/org/gfxtest/testsuites/ClippingCircleByRectangleShape.java Wed Nov 23 13:19:16 2011 +0100
@@ -127,7 +127,7 @@
* @param graphics2d
* graphics canvas
* @param transparency
- * selected transparency
+ * selected transparency (0..100 percent)
*/
private void drawCircleClippedByRectangleAlphaPaintBlue(TestImage image, Graphics2D graphics2d, int transparency)
{
diff -r 2a1c2b41f808 -r 15cc4f8f742a src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java
--- a/src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java Tue Nov 22 11:12:54 2011 +0100
+++ b/src/org/gfxtest/testsuites/ClippingCircleByRoundRectangleShape.java Wed Nov 23 13:19:16 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,259 @@
@Zoom(1)
public class ClippingCircleByRoundRectangleShape 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 round rectangular area
+ CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
+ }
+
+ /**
+ * Draw empty circle clipped by a round rectangle shape.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ */
+ private static void drawEmptyCircleClippedByRoundRectangleShape(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 a round rectangle shape.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ */
+ private static void drawFilledCircleClippedByRoundRectangleShape(TestImage image, Graphics2D graphics2d)
+ {
+ // prepare canvas for the rendering
+ basicSetupForRendering(image, graphics2d);
+ // fill the shape
+ CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+ }
+
+ /**
+ * 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.createClipUsingRectangleShape(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.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @param transparency
+ * selected transparency (0..100 percent)
+ */
+ private void drawCircleClippedByRoundRectangleAlphaPaintRed(TestImage image, Graphics2D graphics2d, int transparency)
+ {
+ // prepare for rendering shape using alpha paint
+ prepareForAlphaPaint(image, graphics2d);
+ // set transparent fill color
+ CommonRenderingStyles.setTransparentFillRedColor(graphics2d, transparency);
+ // and perform the drawing
+ drawFilledCircleUsingAlphaPaint(image, graphics2d);
+ }
+
+ /**
+ * Draw circle clipped by a round rectangle shape. Circle is drawn using
+ * alpha paint with green color.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @param transparency
+ * selected transparency (0..100 percent)
+ */
+ private void drawCircleClippedByRoundRectangleAlphaPaintGreen(TestImage image, Graphics2D graphics2d, int transparency)
+ {
+ // prepare for rendering shape using alpha paint
+ prepareForAlphaPaint(image, graphics2d);
+ // set transparent fill color
+ CommonRenderingStyles.setTransparentFillGreenColor(graphics2d, transparency);
+ // and perform the drawing
+ drawFilledCircleUsingAlphaPaint(image, graphics2d);
+ }
+
+ /**
+ * Draw circle clipped by a round rectangle shape. Circle is drawn using
+ * alpha paint with blue color.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @param transparency
+ * selected transparency (0..100 percent)
+ */
+ private void drawCircleClippedByRoundRectangleAlphaPaintBlue(TestImage image, Graphics2D graphics2d, int transparency)
+ {
+ // prepare for rendering shape using alpha paint
+ prepareForAlphaPaint(image, graphics2d);
+ // set transparent fill color
+ CommonRenderingStyles.setTransparentFillBlueColor(graphics2d, transparency);
+ // and perform the drawing
+ drawFilledCircleUsingAlphaPaint(image, graphics2d);
+ }
+
+ /**
+ * Check if circle shape could be clipped by a round 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 testClipCircleByRoundRectangleShapeStrokePaint(TestImage image, Graphics2D graphics2d)
+ {
+ // render clip round rectangle
+ CommonClippingOperations.renderClipRoundRectangle(image, 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 wide stroke paint.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClipCircleByRoundRectangleShapeWideStrokePaint(TestImage image, Graphics2D graphics2d)
+ {
+ // render clip round rectangle
+ CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+ // set stroke width
+ CommonRenderingStyles.setStrokeThickWidth(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 extra wide stroke paint.
+ *
+ * @param image
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClipCircleByRoundRectangleShapeExtraWideStrokePaint(TestImage image, Graphics2D graphics2d)
+ {
+ // render clip round rectangle
+ CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+ // set stroke width
+ CommonRenderingStyles.setStrokeExtraThickWidth(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
+ * work image
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClipCircleByRoundRectangleShapeColorPaint(TestImage image, Graphics2D graphics2d)
+ {
+ // render clip round rectangle
+ CommonClippingOperations.renderClipRoundRectangle(image, graphics2d);
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics2d);
+ // set fill color
+ CommonRenderingStyles.setFillColor(graphics2d);
+ // create clip shape
+ CommonClippingOperations.createClipUsingRoundRectangleShape(image, graphics2d);
+ // fill the shape
+ CommonShapesRenderer.drawFilledCircle(image, graphics2d);
+ // test result
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Check if circle shape could be clipped by a round 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
+ drawCircleClippedByRoundRectangleAlphaPaintBlue(image, graphics2d, 0);
+ // test result
+ return TestResult.PASSED;
+ }
/**
* Entry point to the test suite.
More information about the distro-pkg-dev
mailing list