8196090: javax/swing/JComboBox/6559152/bug6559152.java fails
Reviewed-by: serb
This commit is contained in:
parent
1d15ebe19e
commit
b90b7f50df
test/jdk
ProblemList.txt
javax/swing/JComboBox
@ -738,7 +738,6 @@ javax/swing/JSplitPane/4201995/bug4201995.java 8079127 generic-all
|
||||
javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all
|
||||
javax/swing/JTree/4633594/JTreeFocusTest.java 8173125 macosx-all
|
||||
javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all
|
||||
javax/swing/JComboBox/6559152/bug6559152.java 8196090 windows-all,macosx-all
|
||||
javax/swing/JComboBox/8032878/bug8032878.java 8196092,8196439 windows-all,macosx-all,linux-all
|
||||
javax/swing/JComboBox/8072767/bug8072767.java 8196093 windows-all,macosx-all
|
||||
javax/swing/JFileChooser/4524490/bug4524490.java 8042380 generic-all
|
||||
|
@ -68,6 +68,7 @@ public class bug4199622 extends JFrame implements ActionListener {
|
||||
|
||||
setSize(300, 300);
|
||||
pack();
|
||||
setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -83,7 +84,7 @@ public class bug4199622 extends JFrame implements ActionListener {
|
||||
if (robot == null) {
|
||||
try {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(20);
|
||||
robot.setAutoDelay(100);
|
||||
} catch (AWTException e) {
|
||||
throw new RuntimeException("Can't create robot. Test failed", e);
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ public class DefaultButtonTest extends JFrame implements ActionListener {
|
||||
getContentPane().add(new DefaultPanel(this));
|
||||
pack();
|
||||
setVisible(true);
|
||||
setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
public static void test() {
|
||||
@ -108,16 +109,12 @@ public class DefaultButtonTest extends JFrame implements ActionListener {
|
||||
// Change value, changing focus should fire an ActionEvent.
|
||||
robot.waitForIdle();
|
||||
robot.keyPress(KeyEvent.VK_BACK_SPACE);
|
||||
robot.waitForIdle();
|
||||
robot.keyRelease(KeyEvent.VK_BACK_SPACE);
|
||||
robot.waitForIdle();
|
||||
robot.keyPress(KeyEvent.VK_SHIFT);
|
||||
robot.waitForIdle();
|
||||
robot.keyPress(KeyEvent.VK_TAB);
|
||||
robot.waitForIdle();
|
||||
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||
robot.waitForIdle();
|
||||
robot.keyRelease(KeyEvent.VK_TAB);
|
||||
robot.keyRelease(KeyEvent.VK_SHIFT);
|
||||
robot.waitForIdle();
|
||||
testEditChange(true);
|
||||
robot.waitForIdle();
|
||||
|
@ -63,6 +63,7 @@ public class bug4743225 extends JFrame {
|
||||
});
|
||||
add(cb);
|
||||
pack();
|
||||
setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
public static BasicComboPopup getPopup() {
|
||||
@ -78,7 +79,7 @@ public class bug4743225 extends JFrame {
|
||||
public static void main(String... args) throws Exception {
|
||||
|
||||
Robot robot = new Robot();
|
||||
robot.setAutoDelay(20);
|
||||
robot.setAutoDelay(100);
|
||||
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -27,39 +27,59 @@
|
||||
* @bug 6559152
|
||||
* @summary Checks that you can select an item in JComboBox with keyboard
|
||||
* when it is a JTable cell editor.
|
||||
* @author Mikhail Lapshin
|
||||
* @library /lib/client
|
||||
* @build ExtendedRobot
|
||||
* @run main bug6559152
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.DefaultCellEditor;
|
||||
import javax.swing.JComponent;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import java.awt.*;
|
||||
import javax.swing.JTable;
|
||||
import java.awt.Point;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.Robot;
|
||||
|
||||
public class bug6559152 {
|
||||
private JFrame frame;
|
||||
private JComboBox cb;
|
||||
private ExtendedRobot robot;
|
||||
private static JFrame frame;
|
||||
private static JComboBox cb;
|
||||
private static Robot robot;
|
||||
private static Point p = null;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final bug6559152 test = new bug6559152();
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(100);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(new Runnable() {
|
||||
public void run() {
|
||||
test.setupUI();
|
||||
}
|
||||
});
|
||||
test.test();
|
||||
SwingUtilities.invokeAndWait(() -> setupUI());
|
||||
blockTillDisplayed(cb);
|
||||
robot.waitForIdle();
|
||||
robot.delay(1000);
|
||||
test();
|
||||
} finally {
|
||||
if (test.frame != null) {
|
||||
test.frame.dispose();
|
||||
if (frame != null) {
|
||||
SwingUtilities.invokeAndWait(() -> frame.dispose());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setupUI() {
|
||||
static void blockTillDisplayed(JComponent comp) throws Exception {
|
||||
while (p == null) {
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(() -> {
|
||||
p = comp.getLocationOnScreen();
|
||||
});
|
||||
} catch (IllegalStateException e) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setupUI() {
|
||||
frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
|
||||
@ -72,27 +92,31 @@ public class bug6559152 {
|
||||
frame.add(cb);
|
||||
|
||||
frame.pack();
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setVisible(true);
|
||||
frame.setLocationRelativeTo(null);
|
||||
}
|
||||
|
||||
private void test() throws Exception {
|
||||
robot = new ExtendedRobot();
|
||||
robot.waitForIdle();
|
||||
private static void test() throws Exception {
|
||||
robot.mouseMove(p.x, p.y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
testImpl();
|
||||
robot.waitForIdle();
|
||||
checkResult();
|
||||
}
|
||||
|
||||
private void testImpl() throws Exception {
|
||||
robot.type(KeyEvent.VK_DOWN);
|
||||
private static void testImpl() throws Exception {
|
||||
robot.keyPress(KeyEvent.VK_DOWN);
|
||||
robot.keyRelease(KeyEvent.VK_DOWN);
|
||||
robot.waitForIdle();
|
||||
robot.type(KeyEvent.VK_DOWN);
|
||||
robot.keyPress(KeyEvent.VK_DOWN);
|
||||
robot.keyRelease(KeyEvent.VK_DOWN);
|
||||
robot.waitForIdle();
|
||||
robot.type(KeyEvent.VK_ENTER);
|
||||
robot.keyPress(KeyEvent.VK_ENTER);
|
||||
robot.keyRelease(KeyEvent.VK_ENTER);
|
||||
}
|
||||
|
||||
private void checkResult() {
|
||||
private static void checkResult() {
|
||||
if (cb.getSelectedItem().equals("two")) {
|
||||
System.out.println("Test passed");
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user