/hg/gfx-test: * src/org/gfxtest/testsuites/PrintTestBasic.java:

ptisnovs at icedtea.classpath.org ptisnovs at icedtea.classpath.org
Tue Apr 24 04:45:49 PDT 2012


changeset 905b20725f80 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=905b20725f80
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Apr 24 13:48:25 2012 +0200

	* src/org/gfxtest/testsuites/PrintTestBasic.java:
	Added new printing tests to this test suite.


diffstat:

 ChangeLog                                      |   5 +
 src/org/gfxtest/testsuites/PrintTestBasic.java |  97 +++++++++++++++++++++++++-
 2 files changed, 100 insertions(+), 2 deletions(-)

diffs (138 lines):

diff -r f72558a932b2 -r 905b20725f80 ChangeLog
--- a/ChangeLog	Fri Apr 20 15:22:51 2012 +0200
+++ b/ChangeLog	Tue Apr 24 13:48:25 2012 +0200
@@ -1,3 +1,8 @@
+2012-04-24  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/org/gfxtest/testsuites/PrintTestBasic.java:
+	Added new printing tests to this test suite.
+
 2012-04-20  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/org/gfxtest/framework/PrintingTest.java:
diff -r f72558a932b2 -r 905b20725f80 src/org/gfxtest/testsuites/PrintTestBasic.java
--- a/src/org/gfxtest/testsuites/PrintTestBasic.java	Fri Apr 20 15:22:51 2012 +0200
+++ b/src/org/gfxtest/testsuites/PrintTestBasic.java	Tue Apr 24 13:48:25 2012 +0200
@@ -73,6 +73,9 @@
 public class PrintTestBasic extends GfxTest
 {
 
+    private static final int HOR_STEP = 10;
+    private static final int VER_STEP = 10;
+
     /**
      * Test basic behavior of method Graphics.drawLine().
      *
@@ -82,13 +85,33 @@
      *            graphics canvas
      * @return test result status - PASSED, FAILED or ERROR
      */
-    public TestResult testDrawLine(TestImage image, Graphics2D graphics)
+    public TestResult testDrawDiagonalLine1(TestImage image, Graphics2D graphics)
+    {
+        // set drawing color
+        graphics.setColor(Color.BLACK);
+
+        // draw one diagonal line
+        graphics.drawLine(0, 0, image.getWidth(), image.getHeight());
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawLine().
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawDiagonalLine2(TestImage image, Graphics2D graphics)
     {
         // set drawing color
         graphics.setColor(Color.BLACK);
 
         // draw two diagonals along the whole test image
-        graphics.drawLine(0, 0, image.getWidth(), image.getHeight());
         graphics.drawLine(0, image.getHeight(), image.getWidth(), 0);
 
         // test return value
@@ -96,6 +119,76 @@
     }
 
     /**
+     * Test basic behavior of method Graphics.drawLine().
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawHorizontalLines(TestImage image, Graphics2D graphics)
+    {
+        // set drawing color
+        graphics.setColor(Color.BLACK);
+
+        // image width and height
+        int width = image.getWidth();
+        int height = image.getHeight();
+
+        // horizontal coordinates of line endpoints
+        int x1 = 0;
+        int x2 = width;
+
+        // draw all lines onto a paper
+        for (int y = 0; y < height; y += VER_STEP)
+        {
+            graphics.drawLine(x1, y, x2, y);
+            // compute new horizontal coordinates of line endpoints
+            x1 = Math.min(width / 2 - 10, x1 + 5);
+            x2 = Math.max(width / 2 + 10, x2 - 5);
+        }
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
+     * Test basic behavior of method Graphics.drawLine().
+     *
+     * @param image
+     *            image to which line is to be drawn
+     * @param graphics2d
+     *            graphics canvas
+     * @return test result status - PASSED, FAILED or ERROR
+     */
+    public TestResult testDrawVerticalLines(TestImage image, Graphics2D graphics)
+    {
+        // set drawing color
+        graphics.setColor(Color.BLACK);
+
+        // image width and height
+        int width = image.getWidth();
+        int height = image.getHeight();
+
+        // vertical coordinates of line endpoints
+        int y1 = 0;
+        int y2 = height;
+
+        // draw all lines onto a paper
+        for (int x = 0; x < width; x += HOR_STEP)
+        {
+            graphics.drawLine(x, y1, x, y2);
+            // compute new vertical coordinates of line endpoints
+            y1 = Math.min(height / 2 - 10, y1 + 5);
+            y2 = Math.max(height / 2 + 10, y2 - 5);
+        }
+
+        // test return value
+        return TestResult.PASSED;
+    }
+
+    /**
      * Entry point to the test suite.
      *
      * @param args not used in this case



More information about the distro-pkg-dev mailing list