/hg/gfx-test: 2011-11-03 Pavel Tisnovsky <ptisnovs at redhat.com>
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Nov 3 06:20:29 PDT 2011
changeset f07124ad3c53 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=f07124ad3c53
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Nov 03 14:22:31 2011 +0100
2011-11-03 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/framework/CommonShapesRenderer.java:
Fixed method for rendering rounded rectangle.
* src/org/gfxtest/testsuites/ColorPaint.java: Added 20 tests
for rendering rounded rectangle using various color paint
methods.
diffstat:
ChangeLog | 8 +
src/org/gfxtest/framework/CommonShapesRenderer.java | 2 +-
src/org/gfxtest/testsuites/ColorPaint.java | 379 ++++++++++++++++++-
3 files changed, 365 insertions(+), 24 deletions(-)
diffs (444 lines):
diff -r a05c6f5b49bf -r f07124ad3c53 ChangeLog
--- a/ChangeLog Wed Nov 02 09:57:29 2011 +0100
+++ b/ChangeLog Thu Nov 03 14:22:31 2011 +0100
@@ -1,3 +1,11 @@
+2011-11-03 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/framework/CommonShapesRenderer.java:
+ Fixed method for rendering rounded rectangle.
+ * src/org/gfxtest/testsuites/ColorPaint.java:
+ Added 20 tests for rendering rounded rectangle using
+ various color paint methods.
+
2011-11-02 Pavel Tisnovsky <ptisnovs at redhat.com>
* Makefile: added new class to compile
diff -r a05c6f5b49bf -r f07124ad3c53 src/org/gfxtest/framework/CommonShapesRenderer.java
--- a/src/org/gfxtest/framework/CommonShapesRenderer.java Wed Nov 02 09:57:29 2011 +0100
+++ b/src/org/gfxtest/framework/CommonShapesRenderer.java Thu Nov 03 14:22:31 2011 +0100
@@ -269,7 +269,7 @@
int size = calculateRadius(image);
// draw the filled round round rectangle
- graphics.fillRoundRect(xc - size, yc - size, size << 1, size << 1, ROUND_RECT_RADIUS, ROUND_RECT_RADIUS);
+ graphics.drawRoundRect(xc - size, yc - size, size << 1, size << 1, ROUND_RECT_RADIUS, ROUND_RECT_RADIUS);
// draw crosses at interesting points of image
drawCrossesForBasicShapes(graphics, xc, yc, size);
diff -r a05c6f5b49bf -r f07124ad3c53 src/org/gfxtest/testsuites/ColorPaint.java
--- a/src/org/gfxtest/testsuites/ColorPaint.java Wed Nov 02 09:57:29 2011 +0100
+++ b/src/org/gfxtest/testsuites/ColorPaint.java Thu Nov 03 14:22:31 2011 +0100
@@ -49,7 +49,8 @@
import org.gfxtest.framework.annotations.*;
/**
- * This test renders filled shapes using simple ColorPaint.
+ * This test renders filled shapes using simple ColorPaint. Tested all following shapes:
+ * Circle, Arc, Rectangle, RoundedRectangle, Polygon and Path
*
* @author Pavel Tisnovsky
*/
@@ -1306,7 +1307,7 @@
// set stroke color
CommonRenderingStyles.setStrokeColor(graphics);
// draw the rectangle
- CommonShapesRenderer.drawRectangle(image, graphics);
+ CommonShapesRenderer.drawRoundedRectangle(image, graphics);
// test return value
return TestResult.PASSED;
}
@@ -1652,26 +1653,6 @@
}
/**
- * Test if filled rounded rectangle drawn by graphics.fillRoundRect() is
- * rendered correctly.
- *
- * @param image
- * image to which two dimensional shape is to be rendered
- * @param graphics
- * graphics context for image
- * @return test result status - PASSED, FAILED or ERROR
- */
- public TestResult testRoundedRectangleColorFill(TestImage image, Graphics2D graphics)
- {
- // set fill color
- CommonRenderingStyles.setFillColor(graphics);
- // draw the rounded rectangle
- CommonShapesRenderer.drawFilledRoundedRectangle(image, graphics);
- // test return value
- return TestResult.PASSED;
- }
-
- /**
* Test if polygon drawn by graphics.drawOval() is rendered correctly.
*
* @param image
@@ -2040,7 +2021,71 @@
* graphics context for image
* @return test result status - PASSED, FAILED or ERROR
*/
- public TestResult testClosedPathColorFill(TestImage image, Graphics2D graphics)
+ public TestResult testClosedPathBasicStrokeEmptyFill(TestImage image, Graphics2D graphics)
+ {
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics);
+ // draw the closed path
+ CommonShapesRenderer.drawClosedPath(image, graphics);
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathThickStrokeEmptyFill(TestImage image, Graphics2D graphics)
+ {
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics);
+ // set 10 pixels wide stroke
+ CommonRenderingStyles.setStrokeThickWidth(graphics);
+ // draw the closed path
+ CommonShapesRenderer.drawClosedPath(image, graphics);
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathExtraThickStrokeEmptyFill(TestImage image, Graphics2D graphics)
+ {
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics);
+ // set 30 pixels wide stroke
+ CommonRenderingStyles.setStrokeExtraThickWidth(graphics);
+ // draw the closed path
+ CommonShapesRenderer.drawClosedPath(image, graphics);
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathBasicStrokeColorFill(TestImage image, Graphics2D graphics)
{
// set fill color
CommonRenderingStyles.setFillColor(graphics);
@@ -2051,6 +2096,294 @@
}
/**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathThickStrokeColorFill(TestImage image, Graphics2D graphics)
+ {
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics);
+ // set 10 pixels wide stroke
+ CommonRenderingStyles.setStrokeThickWidth(graphics);
+ // set fill color
+ CommonRenderingStyles.setFillColor(graphics);
+ // draw the filled closed path
+ CommonShapesRenderer.drawFilledClosedPath(image, graphics);
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathExtraThickStrokeColorFill(TestImage image, Graphics2D graphics)
+ {
+ // set stroke color
+ CommonRenderingStyles.setStrokeColor(graphics);
+ // set 30 pixels wide stroke
+ CommonRenderingStyles.setStrokeExtraThickWidth(graphics);
+ // set fill color
+ CommonRenderingStyles.setFillColor(graphics);
+ // draw the filled closed path
+ CommonShapesRenderer.drawFilledClosedPath(image, graphics);
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - red at 0% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentRed0FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.red, 0);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - red at 25% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentRed25FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.red, 25);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - red at 50% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentRed50FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.red, 50);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - red at 75% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentRed75FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.red, 75);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - red at 100% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentRed100FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.red, 100);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - green at 0% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentGreen0FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.green, 0);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - green at 25% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentGreen25FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.green, 25);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - green at 50% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentGreen50FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.green, 50);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - green at 75% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentGreen75FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.green, 75);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - green at 100% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentGreen100FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.green, 100);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - blue at 0% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentBlue0FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.blue, 0);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - blue at 25% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentBlue25FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.blue, 25);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - blue at 50% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentBlue50FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.blue, 50);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - blue at 75% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentBlue75FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.blue, 75);
+ }
+
+ /**
+ * Test if closed path drawn by graphics.fill() is
+ * rendered correctly. More preciselly - test color paint using
+ * semi transparent color - blue at 100% of transparency.
+ *
+ * @param image
+ * image to which two dimensional shape is to be rendered
+ * @param graphics
+ * graphics context for image
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testClosedPathTransparentBlue100FillColor(TestImage image, Graphics2D graphics)
+ {
+ return renderTransparentClosedPath(image, graphics, Color.blue, 100);
+ }
+
+ /**
* Entry point to the test suite.
*
* @param args graphics test configuration
More information about the distro-pkg-dev
mailing list