diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index 7e07b1cf6fc25..0d0883faf4deb 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -650,7 +650,6 @@ javax/swing/JWindow/ShapedAndTranslucentWindows/TranslucentJComboBox.java 802462 # The next test below is an intermittent failure javax/swing/JTree/DnD/LastNodeLowerHalfDrop.java 8159131 linux-all javax/swing/JTree/4633594/JTreeFocusTest.java 7105441 macosx-all -javax/swing/JTree/6263446/bug6263446.java 8296083 linux-all javax/swing/JSpinner/4788637/bug4788637.java 8296084 linux-all javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-all javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all diff --git a/test/jdk/javax/swing/JTree/6263446/bug6263446.java b/test/jdk/javax/swing/JTree/6263446/bug6263446.java index 86b6ee3b59c2e..87272c374ccc7 100644 --- a/test/jdk/javax/swing/JTree/6263446/bug6263446.java +++ b/test/jdk/javax/swing/JTree/6263446/bug6263446.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2022, 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 @@ -38,7 +38,7 @@ public class bug6263446 { - private static final String FIRST = "AAAAAAAAAAA"; + private static final String FIRST = "AAAAA"; private static final String SECOND = "BB"; private static final String ALL = FIRST + " " + SECOND; private static JTree tree; @@ -62,46 +62,59 @@ public void run() { try { Point point = getClickPoint(); robot.mouseMove(point.x, point.y); + robot.waitForIdle(); // click count 3 click(1); + robot.waitForIdle(); assertNotEditing(); click(2); + robot.waitForIdle(); assertNotEditing(); click(3); + robot.waitForIdle(); assertEditing(); cancelCellEditing(); assertNotEditing(); click(4); + robot.waitForIdle(); checkSelectedText(FIRST); click(5); + robot.waitForIdle(); checkSelectedText(ALL); // click count 4 setClickCountToStart(4); + robot.waitForIdle(); click(1); + robot.waitForIdle(); assertNotEditing(); click(2); + robot.waitForIdle(); assertNotEditing(); click(3); + robot.waitForIdle(); assertNotEditing(); click(4); + robot.waitForIdle(); assertEditing(); cancelCellEditing(); assertNotEditing(); click(5); + robot.waitForIdle(); checkSelectedText(FIRST); click(6); + robot.waitForIdle(); checkSelectedText(ALL); // start path editing @@ -109,12 +122,15 @@ public void run() { assertEditing(); click(1); + robot.waitForIdle(); checkSelection(null); click(2); + robot.waitForIdle(); checkSelection(FIRST); click(3); + robot.waitForIdle(); checkSelection(ALL); } finally { if (frame != null) { @@ -128,7 +144,6 @@ private static void click(int times) { for (int i = 0; i < times; i++) { robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - robot.waitForIdle(); } } @@ -141,7 +156,7 @@ private static Point getClickPoint() throws Exception { public void run() { Rectangle rect = tree.getRowBounds(0); // UPDATE !!! - Point p = new Point(rect.x + rect.width / 2, rect.y + 2); + Point p = new Point(rect.x + rect.width/2, rect.y + rect.height/2); SwingUtilities.convertPointToScreen(p, tree); result[0] = p; @@ -166,9 +181,11 @@ private static void createAndShowGUI() { frame.getContentPane().add(tree); + frame.setAlwaysOnTop(true); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); + frame.toFront(); } private static void setClickCountToStart(final int clicks) throws Exception { @@ -183,6 +200,7 @@ public void run() { field.setAccessible(true); DefaultCellEditor ce = (DefaultCellEditor) field.get(editor); ce.setClickCountToStart(clicks); + } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (NoSuchFieldException e) { @@ -248,7 +266,9 @@ public void run() { private static void checkSelectedText(String sel) throws Exception { assertEditing(); checkSelection(sel); + robot.waitForIdle(); cancelCellEditing(); + robot.waitForIdle(); assertNotEditing(); }