/hg/gfx-test: Added new test src/org/gfxtest/testsuites/BitBltUs...
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Thu Dec 6 01:55:46 PST 2012
changeset 33be8ac9a2d3 in /hg/gfx-test
details: http://icedtea.classpath.org/hg/gfx-test?cmd=changeset;node=33be8ac9a2d3
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Thu Dec 06 10:58:47 2012 +0100
Added new test src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java.
Added new class to compile and new test to run into Makefile.
diffstat:
ChangeLog | 7 +
Makefile | 3 +
src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java | 128 ++++++++++++++++
3 files changed, 138 insertions(+), 0 deletions(-)
diffs (173 lines):
diff -r 7dfa0fae6a86 -r 33be8ac9a2d3 ChangeLog
--- a/ChangeLog Wed Dec 05 10:31:21 2012 +0100
+++ b/ChangeLog Thu Dec 06 10:58:47 2012 +0100
@@ -1,3 +1,10 @@
+2012-12-06 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java:
+ Added new test.
+ * Makefile:
+ Added new class to compile and new test to run.
+
2012-12-05 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/org/gfxtest/testsuites/BitBltUsingBgColor.java:
diff -r 7dfa0fae6a86 -r 33be8ac9a2d3 Makefile
--- a/Makefile Wed Dec 05 10:31:21 2012 +0100
+++ b/Makefile Thu Dec 06 10:58:47 2012 +0100
@@ -146,6 +146,7 @@
$(CLASSES)/$(TESTSUITE_DIR)/BitBltRotateImage.class \
$(CLASSES)/$(TESTSUITE_DIR)/BitBltScaleImage.class \
$(CLASSES)/$(TESTSUITE_DIR)/BitBltUsingBgColor.class \
+ $(CLASSES)/$(TESTSUITE_DIR)/BitBltUsingBgColorAlpha.class \
$(CLASSES)/$(TESTSUITE_DIR)/ColorPaint.class \
$(CLASSES)/$(TESTSUITE_DIR)/NormalArcs.class \
$(CLASSES)/$(TESTSUITE_DIR)/NormalLines.class \
@@ -225,6 +226,7 @@
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestBitBltRotateImage.class \
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestBitBltScaleImage.class \
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestBitBltUsingBgColor.class \
+ $(CLASSES)/$(TESTSUITE_DIR)/PrintTestBitBltUsingBgColorAlpha.class \
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestCircles.class \
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestEllipses.class \
$(CLASSES)/$(TESTSUITE_DIR)/PrintTestDrawText.class \
@@ -244,6 +246,7 @@
$(RESULTS)/BitBltRotateImage \
$(RESULTS)/BitBltScaleImage \
$(RESULTS)/BitBltUsingBgColor \
+ $(RESULTS)/BitBltUsingBgColorAlpha \
$(RESULTS)/ColorPaint \
$(RESULTS)/NormalArcs \
$(RESULTS)/NormalLines \
diff -r 7dfa0fae6a86 -r 33be8ac9a2d3 src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/gfxtest/testsuites/BitBltUsingBgColorAlpha.java Thu Dec 06 10:58:47 2012 +0100
@@ -0,0 +1,128 @@
+/*
+ Java gfx-test framework
+
+ Copyright (C) 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.Color;
+import java.awt.Graphics2D;
+import java.awt.image.BufferedImage;
+
+
+
+import org.gfxtest.framework.CommonBitmapOperations;
+import org.gfxtest.framework.GfxTest;
+import org.gfxtest.framework.TestImage;
+import org.gfxtest.framework.TestResult;
+import org.gfxtest.framework.annotations.BitBltOperation;
+import org.gfxtest.framework.annotations.BitBltOperations;
+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;
+
+
+
+/**
+ * This test check the rendering of buffered images (so called bit block
+ * transfers or Bit Blt) created by various constructors. Such images are
+ * rendered with explicitly set background color with alpha channel which should
+ * affect transparent or semi-transparent images.
+ *
+ * @author Pavel Tisnovsky
+ */
+ at TestType(TestTypes.RENDER_TEST)
+ at GraphicsPrimitive(GraphicsPrimitives.COMMON_BITMAP)
+ at RenderStyle(RenderStyles.NORMAL)
+ at BitBltOperation(BitBltOperations.BITBLT)
+ at Transformation(Transformations.NONE)
+ at Zoom(1)
+public class BitBltUsingBgColorAlpha extends GfxTest
+{
+ /**
+ * Test basic BitBlt operation for empty buffered image with type TYPE_3BYTE_BGR
+ *
+ * @param image
+ * image to used as a destination for BitBlt-type operations
+ * @param graphics2d
+ * graphics canvas
+ * @param backgroundColor
+ * background color
+ * @param alpha
+ * alpha value for background
+ * @return test result status - PASSED, FAILED or ERROR
+ */
+ private TestResult doBitBltEmptyBufferedImageType3ByteRGB(TestImage image, Graphics2D graphics2d,
+ Color backgroundColor, float alpha)
+ {
+ Color newColor = calculateTransparentColor(backgroundColor, alpha);
+ return CommonBitmapOperations.doBitBltTestWithEmptyImage(image, graphics2d, BufferedImage.TYPE_3BYTE_BGR, newColor);
+ }
+
+ /**
+ * Calculate color with given alpha value.
+ *
+ * @param backgroundColor
+ * background color
+ * @param alpha
+ * alpha value for background
+ */
+ private Color calculateTransparentColor(Color backgroundColor, float alpha)
+ {
+ final float red = backgroundColor.getRed();
+ final float green = backgroundColor.getGreen();
+ final float blue = backgroundColor.getBlue();
+ return new Color(red, green, blue, alpha);
+ }
+
+ /**
+ * Entry point to the test suite.
+ *
+ * @param args not used in this case
+ */
+ public static void main(String[] args)
+ {
+ new BitBltUsingBgColorAlpha().runTestSuite(args);
+ }
+}
More information about the distro-pkg-dev
mailing list