/hg/gfx-test: Added ten new tests to the test suite src/org/gfxt...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Jul 26 03:15:54 PDT 2012
changeset c26a356ed48e in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=c26a356ed48e
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Jul 26 12:18:34 2012 +0200
Added ten new tests to the test suite src/org/gfxtest/testsuites/PrintTestPolylines.java
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestPolylines.java | 555 +++++++++++++++++++++
2 files changed, 560 insertions(+), 0 deletions(-)
diffs (truncated from 577 to 500 lines):
diff -r bcddbf10b1c3 -r c26a356ed48e ChangeLog
--- a/ChangeLog Mon Jul 23 10:48:30 2012 +0200
+++ b/ChangeLog Thu Jul 26 12:18:34 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-26 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestPolylines.java:
+ Added ten new tests to this test suite.
+
2012-07-23 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/framework/PrintTest.java:
diff -r bcddbf10b1c3 -r c26a356ed48e src/org/gfxtest/testsuites/PrintTestPolylines.java
--- a/src/org/gfxtest/testsuites/PrintTestPolylines.java Mon Jul 23 10:48:30 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestPolylines.java Thu Jul 26 12:18:34 2012 +0200
@@ -632,6 +632,561 @@
}
/**
+ * Test basic behavior of method Graphics.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesGrayScaleInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP, new PolylineDrawCallbacks()
+ {
+ /**
+ * Callback function called before each polyline is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // compute grayscale value
+ float gray = 1.0f - (y1 - BORDER) * 4.0f / this.image.getHeight();
+ // set polyline color
+ this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+ // compute grayscale value
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to bevel style and end caps is set to CAP_BUTT.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapButtJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to miter style and end caps is set to CAP_BUTT.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapButtJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to round style and end caps is set to CAP_BUTT.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapButtJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to bevel style and end caps is set to CAP_ROUND.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapRoundJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to miter style and end caps is set to CAP_ROUND.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapRoundJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to round style and end caps is set to CAP_ROUND.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapRoundJoinRoundInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to bevel style and end caps is set to CAP_SQUARE.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapSquareJoinBevelInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // decrease stroke width
+ 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.drawPolyline(). Polyline are
+ * rendered with default width and default end caps. Color of all rendered
+ * polylines are selected from a grayscale palette.
+ * Join style is set to miter style and end caps is set to CAP_SQUARE.
+ *
+ * @param image
+ * image to which polylines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesChangeWidthCapSquareJoinMiterInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolylines(image, graphics2d, POLYLINE_STEP * 4 / 3, new PolylineDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ private float strokeWidth = MAX_STROKE_WIDTH - 2;
+
+ /**
+ * Callback function called before each polyline 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();
+ }
More information about the distro-pkg-dev
mailing list