/hg/gfx-test: Added 7 new tests to the test suite src/org/gfxtes...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Aug 15 09:33:21 PDT 2012
changeset edaf14867902 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=edaf14867902
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Aug 15 18:35:58 2012 +0200
Added 7 new tests to the test suite src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java | 276 ++++++++++
2 files changed, 281 insertions(+), 0 deletions(-)
diffs (312 lines):
diff -r 8956e7167390 -r edaf14867902 ChangeLog
--- a/ChangeLog Mon Aug 13 14:44:40 2012 +0200
+++ b/ChangeLog Wed Aug 15 18:35:58 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-14 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java:
+ Added 7 new tests to this test suite.
+
2012-08-13 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java:
diff -r 8956e7167390 -r edaf14867902 src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Mon Aug 13 14:44:40 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Wed Aug 15 18:35:58 2012 +0200
@@ -41,6 +41,7 @@
package org.gfxtest.testsuites;
import java.awt.BasicStroke;
+import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
@@ -221,6 +222,39 @@
/**
* Test basic behavior of method Graphics.draw(Path).
* Quadratic curves are rendered with default width and default end caps.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesColorScale(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // compute hue value
+ float hue = y1 * 1.0f / this.image.getHeight();
+ // set curve color
+ this.graphics.setColor(new Color(Color.HSBtoRGB(hue, 1.0f, 0.7f)));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with default width and default end caps.
* Color of all rendered curves are selected from a grayscale palette.
* All rendered cubic curves are represented by a Path object.
*
@@ -411,6 +445,248 @@
return TestResult.PASSED;
}
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to miter style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapButtJoinMiter(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to miter style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapRoundJoinMiter(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to miter style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapSquareJoinMiter(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_MITER));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_BUTT.
+ * Join style is set to round style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapButtJoinRound(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_ROUND.
+ * Join style is set to round style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapRoundJoinRound(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various width and end caps set to CAP_SQUARE.
+ * Join style is set to round style.
+ * Color of all rendered curves are selected from a grayscale palette.
+ * All rendered cubic curves are represented by a Path object.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidthCapSquareJoinRound(TestImage image, Graphics2D graphics)
+ {
+ drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
+ {
+ /**
+ * Stroke width.
+ */
+ float strokeWidth = 0.0f;
+
+ /**
+ * Callback function called before each quadratic curve is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int x3, int y3, int index)
+ {
+ // set stroke width
+ this.graphics.setStroke(new BasicStroke(this.strokeWidth, BasicStroke.CAP_SQUARE, BasicStroke.JOIN_ROUND));
+ // set new stroke width
+ this.strokeWidth = this.strokeWidth < MAX_STROKE_WIDTH ? this.strokeWidth + STROKE_WIDTH_DELTA : this.strokeWidth;
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
/**
* Entry point to the test suite.
*
More information about the distro-pkg-dev
mailing list