Skip to content

Commit 2b47a58

Browse files
committed
8028281: [TEST_BUG] [macosx] javax/swing/JTabbedPane/7024235/Test7024235.java fails
Reviewed-by: psadhukhan, prr
1 parent 83a91bf commit 2b47a58

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

test/jdk/ProblemList.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all
759759
javax/swing/JPopupMenu/6675802/bug6675802.java 8196097 windows-all
760760
javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all
761761
javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all
762-
javax/swing/JTabbedPane/7024235/Test7024235.java 8028281 macosx-all
763762
javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all
764763
javax/swing/plaf/basic/Test6984643.java 8198340 windows-all
765764
javax/swing/text/CSSBorder/6796710/bug6796710.java 8196099 windows-all

test/jdk/javax/swing/JTabbedPane/7024235/Test7024235.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,16 +22,14 @@
2222
*/
2323

2424
import java.awt.BorderLayout;
25-
2625
import java.awt.Container;
2726
import java.awt.Rectangle;
28-
import java.awt.Toolkit;
27+
import java.awt.Robot;
2928

3029
import javax.swing.JButton;
3130
import javax.swing.JCheckBox;
32-
import javax.swing.JTabbedPane;
33-
3431
import javax.swing.JFrame;
32+
import javax.swing.JTabbedPane;
3533
import javax.swing.SwingUtilities;
3634
import javax.swing.UIManager;
3735
import javax.swing.UIManager.LookAndFeelInfo;
@@ -41,9 +39,6 @@
4139
* @key headful
4240
* @bug 7024235
4341
* @summary Tests JFrame.pack() with the JTabbedPane
44-
* @library /lib/client/
45-
* @build ExtendedRobot
46-
* @author Sergey Malenkov
4742
* @run main Test7024235
4843
*/
4944

@@ -54,12 +49,15 @@ public class Test7024235 implements Runnable {
5449
public static void main(String[] args) throws Exception {
5550
Test7024235 test = new Test7024235();
5651
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
57-
UIManager.setLookAndFeel(info.getClassName());
52+
String className = info.getClassName();
53+
System.out.println("className = " + className);
54+
UIManager.setLookAndFeel(className);
5855

5956
test.test();
6057
try {
61-
ExtendedRobot robot = new ExtendedRobot();
62-
robot.waitForIdle(1000);
58+
Robot robot = new Robot();
59+
robot.waitForIdle();
60+
robot.delay(1000);
6361
}catch(Exception ex) {
6462
ex.printStackTrace();
6563
throw new Error("Unexpected Failure");
@@ -81,6 +79,7 @@ public void run() {
8179
JFrame frame = new JFrame();
8280
frame.add(BorderLayout.WEST, this.pane);
8381
frame.pack();
82+
frame.setLocationRelativeTo(null);
8483
frame.setVisible(true);
8584

8685
test("first");
@@ -105,6 +104,9 @@ private void test(String step) {
105104
this.passed = true;
106105
for (int index = 0; index < this.pane.getTabCount(); index++) {
107106
Rectangle bounds = this.pane.getBoundsAt(index);
107+
if (bounds == null) {
108+
continue;
109+
}
108110
int centerX = bounds.x + bounds.width / 2;
109111
int centerY = bounds.y + bounds.height / 2;
110112
int actual = this.pane.indexAtLocation(centerX, centerY);

0 commit comments

Comments
 (0)