diff options
author | Sven Gothel <[email protected]> | 2010-10-06 16:04:06 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-10-06 16:04:06 +0200 |
commit | 018c7e8660dc0af68bd129be9af5094d04d0b431 (patch) | |
tree | ac17156a48167f4a28e129adfc78b7c746aa6744 /src/junit/com/jogamp/test | |
parent | 03416ffe040d50b96573930104a78933605ae40d (diff) |
NativeWindow/NativeSurface Refactoring ; Added mouseClick NEWT/AWT unit test
NativeWindow/NativeSurface Refactoring
- Using NativeSurface interface
- NativeWindow extends NativeSurface, adds getLocationOnScreen(Point)
- NativeWindow add: getParent()
- NativeWindow/Surface: Removed 'invalidate()', use 'destroy()' if you must.
- NullWindow -> ProxySurface impl NativeSurface
- JOGL: Uses NativeSurface only.
- GLDrawable.getNativeWindow() -> GLDrawable.getNativeSurface()
Added mouseClick NEWT/AWT unit test
JOGL:
- GLAnimatorControl add: resetCounter()
-
NEWT:
- GLWindow counters: return GLWindow counters always
- WindowImpl
- requestFocus() wait until done
- reparent: readded requestFocusImpl(true),
native impl skips java focusAction if reparented
- X11Window: Add XRaiseWindow() in requestFocus()
Diffstat (limited to 'src/junit/com/jogamp/test')
11 files changed, 59 insertions, 70 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java index 2bb14dee0..243c9e8a7 100644 --- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java @@ -120,7 +120,7 @@ public class TestDrawable01NEWT extends UITestCase { // Assert.assertEquals(width,drawable.getWidth()); // Assert.assertEquals(height,drawable.getHeight()); // Assert.assertEquals(glCaps,drawable.getChosenGLCapabilities()); - Assert.assertEquals(window,drawable.getNativeWindow()); + Assert.assertEquals(window,drawable.getNativeSurface()); // System.out.println("Post: "+drawable); context = drawable.createContext(null); diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java index cc4686159..c5d770bb8 100644 --- a/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java +++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/Surface2File.java @@ -46,7 +46,7 @@ public class Surface2File implements SurfaceUpdatedListener { readBufferUtil.dispose(); } - public void surfaceUpdated(Object updater, NativeWindow window, long when) { + public void surfaceUpdated(Object updater, NativeSurface ns, long when) { if (updater instanceof GLDrawable) { GLDrawable drawable = (GLDrawable) updater; GLContext ctx = GLContext.getCurrent(); diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java index 263f5da1a..7f70d1f8b 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -158,7 +158,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(false,window.isVisible()); // just make the Window visible again - window.resetPerfCounter(); + window.resetCounter(); Assert.assertEquals(0, window.getTotalFrames()); window.setVisible(true); wait=0; @@ -186,7 +186,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); - window.resetPerfCounter(); + window.resetCounter(); Assert.assertEquals(0, window.getTotalFrames()); // a display call shall not change a thing diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java index 145b32a5f..dfca6c10b 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -29,39 +29,24 @@ package com.jogamp.test.junit.newt; import java.lang.reflect.*; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; import org.junit.Assert; -import org.junit.Before; import org.junit.BeforeClass; -import org.junit.After; import org.junit.AfterClass; import org.junit.Test; import java.awt.AWTException; import java.awt.Button; import java.awt.BorderLayout; -import java.awt.Canvas; import java.awt.Container; -import java.awt.Frame; -import java.awt.Dimension; -import java.awt.event.FocusEvent; -import java.awt.event.FocusListener; import java.awt.Robot; -import java.awt.Point; -import java.awt.Rectangle; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.media.opengl.*; -import javax.media.nativewindow.*; import com.jogamp.opengl.util.Animator; -import com.jogamp.newt.*; -import com.jogamp.newt.event.*; import com.jogamp.newt.opengl.*; import com.jogamp.newt.awt.NewtCanvasAWT; @@ -252,7 +237,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase { glWindow1.destroy(true); } - @Test +// @Test public void testFocus01ProgrFocus() throws AWTException, InterruptedException, InvocationTargetException { testFocus01ProgrFocusImpl(null); } diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java index 3ac830c89..c07601eb6 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java @@ -86,7 +86,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); screen = glWindow1.getScreen(); display = screen.getDisplay(); Assert.assertEquals(true,display.getDestroyWhenUnused()); @@ -108,7 +108,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertNotNull(glWindow2); Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(false, glWindow2.isNativeValid()); - Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow()); + Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen,glWindow2.getScreen()); Assert.assertSame(display,glWindow2.getScreen().getDisplay()); glWindow2.setSize(320, 240); @@ -156,8 +156,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, glWindow2.isNativeValid()); Assert.assertEquals(0, glWindow1.getTotalFrames()); - glWindow1.resetPerfCounter(); - glWindow2.resetPerfCounter(); + glWindow1.resetCounter(); + glWindow2.resetCounter(); Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); @@ -173,8 +173,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - glWindow1.resetPerfCounter(); - glWindow2.resetPerfCounter(); + glWindow1.resetCounter(); + glWindow2.resetCounter(); Animator animator1 = new Animator(glWindow1); animator1.start(); Assert.assertEquals(true, animator1.isAnimating()); @@ -201,8 +201,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true, animator2.isPaused()); Assert.assertNotNull(animator2.getThread()); - glWindow1.resetPerfCounter(); - glWindow2.resetPerfCounter(); + glWindow1.resetCounter(); + glWindow2.resetCounter(); animator1.resume(); Assert.assertEquals(true, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); @@ -268,8 +268,8 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); // recreation .. - glWindow1.resetPerfCounter(); - glWindow2.resetPerfCounter(); + glWindow1.resetCounter(); + glWindow2.resetCounter(); Assert.assertEquals(0, glWindow1.getTotalFrames()); Assert.assertEquals(0, glWindow2.getTotalFrames()); glWindow1.setVisible(true); @@ -434,14 +434,16 @@ public class TestParenting01NEWT extends UITestCase { case 0: // glWindow2 -- child --> glWindow1: compatible Assert.assertEquals(true, glWindow2.isVisible()); + System.err.println("Frames(1) "+glWindow2.getTotalFrames()); reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate); + System.err.println("Frames(2) "+glWindow2.getTotalFrames()); Assert.assertTrue(Window.ReparentAction.ACTION_INVALID < reparentAction); for(wait=0; wait<10 && glWindow2.getTotalFrames()<1; wait++) { Thread.sleep(100); } System.err.println("Frames for reparentWindow(parent, "+reparentRecreate+"): "+reparentAction+", B2: "+glWindow2.getTotalFrames()); Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow()); + Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -484,7 +486,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - Assert.assertNull(glWindow2.getParentNativeWindow()); + Assert.assertNull(glWindow2.getParent()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -674,7 +676,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,display1.getEDTUtil().isRunning()); Assert.assertEquals(2,screen1.getReferenceCount()); Assert.assertEquals(true,screen1.isNativeValid()); - Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow()); + Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -697,7 +699,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - Assert.assertNull(glWindow2.getParentNativeWindow()); + Assert.assertNull(glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -711,7 +713,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertEquals(true, glWindow2.isVisible()); Assert.assertEquals(true, glWindow2.isNativeValid()); - Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow()); + Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertSame(display1,glWindow2.getScreen().getDisplay()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -735,7 +737,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,display1.getEDTUtil().isRunning()); Assert.assertEquals(2,screen1.getReferenceCount()); Assert.assertEquals(true,screen1.isNativeValid()); - Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow()); + Assert.assertSame(glWindow1,glWindow2.getParent()); Assert.assertSame(screen1,glWindow2.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java index 34c1bc1f3..3d3f5234d 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java @@ -90,7 +90,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); GLEventListener demo1 = new RedSquare(); setDemoFields(demo1, glWindow1, false); @@ -100,7 +100,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); Frame frame1 = new Frame("AWT Parent Frame"); frame1.setLayout(new BorderLayout()); @@ -122,7 +122,7 @@ public class TestParenting01aAWT extends UITestCase { // visible test frame1.setVisible(true); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); animator1.start(); @@ -139,7 +139,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(true, glWindow1.isValid()); frame1.remove(newtCanvasAWT); - // Assert.assertNull(glWindow1.getParentNativeWindow()); + // Assert.assertNull(glWindow1.getParent()); Assert.assertEquals(true, glWindow1.isValid()); frame1.dispose(); @@ -160,7 +160,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); GLEventListener demo1 = new RedSquare(); setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); @@ -169,7 +169,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); Frame frame = new Frame("AWT Parent Frame"); Assert.assertNotNull(frame); @@ -179,7 +179,7 @@ public class TestParenting01aAWT extends UITestCase { frame.setVisible(true); frame.add(newtCanvasAWT); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); animator1.start(); @@ -248,7 +248,7 @@ public class TestParenting01aAWT extends UITestCase { frame.setVisible(true); frame.add(newtCanvasAWT); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); animator1.start(); @@ -260,12 +260,12 @@ public class TestParenting01aAWT extends UITestCase { case 0: glWindow1.reparentWindow(null); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); break; case 1: glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow()); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); break; } state++; @@ -303,7 +303,7 @@ public class TestParenting01aAWT extends UITestCase { frame.setVisible(true); frame.add(newtCanvasAWT, BorderLayout.CENTER); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); animator1.start(); @@ -315,12 +315,12 @@ public class TestParenting01aAWT extends UITestCase { case 0: glWindow1.reparentWindow(null); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); break; case 1: glWindow1.reparentWindow(newtCanvasAWT.getNativeWindow()); Assert.assertEquals(true, glWindow1.isNativeValid()); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); break; } state++; @@ -369,7 +369,7 @@ public class TestParenting01aAWT extends UITestCase { frame2.setVisible(true); frame1.add(newtCanvasAWT, BorderLayout.CENTER); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); Animator animator1 = new Animator(glWindow1); animator1.start(); diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java index f9a19fe73..11d25822a 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java @@ -124,7 +124,7 @@ public class TestParenting01bAWT extends UITestCase { frame2.setVisible(true); frame1.add(newtCanvasAWT, BorderLayout.CENTER); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); GLAnimatorControl animator1; if(fps>0) { diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java index 9919666fd..24ee30bc0 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java @@ -89,7 +89,7 @@ public class TestParenting01cAWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); GLEventListener demo1 = new RedSquare(); setDemoFields(demo1, glWindow1, false); @@ -99,7 +99,7 @@ public class TestParenting01cAWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); Frame frame1 = new Frame("AWT Parent Frame"); frame1.setLayout(new BorderLayout()); @@ -121,7 +121,7 @@ public class TestParenting01cAWT extends UITestCase { // visible test frame1.setVisible(true); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); for(i=0; i*100<durationPerTest; i++) { Thread.sleep(100); @@ -134,7 +134,7 @@ public class TestParenting01cAWT extends UITestCase { Assert.assertEquals(true, glWindow1.isValid()); frame1.remove(newtCanvasAWT); - // Assert.assertNull(glWindow1.getParentNativeWindow()); + // Assert.assertNull(glWindow1.getParent()); Assert.assertEquals(true, glWindow1.isValid()); frame1.dispose(); @@ -180,7 +180,7 @@ public class TestParenting01cAWT extends UITestCase { frame2.setVisible(true); frame1.add(newtCanvasAWT, BorderLayout.CENTER); - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); int state; for(state=0; state<3; state++) { diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java index 6e35f024e..ece99c0be 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java @@ -96,7 +96,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); GLEventListener demo1 = new RedSquare(); setDemoFields(demo1, glWindow1, false); @@ -124,7 +124,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); Container container1 = new Container(); container1.setLayout(new BorderLayout()); @@ -155,7 +155,7 @@ public class TestParenting01cSwingAWT extends UITestCase { final Container _container1 = container1; // visible test - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) { Thread.sleep(100); @@ -183,7 +183,7 @@ public class TestParenting01cSwingAWT extends UITestCase { System.out.println("Demos: 5 - X Container"); _jPanel1.remove(_container1); } }); - // Assert.assertNull(glWindow1.getParentNativeWindow()); + // Assert.assertNull(glWindow1.getParent()); Assert.assertEquals(true, glWindow1.isValid()); SwingUtilities.invokeAndWait(new Runnable() { @@ -210,7 +210,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertNotNull(glWindow1); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); glWindow1.setTitle("testWindowParenting01CreateVisibleDestroy"); GLEventListener demo1 = new RedSquare(); setDemoFields(demo1, glWindow1, false); @@ -237,7 +237,7 @@ public class TestParenting01cSwingAWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow1.isVisible()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertNull(glWindow1.getParentNativeWindow()); + Assert.assertNull(glWindow1.getParent()); Container container1 = new Container(); container1.setLayout(new BorderLayout()); @@ -286,7 +286,7 @@ public class TestParenting01cSwingAWT extends UITestCase { final JPanel _jPanel2 = jPanel2; // visible test - Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow()); + Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParent()); int state = 0; while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) { diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java index 7920e7cd4..a4b8c183d 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java @@ -114,7 +114,7 @@ public class TestParenting02AWT extends UITestCase { Assert.assertNotNull(newtCanvasAWT); Assert.assertEquals(false, glWindow.isVisible()); Assert.assertEquals(false, glWindow.isNativeValid()); - Assert.assertNull(glWindow.getParentNativeWindow()); + Assert.assertNull(glWindow.getParent()); Frame frame = new Frame("AWT Parent Frame"); Assert.assertNotNull(frame); @@ -157,7 +157,7 @@ public class TestParenting02AWT extends UITestCase { } while(!glWindow.isNativeValid()) ; Assert.assertEquals(true, glWindow.isNativeValid()); - Assert.assertNotNull(glWindow.getParentNativeWindow()); + Assert.assertNotNull(glWindow.getParent()); if(verbose) { System.out.println("+++++++++++++++++++ 1st ADDED"); } @@ -168,7 +168,7 @@ public class TestParenting02AWT extends UITestCase { frame.remove(newtCanvasAWT); Assert.assertEquals(false, glWindow.isVisible()); Assert.assertEquals(true, glWindow.isNativeValid()); - Assert.assertNull(glWindow.getParentNativeWindow()); + Assert.assertNull(glWindow.getParent()); if(verbose) { System.out.println("+++++++++++++++++++ REMOVED!"); } @@ -179,7 +179,7 @@ public class TestParenting02AWT extends UITestCase { glWindow.display(); Assert.assertEquals(true, glWindow.isVisible()); Assert.assertEquals(true, glWindow.isNativeValid()); - Assert.assertNotNull(glWindow.getParentNativeWindow()); + Assert.assertNotNull(glWindow.getParent()); if(verbose) { System.out.println("+++++++++++++++++++ 2nd ADDED"); } @@ -216,7 +216,7 @@ public class TestParenting02AWT extends UITestCase { } Thread.sleep(waitReparent); - glWindow.destroy(); + glWindow.destroy(true); if(useLayout) { frame.remove(newtCanvasAWT); } diff --git a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java index 38998e854..a167766f5 100644 --- a/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java +++ b/src/junit/com/jogamp/test/junit/util/AWTRobotUtil.java @@ -74,8 +74,10 @@ public class AWTRobotUtil { y0 = (int) ( p0.getY() + r0.getHeight() / 2.0 + .5 ) ; } } else { - x0 = win.getX() + win.getWidth() / 2 ; - y0 = win.getY() + win.getHeight() / 2 ; + javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null); + p0.translate(win.getWidth()/2, win.getHeight()/2); + x0 = p0.getX(); + y0 = p0.getY(); } return new Point(x0, y0); |