/hg/gfx-test: Added three new tests to the test suite
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Mon Aug 27 02:36:46 PDT 2012
changeset 1c6da3a3b4fc in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=1c6da3a3b4fc
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Aug 27 11:39:20 2012 +0200
Added three new tests to the test suite
src/org/gfxtest/testsuites/PrintTestLines.java.
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestLines.java | 106 +++++++++++++++++++++++++
2 files changed, 111 insertions(+), 0 deletions(-)
diffs (149 lines):
diff -r 97391bb37e9a -r 1c6da3a3b4fc ChangeLog
--- a/ChangeLog Thu Aug 23 12:42:30 2012 +0200
+++ b/ChangeLog Mon Aug 27 11:39:20 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-27 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestLines.java:
+ Added three new tests to this test suite.
+
2012-08-23 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java:
diff -r 97391bb37e9a -r 1c6da3a3b4fc src/org/gfxtest/testsuites/PrintTestLines.java
--- a/src/org/gfxtest/testsuites/PrintTestLines.java Thu Aug 23 12:42:30 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestLines.java Mon Aug 27 11:39:20 2012 +0200
@@ -50,6 +50,7 @@
import org.gfxtest.callbacks.VerticalLineDrawCallbacks;
import org.gfxtest.framework.ColorPalette;
import org.gfxtest.framework.GrayscalePalette;
+import org.gfxtest.framework.HSBPalette;
import org.gfxtest.framework.PrintTest;
import org.gfxtest.framework.TestImage;
import org.gfxtest.framework.TestResult;
@@ -293,6 +294,38 @@
/**
* Test basic behavior of method Graphics.drawLine().
* Horizontal lines are rendered with default width and default end caps.
+ * Lines color are selected from a color palette.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawHorizontalLinesColorScale(TestImage image, Graphics2D graphics)
+ {
+ drawHorizontalLines(image, graphics, VERTICAL_STEP, new HorizontalLineDrawCallbacks()
+ {
+ /**
+ * Callback function called before each line is rendered.
+ */
+ @Override
+ public void iterationCallBack(int y, int index)
+ {
+ // compute hue value
+ float hue = y * 1.0f / this.image.getHeight();
+ // set line color
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawLine().
+ * Horizontal lines are rendered with default width and default end caps.
* Lines color are selected from a grayscale palette.
*
* @param image
@@ -764,6 +797,38 @@
/**
* Test basic behavior of method Graphics.drawLine().
* Vertical lines are rendered with default width and default end caps.
+ * Lines color are selected from a color palette.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawVerticalLinesColorScale(TestImage image, Graphics2D graphics)
+ {
+ drawVerticalLines(image, graphics, HORIZONTAL_STEP, new VerticalLineDrawCallbacks()
+ {
+ /**
+ * Callback function called before each line is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x, int index)
+ {
+ // compute hue value
+ float hue = x * 1.0f / this.image.getWidth();
+ // set line color
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawLine().
+ * Vertical lines are rendered with default width and default end caps.
* Lines color are selected from a grayscale palette.
*
* @param image
@@ -1235,6 +1300,47 @@
/**
* Test basic behavior of method Graphics.drawLine().
* Diagonal lines are rendered with default width and default end caps.
+ * Lines color are selected from a color palette.
+ *
+ * @param image
+ * image to which lines are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawDiagonalLinesColorScale(TestImage image, Graphics2D graphics)
+ {
+ drawDiagonalLines(image, graphics, DIAGONAL_STEP, new DiagonalLineDrawCallbacks()
+ {
+ /**
+ * Callback function called before each line is rendered.
+ */
+ @Override
+ public void iterationCallBack(int length, int index)
+ {
+ // compute hue value
+ float hue = length * 1.0f / (this.image.getWidth() + this.image.getHeight());
+ // make sure that the hue value is in range 0.0f .. 1.0f
+ if (hue < 0.0f)
+ {
+ hue = 0.0f;
+ }
+ if (hue > 1.0f)
+ {
+ hue = 1.0f;
+ }
+ // set line color
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawLine().
+ * Diagonal lines are rendered with default width and default end caps.
* Lines color are selected from a grayscale palette.
*
* @param image
More information about the distro-pkg-dev
mailing list