Files old/java/awt/color/XAWTDifference/MotifColors.jpg and new/java/awt/color/XAWTDifference/MotifColors.jpg differ --- old/java/awt/color/XAWTDifference/XAWTDifference.java 2012-04-02 18:24:52.253411900 +0400 +++ new/java/awt/color/XAWTDifference/XAWTDifference.java 2012-04-02 18:24:52.065401100 +0400 @@ -1,4 +1,27 @@ /* + * Copyright (c) 2012, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* test @bug 5092883 6513478 @summary REGRESSION: SystemColor class gives back wrong values under Linux @@ -54,12 +77,12 @@ ta.add(pm); ta.addMouseListener(new java.awt.event.MouseAdapter() { - public void mousePressed( MouseEvent me ) { - if(me.isPopupTrigger()) { - pm.show(me.getComponent(), me.getX(), me.getY()); - } + public void mousePressed( MouseEvent me ) { + if(me.isPopupTrigger()) { + pm.show(me.getComponent(), me.getX(), me.getY()); } - }); + } + }); Vector vector = containers; @@ -105,22 +128,22 @@ this.setLayout (new BorderLayout ()); String[] instructions = - { - "You would see a frame with title \"XAWTDifference. Test Frame.\" (1)", - "I) It has three columns in it. The first one with ordinary components.", - "The second one with disabled components.", - "The third one with uneditable components(only text components are there).", - "Verify that the difference between different states is visible.", - "II) You would also see a frame named \"StandardFrame\" (2) with lot of components in it.", - "Actually this is just a jpg-image in a frame.", - "This image reflects how Motif components looks like.", - "Verify that every component in the frame (1) looks similar to the same component in (2)", - "They might differ in colors and be darker or brighter but the whole picture should", - "be the same. For your convinience you may use mouse clicks to", - "check color for every point on frame (1) or on image inside frame (2).", - "Also check the color of the MenuBar, Items in the MenuBar and the PopupMenu assigned to TextArea.", - "As you can\'t compare the colors of menu items with the picture so just look if the are adeqaute enough." - }; + { + "You would see a frame with title \"XAWTDifference. Test Frame.\" (1)", + "I) It has three columns in it. The first one with ordinary components.", + "The second one with disabled components.", + "The third one with uneditable components(only text components are there).", + "Verify that the difference between different states is visible.", + "II) You would also see a frame named \"StandardFrame\" (2) with lot of components in it.", + "Actually this is just a jpg-image in a frame.", + "This image reflects how Motif components looks like.", + "Verify that every component in the frame (1) looks similar to the same component in (2)", + "They might differ in colors and be darker or brighter but the whole picture should", + "be the same. For your convinience you may use mouse clicks to", + "check color for every point on frame (1) or on image inside frame (2).", + "Also check the color of the MenuBar, Items in the MenuBar and the PopupMenu assigned to TextArea.", + "As you can\'t compare the colors of menu items with the picture so just look if the are adeqaute enough." + }; Sysout.createDialogWithInstructions( instructions ); }//End init() @@ -128,17 +151,17 @@ public void start () { Toolkit toolkit = Toolkit.getDefaultToolkit(); - String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); - if (toolkitName.equals("sun.awt.windows.WToolkit")){ - Sysout.println("This test is for XAWT/Motif only. Now using :"+toolkit); + if (!toolkitName.equals("sun.awt.X11.XToolkit")) { + Sysout.println("Press PASS, this test is for XAWT/Motif only. Now using :"+toolkit); return; } + String testPath = System.getProperty("test.src", "."); Sysout.println("test.src == "+testPath); Frame standardFrame = new StandardFrame("StandardFrame"); - standardFrame.setSize(531, 832); + standardFrame.setSize(417, 667); standardFrame.setVisible(true); setVisible(true); @@ -173,12 +196,12 @@ throw new RuntimeException("Unable to create robot:"+e); } toolkit.addAWTEventListener(new AWTEventListener(){ - public void eventDispatched(AWTEvent ev){ - if (ev instanceof MouseEvent && ev.getID() == MouseEvent.MOUSE_CLICKED){ - MouseEvent e = (MouseEvent)ev; - Sysout.println("Coords: "+ e.getXOnScreen()+":"+ e.getYOnScreen()+"::"+ robot.getPixelColor(e.getXOnScreen(), e.getYOnScreen())); - } - } + public void eventDispatched(AWTEvent ev){ + if (ev instanceof MouseEvent && ev.getID() == MouseEvent.MOUSE_CLICKED){ + MouseEvent e = (MouseEvent)ev; + Sysout.println("Coords: "+ e.getXOnScreen()+":"+ e.getYOnScreen()+"::"+ robot.getPixelColor(e.getXOnScreen(), e.getYOnScreen())); + } + } }, MouseEvent.BUTTON1_MASK); @@ -197,28 +220,28 @@ image = Toolkit.getDefaultToolkit().getImage(testPath + File.separator + "MotifColors.jpg"); } public void paint(Graphics g){ - g.drawImage(image, 0, 0, 531, 832, null); + g.drawImage(image, 0, 0, 417, 667, this); } } /**************************************************** Standard Test Machinery DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. + chunk of code whose purpose is to make user + interaction uniform, and thereby make it simpler + to read and understand someone else's test. ****************************************************/ /** This is part of the standard test machinery. It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. + for sending text messages to the user. To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. + WithInstructions method. Put one line of instructions per array entry. To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. + with the string to be displayed. This mimics System.out.println but works within the test harness as well - as standalone. + as standalone. */ class Sysout @@ -257,13 +280,13 @@ }// Sysout class /** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ + This is part of the standard test machinery. It provides a place for the + test instructions to be displayed, and a place for interactive messages + to the user to be displayed. + To have the test instructions displayed, see Sysout. + To have a message to the user be displayed, see Sysout. + Do not call anything in this dialog directly. + */ class TestDialog extends Dialog { @@ -307,7 +330,7 @@ { //Try to chop on a word boundary int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); + lastIndexOf( ' ', maxStringLength - 1 ); if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;