/hg/gfx-test: Added six new tests to the test suite PrintTestQua...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Aug 9 02:43:03 PDT 2012
changeset e255b4abb8c4 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=e255b4abb8c4
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Aug 09 11:45:40 2012 +0200
Added six new tests to the test suite PrintTestQuadraticCurvesAsPaths.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java | 230 +++++++++-
2 files changed, 234 insertions(+), 1 deletions(-)
diffs (272 lines):
diff -r 8d8b962d5731 -r e255b4abb8c4 ChangeLog
--- a/ChangeLog Wed Aug 08 11:59:40 2012 +0200
+++ b/ChangeLog Thu Aug 09 11:45:40 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-09 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java:
+ Added six new tests to the test suite PrintTestQuadraticCurvesAsPaths.
+
2012-08-08 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestPaths.java:
diff -r 8d8b962d5731 -r e255b4abb8c4 src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Wed Aug 08 11:59:40 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Thu Aug 09 11:45:40 2012 +0200
@@ -40,12 +40,15 @@
package org.gfxtest.testsuites;
+import java.awt.BasicStroke;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
import org.gfxtest.callbacks.QudraticCurveDrawCallbacks;
+import org.gfxtest.framework.ColorPalette;
+import org.gfxtest.framework.GrayscalePalette;
import org.gfxtest.framework.PrintTest;
import org.gfxtest.framework.TestImage;
import org.gfxtest.framework.TestResult;
@@ -170,7 +173,7 @@
drawQuadraticCurve(image, graphics, QUADRATIC_CURVE_STEP, new QudraticCurveDrawCallbacks()
{
/**
- * Callback function called before each cubic curve is rendered.
+ * 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)
@@ -184,6 +187,231 @@
}
/**
+ * 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 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 testDrawQuadraticCurvesColorPalette(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)
+ {
+ // set curve color
+ this.graphics.setColor(ColorPalette.getColor(index));
+ 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.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesGrayScale(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 grayscale value
+ float gray = y1 * 1.0f / this.image.getHeight();
+ // set curve color
+ this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Quadratic curves are rendered with various 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.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawQuadraticCurvesChangeWidth(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));
+ // 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 bevel 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 testDrawQuadraticCurvesChangeWidthCapButtJoinBevel(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_BEVEL));
+ // 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 bevel 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 testDrawQuadraticCurvesChangeWidthCapRoundJoinBevel(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_BEVEL));
+ // 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 bevel 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 testDrawQuadraticCurvesChangeWidthCapSquareJoinBevel(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_BEVEL));
+ // 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.
*
* @param args
More information about the distro-pkg-dev
mailing list