/hg/gfx-test: Added ten new tests to the test suite PrintTestRou...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Jul 10 02:42:08 PDT 2012
changeset bdb992726715 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=bdb992726715
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jul 10 11:44:43 2012 +0200
Added ten new tests to the test suite PrintTestRoundRectangles.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestRoundRectangles.java | 519 +++++++++++++++
2 files changed, 524 insertions(+), 0 deletions(-)
diffs (truncated from 541 to 500 lines):
diff -r 2484fe8c1d23 -r bdb992726715 ChangeLog
--- a/ChangeLog Mon Jul 09 12:01:38 2012 +0200
+++ b/ChangeLog Tue Jul 10 11:44:43 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-10 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestRoundRectangles.java:
+ Added ten new tests.
+
2012-07-09 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestRectangles.java:
diff -r 2484fe8c1d23 -r bdb992726715 src/org/gfxtest/testsuites/PrintTestRoundRectangles.java
--- a/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java Mon Jul 09 12:01:38 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestRoundRectangles.java Tue Jul 10 11:44:43 2012 +0200
@@ -774,6 +774,525 @@
}
/**
+ * Test basic behavior of method Graphics.drawRoundRect(). Round rectangles are
+ * rendered with various width and default end caps. Color of all rendered
+ * rectangles are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to bevel style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to miter style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to round style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapButtJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to bevel style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to miter style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to round style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapRoundJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to bevel style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to miter style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each rectangle is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
+ // and change it for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ this.strokeWidth -= STROKE_WIDTH_DELTA;
+ // stroke width should not be less than zero
+ if (this.strokeWidth < MIN_STROKE_WIDTH)
+ {
+ this.strokeWidth = MIN_STROKE_WIDTH;
+ }
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawRoundRect().
+ * Round rectangles are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to round style.
+ * Color of all rendered lines are set to black.
+ *
+ * @param image
+ * image to which circles are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawRoundRectanglesChangeWidthCapSquareJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRoundRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
More information about the distro-pkg-dev
mailing list