14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.BorderLayout;
25 import java.awt.Color;
26 import java.awt.Container;
27 import java.awt.Point;
28 import java.awt.Robot;
29 import java.awt.event.MouseAdapter;
30 import java.awt.event.MouseEvent;
31 import javax.swing.JFrame;
32 import javax.swing.JInternalFrame;
33 import javax.swing.SwingUtilities;
34
35 /**
36 * AWT/Swing overlapping test with JInternalFrame being put in GlassPane.
37 * See <a href="https://bugs.openjdk.java.net/browse/JDK-6637655">JDK-6637655</a> and
38 * <a href="https://bugs.openjdk.java.net/browse/JDK-6985776">JDK-6985776</a>.
39 * <p>See base class for details.
40 */
41 /*
42 @test
43 @bug 6637655 6985776
44 @summary Overlapping test for javax.swing.JScrollPane
45 @author sergey.grinev@oracle.com: area=awt.mixing
46 @run main JGlassPaneInternalFrameOverlapping
47 */
48 public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase {
49
50 private boolean lwClicked = true;
51 private Point lLoc;
52 private Point lLoc2;
53 private JInternalFrame internalFrame;
54
55 protected boolean performTest() {
56 try {
57 SwingUtilities.invokeAndWait(new Runnable() {
58 public void run() {
59 lLoc = internalFrame.getContentPane().getLocationOnScreen();
60 lLoc2 = lLoc.getLocation();
61 lLoc2.translate(0, internalFrame.getContentPane().getHeight() + 10);
62 }
63 });
64 } catch (Exception e) {
65 e.printStackTrace();
66 System.exit(1);
67 }
68 // run robot
69 Robot robot = Util.createRobot();
70 robot.setAutoDelay(ROBOT_DELAY);
71
72 clickAndBlink(robot, lLoc);
73
74 Color c = robot.getPixelColor(lLoc2.x, lLoc2.y);
75 robot.mouseMove(lLoc2.x, lLoc2.y);
76 if (!c.equals(AWT_BACKGROUND_COLOR) &&
77 currentAwtControl.getClass() != java.awt.Scrollbar.class &&
78 currentAwtControl.getClass() != java.awt.Choice.class) {
79 fail("The HW component did not pass pixel color check and is not drawn correctly");
80 }
81
82 return lwClicked;
83 }
84
85 // {debugClassName = "Choice";}
86
|
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import java.awt.BorderLayout;
25 import java.awt.Color;
26 import java.awt.Container;
27 import java.awt.Point;
28 import java.awt.Robot;
29 import java.awt.event.MouseAdapter;
30 import java.awt.event.MouseEvent;
31 import javax.swing.JFrame;
32 import javax.swing.JInternalFrame;
33 import javax.swing.SwingUtilities;
34 import test.java.awt.regtesthelpers.Util;
35
36 /**
37 * AWT/Swing overlapping test with JInternalFrame being put in GlassPane.
38 * See <a href="https://bugs.openjdk.java.net/browse/JDK-6637655">JDK-6637655</a> and
39 * <a href="https://bugs.openjdk.java.net/browse/JDK-6985776">JDK-6985776</a>.
40 * <p>See base class for details.
41 */
42 /*
43 @test
44 @bug 6637655 6985776
45 @summary Overlapping test for javax.swing.JScrollPane
46 @author sergey.grinev@oracle.com: area=awt.mixing
47 @library ../../regtesthelpers
48 @build Util
49 @run main JGlassPaneInternalFrameOverlapping
50 */
51 public class JGlassPaneInternalFrameOverlapping extends OverlappingTestBase {
52
53 private boolean lwClicked = true;
54 private Point lLoc;
55 private Point lLoc2;
56 private JInternalFrame internalFrame;
57
58 protected boolean performTest() {
59 try {
60 SwingUtilities.invokeAndWait(new Runnable() {
61 public void run() {
62 lLoc = internalFrame.getContentPane().getLocationOnScreen();
63 lLoc2 = lLoc.getLocation();
64 lLoc2.translate(0, internalFrame.getContentPane().getHeight() + 10);
65 }
66 });
67 } catch (Exception e) {
68 e.printStackTrace();
69 throw new RuntimeException("Where is internal frame?");
70 }
71 // run robot
72 Robot robot = Util.createRobot();
73 robot.setAutoDelay(ROBOT_DELAY);
74
75 clickAndBlink(robot, lLoc);
76
77 Color c = robot.getPixelColor(lLoc2.x, lLoc2.y);
78 robot.mouseMove(lLoc2.x, lLoc2.y);
79 if (!c.equals(AWT_BACKGROUND_COLOR) &&
80 currentAwtControl.getClass() != java.awt.Scrollbar.class &&
81 currentAwtControl.getClass() != java.awt.Choice.class) {
82 fail("The HW component did not pass pixel color check and is not drawn correctly");
83 }
84
85 return lwClicked;
86 }
87
88 // {debugClassName = "Choice";}
89
|