Reviewer needed - new regression test which checks the bug #6733501

Jiri Vanek jvanek at redhat.com
Wed Jun 22 00:55:50 PDT 2011


On 06/21/2011 02:58 PM, Pavel Tisnovsky wrote:
> Hi all,
>
> is it possible to add a regression test which checks the bug #6733501
> into IcedTea6 HEAD? Changeset fixing bug #6733501 is already included in
> OpenJDK6 but this test is missing (it's used only in OpenJDK7), would be
> great to have it in IcedTea6 too ;-)

Hmmm.. The description of bug is really rich ..:-/

Since this is just backport from 7, and it is testing color profiles, and it is doing it right and applying is without problems (tested) then you are free to commit.
>
> ChangeLog entry:
>
> 2011-06-21  Pavel Tisnovsky<ptisnovs at redhat.com>
>
>          * Makefile.am: Added new patch.
>          * patches/jtreg-ReadWriteProfileTest.patch:
>          Added regression test missing from 6733501 changeset.
>
> Can anybody please review this change?
>
> Thank you in advance,
> Pavel
>
>
> hg_diff.patch
>
>
> diff -r be0c585e6d35 Makefile.am
> --- a/Makefile.am	Mon Jun 20 14:14:56 2011 -0400
> +++ b/Makefile.am	Tue Jun 21 14:39:24 2011 +0200
> @@ -359,7 +359,8 @@
>   	patches/jtreg-FileLoaderTest.patch \
>   	patches/jtreg-FileMap.patch \
>   	patches/jtreg-ChannelsWrite.patch \
> -	patches/jtreg-bug7036148-test.patch
> +	patches/jtreg-bug7036148-test.patch \
> +	patches/jtreg-ReadWriteProfileTest.patch
>
>   if WITH_ALT_HSBUILD
>   ICEDTEA_PATCHES += \
> diff -r be0c585e6d35 patches/jtreg-ReadWriteProfileTest.patch
> --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> +++ b/patches/jtreg-ReadWriteProfileTest.patch	Tue Jun 21 14:39:24 2011 +0200
> @@ -0,0 +1,124 @@
> +diff -r 9318628e8eee -r 467e4f25965c test/sun/java2d/cmm/ProfileOp/ReadWriteProfileTest.java
> +--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
> ++++ openjdk/jdk/test/sun/java2d/cmm/ProfileOp/ReadWriteProfileTest.java	Fri Mar 20 20:05:22 2009 +0300
> +@@ -0,0 +1,120 @@
> ++/*
> ++ * Copyright 2007-2008 Sun Microsystems, Inc.  All Rights Reserved.
> ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
> ++ *
> ++ * This code is free software; you can redistribute it and/or modify it
> ++ * under the terms of the GNU General Public License version 2 only, as
> ++ * published by the Free Software Foundation.
> ++ *
> ++ * This code 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
> ++ * version 2 for more details (a copy is included in the LICENSE file that
> ++ * accompanied this code).
> ++ *
> ++ * You should have received a copy of the GNU General Public License version
> ++ * 2 along with this work; if not, write to the Free Software Foundation,
> ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
> ++ *
> ++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
> ++ * CA 95054 USA or visitwww.sun.com  if you need additional information or
> ++ * have any questions.
> ++ */
> ++
> ++/**
> ++ * @test
> ++ * @bug 6476665 6523403 6733501
> ++ * @summary Verifies reading and writing profiles and tags of the standard color
> ++ * spaces
> ++ * @run main ReadWriteProfileTest
> ++ */
> ++import java.awt.color.ColorSpace;
> ++import java.awt.color.ICC_Profile;
> ++import java.util.*;
> ++import java.nio.*;
> ++import java.util.Hashtable;
> ++
> ++public class ReadWriteProfileTest implements Runnable {
> ++    /* Location of the tag sig counter in 4-byte words */
> ++    final static int TAG_COUNT_OFFSET = 32;
> ++
> ++    /* Location of the tag sig table in 4-byte words */
> ++    final static int TAG_ELEM_OFFSET = 33;
> ++
> ++    static byte[][] profiles;
> ++    static int [][] tagSigs;
> ++    static Hashtable<Integer,byte[]>  [] tags;
> ++
> ++    static int [] cspaces = {ColorSpace.CS_sRGB, ColorSpace.CS_PYCC,
> ++                             ColorSpace.CS_LINEAR_RGB, ColorSpace.CS_CIEXYZ,
> ++                             ColorSpace.CS_GRAY};
> ++
> ++    static String [] csNames = {"sRGB", "PYCC", "LINEAR_RGB", "CIEXYZ", "GRAY"};
> ++
> ++    static void getProfileTags(byte [] data, Hashtable tags) {
> ++        ByteBuffer byteBuf = ByteBuffer.wrap(data);
> ++        IntBuffer intBuf = byteBuf.asIntBuffer();
> ++        int tagCount = intBuf.get(TAG_COUNT_OFFSET);
> ++        intBuf.position(TAG_ELEM_OFFSET);
> ++        for (int i = 0; i<  tagCount; i++) {
> ++            int tagSig = intBuf.get();
> ++            int tagDataOff = intBuf.get();
> ++            int tagSize = intBuf.get();
> ++
> ++            byte [] tagData = new byte[tagSize];
> ++            byteBuf.position(tagDataOff);
> ++            byteBuf.get(tagData);
> ++            tags.put(tagSig, tagData);
> ++        }
> ++    }
> ++
> ++    static {
> ++        profiles = new byte[cspaces.length][];
> ++        tags = new Hashtable[cspaces.length];
> ++
> ++        for (int i = 0; i<  cspaces.length; i++) {
> ++            ICC_Profile pf = ICC_Profile.getInstance(cspaces[i]);
> ++            profiles[i] = pf.getData();
> ++            tags[i] = new Hashtable();
> ++            getProfileTags(profiles[i], tags[i]);
> ++        }
> ++    }
> ++
> ++    public void run() {
> ++        for (int i = 0; i<  cspaces.length; i++) {
> ++            ICC_Profile pf = ICC_Profile.getInstance(cspaces[i]);
> ++            byte [] data = pf.getData();
> ++            pf = ICC_Profile.getInstance(data);
> ++            if (!Arrays.equals(data, profiles[i])) {
> ++                System.err.println("Incorrect result of getData() " + "with " +
> ++                                   csNames[i] + " profile");
> ++                throw new RuntimeException("Incorrect result of getData()");
> ++            }
> ++
> ++            for (int tagSig : tags[i].keySet()) {
> ++                byte [] tagData = pf.getData(tagSig);
> ++                byte [] empty = new byte[tagData.length];
> ++                pf.setData(tagSig, empty);
> ++                pf.setData(tagSig, tagData);
> ++
> ++                byte [] tagData1 = pf.getData(tagSig);
> ++
> ++                if (!Arrays.equals(tagData1, tags[i].get(tagSig)))
> ++                {
> ++                    System.err.println("Incorrect result of getData(int) with" +
> ++                                       " tag " +
> ++                                       Integer.toHexString(tagSig) +
> ++                                       " of " + csNames[i] + " profile");
> ++
> ++                    throw new RuntimeException("Incorrect result of " +
> ++                                               "getData(int)");
> ++                }
> ++            }
> ++        }
> ++    }
> ++
> ++    public static void main(String [] args) {
> ++        ReadWriteProfileTest test = new ReadWriteProfileTest();
> ++        test.run();
> ++    }
> ++}




More information about the distro-pkg-dev mailing list