/hg/gfx-test: * src/org/gfxtest/testsuites/PrintTestArcs.java:
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Jun 14 05:56:00 PDT 2012
changeset 3604f4097f70 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=3604f4097f70
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Jun 14 14:58:22 2012 +0200
* src/org/gfxtest/testsuites/PrintTestArcs.java:
Added ten new tests to this test suite.
* src/org/gfxtest/testsuites/PrintTestCircles.java:
Improvement of JavaDoc.
diffstat:
ChangeLog | 7 +
src/org/gfxtest/testsuites/PrintTestArcs.java | 432 +++++++++++++++++++++++
src/org/gfxtest/testsuites/PrintTestCircles.java | 161 +++++++-
3 files changed, 573 insertions(+), 27 deletions(-)
diffs (truncated from 1102 to 500 lines):
diff -r aa4331288424 -r 3604f4097f70 ChangeLog
--- a/ChangeLog Wed Jun 13 12:08:08 2012 +0200
+++ b/ChangeLog Thu Jun 14 14:58:22 2012 +0200
@@ -1,3 +1,10 @@
+2012-06-14 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestArcs.java:
+ Added ten new tests to this test suite.
+ * src/org/gfxtest/testsuites/PrintTestCircles.java:
+ Improvement of JavaDoc.
+
2012-06-13 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/framework/PrintTest.java:
diff -r aa4331288424 -r 3604f4097f70 src/org/gfxtest/testsuites/PrintTestArcs.java
--- a/src/org/gfxtest/testsuites/PrintTestArcs.java Wed Jun 13 12:08:08 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestArcs.java Thu Jun 14 14:58:22 2012 +0200
@@ -204,6 +204,438 @@
/**
* Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapButtJoinBevel(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapRoundJoinBevel(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_BEVEL));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapSquareJoinBevel(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_BEVEL));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to miter style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapButtJoinMiter(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to miter style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapRoundJoinMiter(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to miter style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapSquareJoinMiter(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapButtJoinRound(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapRoundJoinRound(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
+ * Arcs are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to bevel style.
+ * Color of all rendered arcs are set to black.
+ *
+ * @param image
+ * image to which arcs are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawArcChangeWidthCapSquareJoinRound(TestImage image, Graphics2D graphics2d)
+ {
+ drawArcs(image, graphics2d, ARC_RADIUS_STEP * 3 / 2, new CommonArcDrawCallbacks()
+ {
+ /**
+ * Stroke width which is changed in each iteration.
+ */
+ private float strokeWidth = MIN_STROKE_WIDTH;
+
+ /**
+ * Callback function called before each arc is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
+ {
+ // set stroke width and style
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
+ // change stroke width for the next iteration
+ changeStrokeWidth();
+ return;
+ }
+
+ /**
+ * Changes stroke width.
+ */
+ private void changeStrokeWidth()
+ {
+ // increase stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawOval().
* Arcs are rendered with various width and default end caps.
* Color of all rendered arcs are set to black.
*
diff -r aa4331288424 -r 3604f4097f70 src/org/gfxtest/testsuites/PrintTestCircles.java
--- a/src/org/gfxtest/testsuites/PrintTestCircles.java Wed Jun 13 12:08:08 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestCircles.java Thu Jun 14 14:58:22 2012 +0200
@@ -76,10 +76,6 @@
public class PrintTestCircles extends PrintTest
{
- private static final float MIN_STROKE_WIDTH = 0.0f;
- private static final float WIDTH_DELTA = 0.5f;
- protected static final int MAX_COLOR_INDEX = 1000;
-
/**
* Method which renders set of circles using various colors and
* stroke styles. For each circle, the callback function/method is called to
@@ -146,7 +142,7 @@
@Override
public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
{
- // nothing need to be changed
+ // nothing needs to be changed or set
return;
}
});
@@ -175,7 +171,7 @@
@Override
public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
{
- // set circle color
+ // set new circle color to index
this.graphics.setColor(ColorPalette.getColor(index));
return;
}
@@ -205,7 +201,7 @@
@Override
public void iterationCallBack(int x, int y, int radius, int maxRadius, int index)
{
- // set circle color
+ // set new circle color according to index
this.graphics.setColor(ColorPalette.getColor(MAX_COLOR_INDEX - index));
return;
}
@@ -237,6 +233,11 @@
{
// compute grayscale value
More information about the distro-pkg-dev
mailing list