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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Thu Oct 20 05:43:07 PDT 2011


changeset 2b8a0c754127 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=2b8a0c754127
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Oct 20 14:44:59 2011 +0200

	2011-10-20 Pavel Tisnovsky <ptisnovs at redhat.com>

	 * src/org/gfxtest/framework/CommonShapesRenderer.java:
	Helper method for drawing empty polygon.
		* src/org/gfxtest/testsuites/ColorPaint.java: Added 21 new
	rendering tests (filled polygon rendering).


diffstat:

 ChangeLog                                           |    7 +
 src/org/gfxtest/framework/CommonShapesRenderer.java |   28 +
 src/org/gfxtest/testsuites/ColorPaint.java          |  347 +++++++++++++++++++-
 3 files changed, 378 insertions(+), 4 deletions(-)

diffs (423 lines):

diff -r 9704d28cde8d -r 2b8a0c754127 ChangeLog
--- a/ChangeLog	Thu Oct 13 15:09:11 2011 +0200
+++ b/ChangeLog	Thu Oct 20 14:44:59 2011 +0200
@@ -1,3 +1,10 @@
+2011-10-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonShapesRenderer.java:
+	Helper method for drawing empty polygon.
+	* src/org/gfxtest/testsuites/ColorPaint.java:
+	Added 21 new rendering tests (filled polygon rendering).
+
 2011-10-13  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/CommonShapesRenderer.java:
diff -r 9704d28cde8d -r 2b8a0c754127 src/org/gfxtest/framework/CommonShapesRenderer.java
--- a/src/org/gfxtest/framework/CommonShapesRenderer.java	Thu Oct 13 15:09:11 2011 +0200
+++ b/src/org/gfxtest/framework/CommonShapesRenderer.java	Thu Oct 20 14:44:59 2011 +0200
@@ -227,6 +227,34 @@
     }
 
     /**
+     * Draw polygon onto the graphics canvas.
+     * 
+     * @param image
+     *            image to which two dimensional shape is to be rendered
+     * @param graphics
+     *            graphics context for image
+     */
+    public static void drawPolygon(TestImage image, Graphics2D graphics)
+    {
+        // calculate image size
+        int w = image.getWidth();
+        int h = image.getHeight();
+
+        // polygon vertexes
+        int xPoints[] = new int[] { GfxTest.OFFSET, w >> 1, w >> 1, w - GfxTest.OFFSET };
+        int yPoints[] = new int[] { h >> 1, GfxTest.OFFSET, h - GfxTest.OFFSET, h >> 1 };
+
+        // draw the polygon
+        graphics.drawPolygon(xPoints, yPoints, xPoints.length);
+
+        // draw crosses at interesting points of image
+        drawCross(graphics, GfxTest.OFFSET, h >> 1, GfxTest.CROSS_SIZE);
+        drawCross(graphics, w >> 1, GfxTest.OFFSET, GfxTest.CROSS_SIZE);
+        drawCross(graphics, w >> 1, h - GfxTest.OFFSET, GfxTest.CROSS_SIZE);
+        drawCross(graphics, w - GfxTest.OFFSET, h >> 1, GfxTest.CROSS_SIZE);
+    }
+
+    /**
      * Draw filled circle onto the graphics canvas.
      * 
      * @param image
diff -r 9704d28cde8d -r 2b8a0c754127 src/org/gfxtest/testsuites/ColorPaint.java
--- a/src/org/gfxtest/testsuites/ColorPaint.java	Thu Oct 13 15:09:11 2011 +0200
+++ b/src/org/gfxtest/testsuites/ColorPaint.java	Thu Oct 20 14:44:59 2011 +0200
@@ -1672,17 +1672,81 @@
     }
 
     /**
-     * Test if filled polygon drawn by graphics.fillPolygon() is
-     * rendered correctly.
-     *
+     * Test if polygon drawn by graphics.drawOval() 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 testPolygonColorFill(TestImage image, Graphics2D graphics)
+    public TestResult testPolygonBasicStrokeEmptyFill(TestImage image, Graphics2D graphics)
     {
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics);
+        // draw the polygon
+        CommonShapesRenderer.drawPolygon(image, graphics);
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test if polygon drawn by graphics.drawOval() is rendered correctly.
+     * Stroke of the polygon is 10 pixels wide.
+     * 
+     * @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 testPolygonThickStrokeEmptyFill(TestImage image, Graphics2D graphics)
+    {
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics);
+        // set 10 pixels wide stroke
+        CommonRenderingStyles.setStrokeThickWidth(graphics);
+        // draw the polygon
+        CommonShapesRenderer.drawPolygon(image, graphics);
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test if polygon drawn by graphics.drawOval() is rendered correctly.
+     * Stroke of the polygon is 30 pixels wide.
+     * 
+     * @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 testPolygonExtraThickStrokeEmptyFill(TestImage image, Graphics2D graphics)
+    {
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics);
+        // set 30 pixels wide stroke
+        CommonRenderingStyles.setStrokeExtraThickWidth(graphics);
+        // draw the polygon
+        CommonShapesRenderer.drawPolygon(image, graphics);
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test if filled polygon drawn by graphics.fillOval() 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 testPolygonBasicStrokeColorFill(TestImage image, Graphics2D graphics)
+    {
+        // set stroke color
+        CommonRenderingStyles.setStrokeColor(graphics);
         // set fill color
         CommonRenderingStyles.setFillColor(graphics);
         // draw the filled polygon
@@ -1692,6 +1756,281 @@
     }
 
     /**
+     * Test if filled polygon drawn by graphics.fillOval() is rendered correctly.
+     * Stroke of the polygon is 10 pixels wide (but it cannot affect the draw
+     * process).
+     * 
+     * @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 testPolygonThickStrokeColorFill(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 polygon
+        CommonShapesRenderer.drawFilledPolygon(image, graphics);
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test if filled polygon drawn by graphics.fillOval() is rendered correctly.
+     * Stroke of the polygon is 30 pixels wide (but it cannot affect the draw
+     * process).
+     * 
+     * @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 testPolygonExtraThickStrokeColorFill(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 polygon
+        CommonShapesRenderer.drawFilledPolygon(image, graphics);
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * 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 testPolygonTransparentRed0FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.red, 0);
+    }
+
+    /**
+     * 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 testPolygonTransparentRed25FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.red, 25);
+    }
+
+    /**
+     * 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 testPolygonTransparentRed50FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.red, 50);
+    }
+
+    /**
+     * 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 testPolygonTransparentRed75FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.red, 75);
+    }
+
+    /**
+     * 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 testPolygonTransparentRed100FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.red, 100);
+    }
+
+    /**
+     * 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 testPolygonTransparentGreen0FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.green, 0);
+    }
+
+    /**
+     * 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 testPolygonTransparentGreen25FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.green, 25);
+    }
+
+    /**
+     * 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 testPolygonTransparentGreen50FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.green, 50);
+    }
+
+    /**
+     * 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 testPolygonTransparentGreen75FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.green, 75);
+    }
+
+    /**
+     * 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 testPolygonTransparentGreen100FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.green, 100);
+    }
+
+    /**
+     * 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 testPolygonTransparentBlue0FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.blue, 0);
+    }
+
+    /**
+     * 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 testPolygonTransparentBlue25FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.blue, 25);
+    }
+
+    /**
+     * 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 testPolygonTransparentBlue50FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.blue, 50);
+    }
+
+    /**
+     * 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 testPolygonTransparentBlue75FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.blue, 75);
+    }
+
+    /**
+     * 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 testPolygonTransparentBlue100FillColor(TestImage image, Graphics2D graphics)
+    {
+        return renderTransparentPolygon(image, graphics, Color.blue, 100);
+    }
+
+    /**
      * Test if path polygon drawn by graphics.fill() is
      * rendered correctly.
      *



More information about the distro-pkg-dev mailing list