/hg/gfx-test: Added new tests - using HSB color scale in these t...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Aug 23 03:40:01 PDT 2012
changeset 97391bb37e9a in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=97391bb37e9a
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Aug 23 12:42:30 2012 +0200
Added new tests - using HSB color scale in these test suites:
src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java,
src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java,
src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java.
diffstat:
ChangeLog | 7 +
src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java | 4 +-
src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java | 103 ++++++++++
src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java | 4 +-
4 files changed, 114 insertions(+), 4 deletions(-)
diffs (190 lines):
diff -r e7900ffb0c6e -r 97391bb37e9a ChangeLog
--- a/ChangeLog Tue Aug 21 12:46:04 2012 +0200
+++ b/ChangeLog Thu Aug 23 12:42:30 2012 +0200
@@ -1,3 +1,10 @@
+2012-08-23 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java:
+ * src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java:
+ * src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java:
+ Added new tests - using HSB color scale in these test suites.
+
2012-08-21 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestPolygons.java:
diff -r e7900ffb0c6e -r 97391bb37e9a src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java Tue Aug 21 12:46:04 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java Thu Aug 23 12:42:30 2012 +0200
@@ -41,7 +41,6 @@
package org.gfxtest.testsuites;
import java.awt.BasicStroke;
-import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
@@ -50,6 +49,7 @@
import org.gfxtest.callbacks.CubicCurveDrawCallbacks;
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;
@@ -282,7 +282,7 @@
// 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)));
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
return;
}
});
diff -r e7900ffb0c6e -r 97391bb37e9a src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java Tue Aug 21 12:46:04 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java Thu Aug 23 12:42:30 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;
@@ -546,6 +547,108 @@
}
/**
+ * Test basic behavior of method Graphics.draw(Path). Horizontal lines are
+ * rendered with default width and default end caps.
+ * Color of all rendered lines are selected from a color palette.
+ * Lines 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 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));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path). Vertical lines are
+ * rendered with default width and default end caps.
+ * Color of all rendered lines are selected from a color palette.
+ * Lines 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 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));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.draw(Path).
+ * Diagonal lines are rendered with default width and default end caps.
+ * Color of all rendered lines are selected from a color palette.
+ * Lines 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 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 x, int index)
+ {
+ // compute hue value
+ float hue = x * 1.0f / this.image.getWidth();
+ // set line color
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
* Entry point to the test suite.
*
* @param args
diff -r e7900ffb0c6e -r 97391bb37e9a src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Tue Aug 21 12:46:04 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestQuadraticCurvesAsPaths.java Thu Aug 23 12:42:30 2012 +0200
@@ -41,7 +41,6 @@
package org.gfxtest.testsuites;
import java.awt.BasicStroke;
-import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.geom.Path2D;
@@ -50,6 +49,7 @@
import org.gfxtest.callbacks.QuadraticCurveDrawCallbacks;
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;
@@ -243,7 +243,7 @@
// 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)));
+ this.graphics.setColor(HSBPalette.createHsbColor(hue));
return;
}
});
More information about the distro-pkg-dev
mailing list