/hg/gfx-test: Added ten new tests to the test suite PrintTestRec...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Jul 9 02:59:06 PDT 2012
changeset 2484fe8c1d23 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=2484fe8c1d23
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Jul 09 12:01:38 2012 +0200
Added ten new tests to the test suite PrintTestRectangles.java.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestRectangles.java | 519 ++++++++++++++++++++
2 files changed, 524 insertions(+), 0 deletions(-)
diffs (truncated from 541 to 500 lines):
diff -r 87e3933a3fdf -r 2484fe8c1d23 ChangeLog
--- a/ChangeLog Wed Jul 04 14:38:07 2012 +0200
+++ b/ChangeLog Mon Jul 09 12:01:38 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-09 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestRectangles.java:
+ Added ten new tests.
+
2012-07-04 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestBitBlt.java:
diff -r 87e3933a3fdf -r 2484fe8c1d23 src/org/gfxtest/testsuites/PrintTestRectangles.java
--- a/src/org/gfxtest/testsuites/PrintTestRectangles.java Wed Jul 04 14:38:07 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestRectangles.java Mon Jul 09 12:01:38 2012 +0200
@@ -767,6 +767,525 @@
}
/**
+ * Test basic behavior of method Graphics.drawRect(). 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 testDrawRectanglesChangeWidthInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapButtJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapButtJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapButtJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapRoundJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapRoundJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapRoundJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapSquareJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapSquareJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(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.drawRect().
+ * 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 testDrawRectanglesChangeWidthCapSquareJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawRectangles(image, graphics2d, RECTANGLE_STEP * 3 / 2, new RectangleDrawCallbacks()
More information about the distro-pkg-dev
mailing list