JDK-7124275 : [macosx] Regression test fails in b216: a modality issue
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,9,11,12,13,14,15
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: os_x
  • CPU: generic
  • Submitted: 2011-12-23
  • Updated: 2023-10-09
Related Reports
Relates :  
Description
http://java.net/jira/browse/MACOSX_PORT-667 submitted 2011/11/07 by Yuri Nesterenko
See the attached regression test (it is from closed but should be moved). It does pass on b215 but fails on b216, so there's an immediate regression here. 
Modal excluded Window whose decorated parent is blocked should be non-focusable. See also the original bug 6272324.

Comments
This test is still failing in JDK 11 on MacOSX. It is mentioned in https://bugs.openjdk.java.net/browse/JDK-8047703 which mentions tests that using timing instead of synchronisation as possibly being buggy. The failure I am seeing is ----------System.out:(2/106)---------- Any messages for the tester will display here. Clicking java.awt.Button[button0,107,5,86x29,label=button] ----------System.err:(5/348)---------- java.lang.RuntimeException: Test failed! at NonFocusableBlockedOwnerTest.start(NonFocusableBlockedOwnerTest.java:96) at com.sun.javatest.regtest.agent.AppletWrapper$AppletRunnable.run(AppletWrapper.java:157) at java.base/java.lang.Thread.run(Thread.java:832) STATUS:Failed.Applet thread threw exception: java.lang.RuntimeException: Test failed! ----------rerun:(21/1753)*----------
10-05-2018

RULE java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest Exception java.lang.RuntimeException: Test failed!
13-04-2015

In JDK9 it fails on OS X, and the test now is openjdk regression test RULE java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html java.lang.RuntimeException
18-03-2015

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

EVALUATION Still the problem is with the test machinery. I've made changes (see Suggested Fix) in which I use right Util.waitForIdle/Util.clickOnComp methods and the test started to pass. It's better to postpone this (fix in the test) to 7u6.
27-02-2012

SUGGESTED FIX diff --git a/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java b/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java --- a/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java +++ b/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java @@ -1,15 +1,19 @@ /* - test + @test @bug 6272324 + @key closed-nojdc @summary Modal excluded Window which decorated parent is blocked should be non-focusable. @author ###@###.###: area=awt.focus - @run applet NonFocusableBlockedOwnerTest.html + @library ../../../../../java/awt/regtesthelpers + @build Util + @run main NonFocusableBlockedOwnerTest */ import java.applet.Applet; import java.awt.*; import java.awt.event.*; import java.lang.reflect.*; +import test.java.awt.regtesthelpers.Util; public class NonFocusableBlockedOwnerTest extends Applet { Robot robot; @@ -67,8 +71,11 @@ e.printStackTrace(); } - waitTillShown(dialog); - clickOn(button); + Util.waitForIdle(robot); + + Util.clickOnComp(button, robot); + Util.waitForIdle(robot); + if (frame == KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()) { throw new RuntimeException("Test failed!"); } @@ -80,52 +87,6 @@ } Sysout.println("Test passed."); } - - void clickOn(Component c) { - Point p = c.getLocationOnScreen(); - Dimension d = c.getSize(); - - Sysout.println("Clicking " + c); - - if (c instanceof Frame) { - robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2); - } else { - robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2)); - } - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - waitForIdle(); - } - - void waitTillShown(Component c) { - while (true) { - try { - Thread.sleep(100); - c.getLocationOnScreen(); - break; - } catch (InterruptedException e) { - throw new RuntimeException(e); - } catch (IllegalComponentStateException e) {} - } - } - void waitForIdle() { - try { - Toolkit.getDefaultToolkit().sync(); - sun.awt.SunToolkit.flushPendingEvents(); - EventQueue.invokeAndWait( new Runnable() { - public void run() {} // Dummy implementation - }); - } catch(InterruptedException ie) { - Sysout.println("waitForIdle, non-fatal exception caught:"); - ie.printStackTrace(); - } catch(InvocationTargetException ite) { - Sysout.println("waitForIdle, non-fatal exception caught:"); - ite.printStackTrace(); - } - - // wait longer... - robot.delay(200); - } } /****************************************************
27-02-2012

EVALUATION There are a number of problems with the test itself. Firstly, it uses wrong approach to ensure that all windows have been shown: the fact that some component has an expected location on the screen doesn't mean that it has already been shown. Using realSync() helps there. Same for waitForIdle() test's method: it is better to use realSync() instead. Having said this, I must note that even with all these improvements the test still fails, indicating that there are some problems on our side as well. Further evaluation is needed.
17-01-2012

EVALUATION Author: Yuri Nesterenko Date: 07/Nov/11 01:13 PM Build: b216 closed/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest
23-12-2011