From e7778124162aef7004e040dded5de1eaf5e1ece4 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 23 Dec 2010 06:26:47 +0100 Subject: NEWT: Add WindowListener.windowDestroyed() ; Remove WindowImpl.windowDestroyed() Add WindowListener.windowDestroyed() To expose a proper window lifecycle, ie destroy-notify and destroyed, this notification is added. This will be used at least in unit tests, where we verify destruction. Remove WindowImpl.windowDestroyed(): This native hook (planned to be called by native destroy notification) is unreliable or not supported for all platforms. NEWT relies on the pre destroy native hooks and handles the final destroy notification itself. --- .../test/junit/newt/parenting/WindowAction.java | 3 + .../opengl/test/junit/util/AWTRobotUtil.java | 126 ++++++++++++++++++++- 2 files changed, 123 insertions(+), 6 deletions(-) (limited to 'src/test') diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java index bb4008e57..05793b96e 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/WindowAction.java @@ -40,5 +40,8 @@ class WindowAction extends WindowAdapter { public void windowDestroyNotify(WindowEvent e) { eventFifo.put(e); } + public void windowDestroyed(WindowEvent e) { + eventFifo.put(e); + } } diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java index 9812be5f2..4a2a181ed 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java +++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java @@ -40,6 +40,7 @@ import java.awt.Rectangle; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.InputEvent; +import javax.media.opengl.awt.GLCanvas; import javax.swing.JFrame; public class AWTRobotUtil { @@ -348,22 +349,135 @@ public class AWTRobotUtil { } /** - * Programmatically issue windowClosing on AWT or NEWT + * + * @return True if the Component becomes realized (not displayable, native invalid) within TIME_OUT + */ + public static boolean waitForRealized(Object obj, boolean realized) throws InterruptedException { + int wait; + if(obj instanceof GLCanvas) { + GLCanvas comp = (GLCanvas) obj; + for (wait=0; wait