/hg/gfx-test: 2012-01-04 Pavel Tisnovsky <ptisnovs at redhat.com>
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Wed Jan 4 03:28:14 PST 2012
changeset 1eb14355e32c in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=1eb14355e32c
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Wed Jan 04 12:30:34 2012 +0100
2012-01-04 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/BitBltBasicTests.java:
Created new test suite - check for raster operation BitBlt.
* Makefile: updated
diffstat:
ChangeLog | 6 +
Makefile | 8 +-
src/org/gfxtest/testsuites/BitBltBasicTests.java | 145 +++++++++++++++++++++++
3 files changed, 156 insertions(+), 3 deletions(-)
diffs (194 lines):
diff -r 4a93bf078e59 -r 1eb14355e32c ChangeLog
--- a/ChangeLog Tue Jan 03 12:29:49 2012 +0100
+++ b/ChangeLog Wed Jan 04 12:30:34 2012 +0100
@@ -1,3 +1,9 @@
+2012-01-04 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/BitBltBasicTests.java:
+ Created new test suite - check for raster operation BitBlt.
+ * Makefile: updated
+
2012-01-03 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/ClippingPathByEllipseShape.java:
diff -r 4a93bf078e59 -r 1eb14355e32c Makefile
--- a/Makefile Tue Jan 03 12:29:49 2012 +0100
+++ b/Makefile Wed Jan 04 12:30:34 2012 +0100
@@ -106,6 +106,7 @@
$(CLASSES)/$(TESTSUITE_DIR)/AAEllipses.class \
$(CLASSES)/$(TESTSUITE_DIR)/AlphaComposite.class \
$(CLASSES)/$(TESTSUITE_DIR)/BlankImage.class \
+ $(CLASSES)/$(TESTSUITE_DIR)/BitBltBasicTests.class \
$(CLASSES)/$(TESTSUITE_DIR)/ColorPaint.class \
$(CLASSES)/$(TESTSUITE_DIR)/NormalArcs.class \
$(CLASSES)/$(TESTSUITE_DIR)/NormalLines.class \
@@ -167,6 +168,7 @@
$(RESULTS)/AAEllipses \
$(RESULTS)/AlphaComposite \
$(RESULTS)/BlankImage \
+ $(RESULTS)/BitBltBasicTests \
$(RESULTS)/ColorPaint \
$(RESULTS)/NormalArcs \
$(RESULTS)/NormalLines \
@@ -290,9 +292,9 @@
mkdir -p masks
# for output/NormalLines the internal macros are set to following:
-# $@ - results/NormalLines
-# $< - output/NormalLines
-# $* - NormalLines
+# $@ -results/NormalLines
+# $< -output/NormalLines
+# $* -NormalLines
$(RESULTS)/%: $(OUTPUT)/%
mkdir -p $@
java -cp gfxtest.jar org.gfxtest.ImageDiffer.Main -s1=$(SAMPLES)/$* -s2=$< -o=$@ --html --html-results --xml-results --diff-images --struct-diff-images
diff -r 4a93bf078e59 -r 1eb14355e32c src/org/gfxtest/testsuites/BitBltBasicTests.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/gfxtest/testsuites/BitBltBasicTests.java Wed Jan 04 12:30:34 2012 +0100
@@ -0,0 +1,145 @@
+/*
+ Java gfx-test framework
+
+ Copyright (C) 2010, 2011, 2012 Red Hat
+
+This file is part of IcedTea.
+
+IcedTea is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+IcedTea is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with IcedTea; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version.
+*/
+
+package org.gfxtest.testsuites;
+
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+
+
+import org.gfxtest.framework.GfxTest;
+import org.gfxtest.framework.TestImage;
+import org.gfxtest.framework.annotations.GraphicsPrimitive;
+import org.gfxtest.framework.annotations.GraphicsPrimitives;
+import org.gfxtest.framework.annotations.RenderStyle;
+import org.gfxtest.framework.annotations.RenderStyles;
+import org.gfxtest.framework.annotations.TestType;
+import org.gfxtest.framework.annotations.TestTypes;
+import org.gfxtest.framework.annotations.Transformation;
+import org.gfxtest.framework.annotations.Transformations;
+import org.gfxtest.framework.annotations.Zoom;
+import org.gfxtest.framework.TestResult;
+
+
+
+/**
+ * This test check the rendering of buffered images (so callet bit block
+ * transfers or Bit Blt) created by various constructors.
+ *
+ * @author Pavel Tisnovsky
+ */
+ at TestType(TestTypes.RENDER_TEST)
+ at GraphicsPrimitive(GraphicsPrimitives.COMMON_BITMAP)
+ at RenderStyle(RenderStyles.NORMAL_AA)
+ at Transformation(Transformations.NONE)
+ at Zoom(1)
+public class BitBltBasicTests extends GfxTest
+{
+ /**
+ * Width of tested buffered image.
+ */
+ private final static int DEFAULT_TEST_IMAGE_WIDTH = 256;
+
+ /**
+ * Height of tested buffered image.
+ */
+ private final static int DEFAULT_TEST_IMAGE_HEIGHT = 256;
+
+ /**
+ * Performs BitBlt operation
+ *
+ * @param destinationImage
+ * destination image for BitBlt graphics canvas
+ * @param sourceImage
+ * source image for BitBlt
+ * @return if the image has completely loaded and its pixels are no longer
+ * being changed, then returns true. Otherwise, returns false
+ */
+ private boolean BitBlt(TestImage destinationImage, Graphics2D graphics2d, BufferedImage sourceImage)
+ {
+ // compute top-left corner coordinates
+ final int x = (destinationImage.getWidth() - DEFAULT_TEST_IMAGE_WIDTH) >> 1;
+ final int y = (destinationImage.getHeight() - DEFAULT_TEST_IMAGE_HEIGHT) >> 1;
+ return graphics2d.drawImage(sourceImage, x, y, null);
+ }
+
+ /**
+ * Create buffered bitmap with given type.
+ *
+ * @param type
+ * type of the created image
+ * @return new buffered bitmap
+ */
+ private BufferedImage createBufferedBitmap(int type)
+ {
+ return new BufferedImage(DEFAULT_TEST_IMAGE_WIDTH, DEFAULT_TEST_IMAGE_HEIGHT, type);
+ }
+
+ /**
+ * Test basic BitBlt operation for empty buffered image with type TYPE_3BYTE_BGR.
+ *
+ * @param image
+ * image to which line is to be drawn
+ * @param graphics2d
+ * graphics canvas
+ * @return
+ */
+ public TestResult testBitBltEmptyBufferedImageType3ByteBGR(TestImage image, Graphics2D graphics2d)
+ {
+ BufferedImage bufferedImage = createBufferedBitmap(BufferedImage.TYPE_3BYTE_BGR);
+ if (bufferedImage == null)
+ {
+ return TestResult.FAILED;
+ }
+ return BitBlt(image, graphics2d, bufferedImage) ? TestResult.PASSED : TestResult.FAILED;
+ }
+
+ /**
+ * Entry point to the test suite.
+ *
+ * @param args not used in this case
+ */
+ public static void main(String[] args)
+ {
+ new BitBltBasicTests().runTestSuite(args);
+ }
+
+}
More information about the distro-pkg-dev
mailing list