/hg/gfx-test: Added four new tests to the test suite src/org/gfx...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Fri Jul 27 02:37:34 PDT 2012
changeset df7b0d1fc991 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=df7b0d1fc991
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Fri Jul 27 11:40:11 2012 +0200
Added four new tests to the test suite src/org/gfxtest/testsuites/PrintTestPolygons.java
diffstat:
ChangeLog | 5 +
src/org/gfxtest/testsuites/PrintTestPolygons.java | 130 ++++++++++++++++++++++
2 files changed, 135 insertions(+), 0 deletions(-)
diffs (159 lines):
diff -r c26a356ed48e -r df7b0d1fc991 ChangeLog
--- a/ChangeLog Thu Jul 26 12:18:34 2012 +0200
+++ b/ChangeLog Fri Jul 27 11:40:11 2012 +0200
@@ -1,3 +1,8 @@
+2012-07-27 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/PrintTestPolygons.java:
+ Added four new tests to this test suite.
+
2012-07-26 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/PrintTestPolylines.java:
diff -r c26a356ed48e -r df7b0d1fc991 src/org/gfxtest/testsuites/PrintTestPolygons.java
--- a/src/org/gfxtest/testsuites/PrintTestPolygons.java Thu Jul 26 12:18:34 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestPolygons.java Fri Jul 27 11:40:11 2012 +0200
@@ -46,6 +46,8 @@
import org.gfxtest.callbacks.PolygonDrawCallbacks;
+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;
@@ -157,6 +159,134 @@
}
/**
+ * Test basic behavior of method Graphics.drawPolyhon(). Polygon are
+ * rendered with default width and default end caps. Color of all rendered
+ * polygons are selected from a palette.
+ *
+ * @param image
+ * image to which polygons are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesColorPalette(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+ {
+ /**
+ * Callback function called before each polygon is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set polygon color
+ this.graphics.setColor(ColorPalette.getColor(index));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawPolygon(). Polygon are
+ * rendered with default width and default end caps. Color of all rendered
+ * polygons are selected from a palette.
+ *
+ * @param image
+ * image to which polygons are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesColorPaletteInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+ {
+ /**
+ * Callback function called before each polygon is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // set polygon color
+ this.graphics.setColor(ColorPalette.getColor(MAX_COLOR_INDEX - index));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawPolygon(). Polygon are
+ * rendered with default width and default end caps. Color of all rendered
+ * polygons are selected from a grayscale palette.
+ *
+ * @param image
+ * image to which polygons are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesGrayscale(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+ {
+ /**
+ * Callback function called before each polygon is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // compute grayscale value
+ float gray = (y1 - BORDER) * 4.0f / this.image.getHeight();
+ // set polygon color
+ this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
+ * Test basic behavior of method Graphics.drawPolygon(). Polygon are
+ * rendered with default width and default end caps. Color of all rendered
+ * polygons are selected from a grayscale palette.
+ *
+ * @param image
+ * image to which polygons are to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ public TestResult testDrawPolylinesGrayscaleInv(TestImage image, Graphics2D graphics2d)
+ {
+ drawPolygons(image, graphics2d, POLYGON_STEP, new PolygonDrawCallbacks()
+ {
+ /**
+ * Callback function called before each polygon is rendered.
+ */
+ @Override
+ public void iterationCallBack(int x1, int y1, int x2, int y2, int index)
+ {
+ // compute grayscale value
+ float gray = 1.0f - (y1 - BORDER) * 4.0f / this.image.getHeight();
+ // set polygon color
+ this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+ return;
+ }
+ });
+
+ // test return value
+ return TestResult.PASSED;
+ }
+
+ /**
* Entry point to the test suite.
*
* @param args
More information about the distro-pkg-dev
mailing list