/hg/gfx-test: New tests added to the test suite PrintTestLinesAs...

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Mon Aug 13 05:42:01 PDT 2012


changeset 8956e7167390 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=8956e7167390
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Mon Aug 13 14:44:40 2012 +0200

	New tests added to the test suite PrintTestLinesAsPaths.java.


diffstat:

 ChangeLog                                             |    5 +
 src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java |  202 +++++++++++++++++-
 2 files changed, 206 insertions(+), 1 deletions(-)

diffs (231 lines):

diff -r 7d969e53aa12 -r 8956e7167390 ChangeLog
--- a/ChangeLog	Fri Aug 10 15:01:19 2012 +0200
+++ b/ChangeLog	Mon Aug 13 14:44:40 2012 +0200
@@ -1,3 +1,8 @@
+2012-08-13  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java:
+	New tests.
+
 2012-08-10  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/testsuites/PrintTestCubicCurvesAsPaths.java:
diff -r 7d969e53aa12 -r 8956e7167390 src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java
--- a/src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java	Fri Aug 10 15:01:19 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestLinesAsPaths.java	Mon Aug 13 14:44:40 2012 +0200
@@ -48,6 +48,8 @@
 import org.gfxtest.callbacks.DiagonalLineDrawCallbacks;
 import org.gfxtest.callbacks.HorizontalLineDrawCallbacks;
 import org.gfxtest.callbacks.VerticalLineDrawCallbacks;
+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;
@@ -344,7 +346,205 @@
         // test return value
         return TestResult.PASSED;
     }
-    
+
+    /**
+     * 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 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 testDrawHorizontalLinesColorPalette(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)
+            {
+                // set line color
+                this.graphics.setColor(ColorPalette.getColor(index));
+                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 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 testDrawVerticalLinesColorPalette(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)
+            {
+                // set line color
+                this.graphics.setColor(ColorPalette.getColor(index));
+                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 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 testDrawDiagonalLinesColorPalette(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)
+            {
+                // set line color
+                this.graphics.setColor(ColorPalette.getColor(index));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * 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 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 testDrawHorizontalLinesGrayScale(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 grayscale value
+                float gray = y * 1.0f / this.image.getHeight();
+                // set line color
+                this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+                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 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 testDrawVerticalLinesGrayScale(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 grayscale value
+                float gray = x * 1.0f / this.image.getWidth();
+                // set line color
+                this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+                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 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 testDrawDiagonalLinesGrayScale(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 grayscale value
+                float gray = x * 1.0f / this.image.getWidth();
+                // set line color
+                this.graphics.setColor(GrayscalePalette.createGrayscaleColor(gray));
+                return;
+            }
+        });
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
     /**
      * Entry point to the test suite.
      * 



More information about the distro-pkg-dev mailing list