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

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Oct 4 04:29:58 PDT 2011


changeset 66a66e2e3307 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=66a66e2e3307
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Oct 04 13:31:50 2011 +0200

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

	 * src/org/gfxtest/framework/CommonCAGOperations.java: Added
	new static helper methods used by various tests.
	    * src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java:
	Added 10 remaining tests (diagonal gradient paint) for a total of 80
	tests.


diffstat:

 ChangeLog                                                         |    8 +
 src/org/gfxtest/framework/CommonCAGOperations.java                |  280 ++++++++++
 src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java |  230 ++++++++
 3 files changed, 518 insertions(+), 0 deletions(-)

diffs (truncated from 578 to 500 lines):

diff -r 9d0574912917 -r 66a66e2e3307 ChangeLog
--- a/ChangeLog	Tue Oct 04 12:34:46 2011 +0200
+++ b/ChangeLog	Tue Oct 04 13:31:50 2011 +0200
@@ -1,3 +1,11 @@
+2011-10-04  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/framework/CommonCAGOperations.java:
+	Added new static helper methods used by various tests.
+	* src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java:
+	Added 10 remaining tests (diagonal gradient paint) for a total of 80
+	tests.
+
 2011-10-03  Xerxes RÃ¥nby  <xerxes at zafena.se>
 
 	* Makefile: fix filename typo of CAGOperationsOnCircleAndRectangle.java
diff -r 9d0574912917 -r 66a66e2e3307 src/org/gfxtest/framework/CommonCAGOperations.java
--- a/src/org/gfxtest/framework/CommonCAGOperations.java	Tue Oct 04 12:34:46 2011 +0200
+++ b/src/org/gfxtest/framework/CommonCAGOperations.java	Tue Oct 04 13:31:50 2011 +0200
@@ -69,6 +69,21 @@
     }
 
     /**
+     * Compute radius of circle from the position of its center point in an
+     * image size (width and height).
+     * 
+     * @param xc
+     *            x-coordinate of the center of the test image.
+     * @param y
+     *            y-coordinate of the center of the test image.
+     * @return radius of circle
+     */
+    private static int computeRadiusForTouchingCircle(int xc, int yc)
+    {
+        return (xc > yc ? yc : xc) >> 1;
+    }
+
+    /**
      * Compute size of the rectangle from the position of center point in an
      * image.
      * 
@@ -99,6 +114,34 @@
     }
 
     /**
+     * Compute radius of bigger circle from the position of center point in an image.
+     * 
+     * @param xc
+     *            x-coordinate of the center of the test image.
+     * @param y
+     *            y-coordinate of the center of the test image.
+     * @return radius of circle
+     */
+    private static int computeRadiusForBiggerCircle(int xc, int yc)
+    {
+        return ((xc > yc ? yc : xc) << 1) / 3;
+    }
+
+    /**
+     * Compute radius of smaller circle from the position of center point in an image.
+     * 
+     * @param xc
+     *            x-coordinate of the center of the test image.
+     * @param y
+     *            y-coordinate of the center of the test image.
+     * @return radius of circle
+     */
+    private static int computeRadiusForSmallerCircle(int xc, int yc)
+    {
+        return ((xc > yc ? yc : xc) << 1) / 4;
+    }
+
+    /**
      * Create circular area i.e. area consisting of just one circle.
      * 
      * @param xc
@@ -169,6 +212,42 @@
     }
 
     /**
+     * Create area composed of only one circle. This circle is placed on the
+     * left side of the image.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return newly created area containing one circle
+     */
+    private static  Area createFirstTouchingCircularArea(TestImage image)
+    {
+        int xc = image.getCenterX();
+        int yc = image.getCenterY();
+        int radius = computeRadiusForTouchingCircle(xc, yc);
+        // move circle to the left side of image
+        int x1 = xc - radius;
+        return createCircularArea(x1, yc, radius);
+    }
+
+    /**
+     * Create area composed of only one circle. This circle is placed on the
+     * right side of the image.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return newly created area containing one circle
+     */
+    private static Area createSecondTouchingCircularArea(TestImage image)
+    {
+        int xc = image.getCenterX();
+        int yc = image.getCenterY();
+        int radius = computeRadiusForTouchingCircle(xc, yc);
+        // move circle to the right side of image
+        int x2 = xc + radius;
+        return createCircularArea(x2, yc, radius);
+    }
+
+    /**
      * Create area composed of only one rectangle. This rectangle is placed on
      * the upper left side of the image.
      * 
@@ -269,6 +348,38 @@
     }
 
     /**
+     * Create area composed of only one circle. This circle is placed on the
+     * left side of the image.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return newly created area containing one circle
+     */
+    private static Area createBiggerConcentricCircularArea(TestImage image)
+    {
+        int xc = image.getCenterX();
+        int yc = image.getCenterY();
+        int radius = computeRadiusForBiggerCircle(xc, yc);
+        return createCircularArea(xc, yc, radius);
+    }
+
+    /**
+     * Create area composed of only one circle. This circle is placed on the
+     * right side of the image.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return newly created area containing one circle
+     */
+    private static Area createSmallerConcentricCircularArea(TestImage image)
+    {
+        int xc = image.getCenterX();
+        int yc = image.getCenterY();
+        int radius = computeRadiusForSmallerCircle(xc, yc);
+        return createCircularArea(xc, yc, radius);
+    }
+
+    /**
      * Create new area composed from two overlapping circles using union
      * operator.
      * 
@@ -602,4 +713,173 @@
         return area;
     }
 
+    /**
+     * Create new area composed from two concentric circles using union operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoConcentricCirclesUsingUnionOperator(TestImage image)
+    {
+        Area circle1Area = createBiggerConcentricCircularArea(image);
+        Area circle2Area = createSmallerConcentricCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.add(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two concentric circles using subtract operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoConcentricCirclesUsingSubtractOperator(TestImage image)
+    {
+        Area circle1Area = createBiggerConcentricCircularArea(image);
+        Area circle2Area = createSmallerConcentricCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.subtract(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two concentric circles using subtract operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoConcentricCirclesUsingInverseSubtractOperator(TestImage image)
+    {
+        Area circle1Area = createBiggerConcentricCircularArea(image);
+        Area circle2Area = createSmallerConcentricCircularArea(image);
+        Area area = new Area();
+        area.add(circle2Area);
+        area.subtract(circle1Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two concentric circles using intersect operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoConcentricCirclesUsingIntersectOperator(TestImage image)
+    {
+        Area circle1Area = createBiggerConcentricCircularArea(image);
+        Area circle2Area = createSmallerConcentricCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.intersect(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two concentric circles using XOR operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoConcentricCirclesUsingXorOperator(TestImage image)
+    {
+        Area circle1Area = createBiggerConcentricCircularArea(image);
+        Area circle2Area = createSmallerConcentricCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.exclusiveOr(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two touching circles using union operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoTouchingCirclesUsingUnionOperator(TestImage image)
+    {
+        Area circle1Area = createFirstTouchingCircularArea(image);
+        Area circle2Area = createSecondTouchingCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.add(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two touching circles using subtract operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoTouchingCirclesUsingSubtractOperator(TestImage image)
+    {
+        Area circle1Area = createFirstTouchingCircularArea(image);
+        Area circle2Area = createSecondTouchingCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.subtract(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two touching circles using subtract operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoTouchingCirclesUsingInverseSubtractOperator(TestImage image)
+    {
+        Area circle1Area = createFirstTouchingCircularArea(image);
+        Area circle2Area = createSecondTouchingCircularArea(image);
+        Area area = new Area();
+        area.add(circle2Area);
+        area.subtract(circle1Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two touching circles using intersect operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoTouchingCirclesUsingIntersectOperator(TestImage image)
+    {
+        Area circle1Area = createFirstTouchingCircularArea(image);
+        Area circle2Area = createSecondTouchingCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.intersect(circle2Area);
+        return area;
+    }
+
+    /**
+     * Create new area composed from two touching circles using XOR operator.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @return new area composed of two circles
+     */
+    public static Area createAreaFromTwoTouchingCirclesUsingXorOperator(TestImage image)
+    {
+        Area circle1Area = createFirstTouchingCircularArea(image);
+        Area circle2Area = createSecondTouchingCircularArea(image);
+        Area area = new Area();
+        area.add(circle1Area);
+        area.exclusiveOr(circle2Area);
+        return area;
+    }
 }
diff -r 9d0574912917 -r 66a66e2e3307 src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java
--- a/src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java	Tue Oct 04 12:34:46 2011 +0200
+++ b/src/org/gfxtest/testsuites/CAGOperationsOnCircleAndRectangle.java	Tue Oct 04 13:31:50 2011 +0200
@@ -893,6 +893,121 @@
     /**
      * Checks the process of creating and rendering new geometric shape
      * constructed from circle and rectangle using union operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testBigCircleRectangleUnionDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using union operator
+        Area area = CommonCAGOperations.createAreaFromBiggerCircleAndRectangleUsingUnionOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from circle and rectangle using subtract operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testBigCircleRectangleSubtractDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using subtract operator
+        Area area = CommonCAGOperations.createAreaFromBiggerCircleAndRectangleUsingSubtractOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from circle and rectangle using inverse subtract operator.
+     * The shape is rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testBigCircleRectangleInverseSubtractDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using inverse subtract operator
+        Area area = CommonCAGOperations.createAreaFromBiggerCircleAndRectangleUsingInverseSubtractOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from circle and rectangle using intersect operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testBigCircleRectangleIntersectDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using intersect operator
+        Area area = CommonCAGOperations.createAreaFromBiggerCircleAndRectangleUsingIntersectOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from circle and rectangle using XOR operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testBigCircleRectangleXorDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using XOR operator
+        Area area = CommonCAGOperations.createAreaFromBiggerCircleAndRectangleUsingXorOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from circle and rectangle using union operator. The shape is
      * rendered using stroke.
      * 
      * @param image
@@ -1717,6 +1832,121 @@
     }
 
     /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from a circle inside a rectangle using union operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testSmallCircleInsideRectangleUnionDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using union operator
+        Area area = CommonCAGOperations.createAreaFromSmallerCircleInsideRectangleUsingUnionOperator(image);
+        // fill the area
+        graphics2d.fill(area);
+        // test result
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Checks the process of creating and rendering new geometric shape
+     * constructed from a circle inside a rectangle using subtract operator. The shape is
+     * rendered using diagonal gradient fill.
+     * 
+     * @param image
+     *            image to which area is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testSmallCircleInsideRectangleSubtractDiagonalGradientPaint(TestImage image, Graphics2D graphics2d)
+    {
+        // set diagonal gradient fill
+        CommonRenderingStyles.setDiagonalGradientFill(image, graphics2d);
+        // create area using subtract operator
+        Area area = CommonCAGOperations.createAreaFromSmallerCircleInsideRectangleUsingSubtractOperator(image);
+        // fill the area



More information about the distro-pkg-dev mailing list