diff options
author | Sven Gothel <[email protected]> | 2010-11-16 10:36:28 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2010-11-16 10:36:28 +0100 |
commit | db4d7d198cc826bba871fea39461c3c8a2a3b1c6 (patch) | |
tree | 723c5d4958df50a2ca7443171873e6f854c745a5 /src/junit | |
parent | b3420aeb07f9bef1e4fe5f436524d0b3d66cfaa2 (diff) |
NEWT Lifecycle remodel: Window destroy() !
NEWT's removed:
Window: destoy(boolean unrecoverable)
Display/Screen: get/set DestroyWhenUnused(boolean)
We behave as follows:
- Window.destroy() always decr Screen's reference counter,
which issues destruction when reached zero.
Then Screen does the same for Display ..
- Window.destroy() keeps alive all references,
hence it can be always recreated via setVisible(true).
- Window.destroy() ensures Display's EDT is stopped
if display is destroyed.
- Window.invalidate() actually removes all Object reference,
hence it cannot be recreated or used after it.
This method exist to support a way to cleanup memory, GC.
All test passed on Linux/X11 and Windows
Diffstat (limited to 'src/junit')
27 files changed, 202 insertions, 277 deletions
diff --git a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java index 0c64cfdf2..860a181a4 100644 --- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java @@ -150,7 +150,7 @@ public class TestGLProfile01NEWT extends UITestCase { glWindow.setSize(128, 128); glWindow.setVisible(true); glWindow.display(); - glWindow.destroy(true); + glWindow.invalidate(); } public static void main(String args[]) throws IOException { diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java index f88d4d16f..d83deea4b 100644 --- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNEWT.java @@ -101,7 +101,7 @@ public class TestGearsNEWT extends UITestCase { } animator.stop(); - glWindow.destroy(true); + glWindow.invalidate(); } @Test diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java index c965d5c21..ef4b657fc 100644 --- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java +++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/newt/TestGearsNewtAWTWrapper.java @@ -89,7 +89,7 @@ public class TestGearsNewtAWTWrapper extends UITestCase { } animator.stop(); - glWindow.destroy(true); + glWindow.invalidate(); } @Test 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 95db913ab..9b6194ca6 100644 --- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java +++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java @@ -145,7 +145,7 @@ public class TestDrawable01NEWT extends UITestCase { // GLWindow.destroy(..) sequence cont.. Assert.assertNotNull(window); - window.destroy(true); // incl screen + display + window.invalidate(); drawable = null; context = null; diff --git a/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java index 79d899b6c..8f56f6f46 100644 --- a/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java +++ b/src/junit/com/jogamp/test/junit/jogl/newt/TestSwingAWTRobotUsageBeforeJOGLInitBug411.java @@ -265,10 +265,10 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { anim1.start(); runTestGL(newtCanvasAWT, win1); - win0.destroy(true); + win0.destroy(); Assert.assertEquals(false, anim0.isAnimating()); - newtCanvasAWT.destroy(true); + newtCanvasAWT.destroy(); Assert.assertEquals(false, anim1.isAnimating()); System.err.println("TestSwingAWTRobotUsageBeforeJOGLInitBug411.test01NewtCanvasAWT(): End"); @@ -303,7 +303,7 @@ public class TestSwingAWTRobotUsageBeforeJOGLInitBug411 extends UITestCase { Assert.assertEquals(false, anim1.isAnimating()); /** - win0.destroy(true); + win0.destroy(); Assert.assertEquals(false, anim0.isAnimating()); */ diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java index 44b4e7325..94f915834 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java @@ -92,7 +92,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { return glWindow; } - private void testDisplayCreate01(Display display, Screen screen, boolean destroyWhenUnused) throws InterruptedException { + private void testDisplayCreate01(Display display, Screen screen) throws InterruptedException { // start-state == end-state Assert.assertEquals(0,Display.getActiveDisplayNumber()); Assert.assertEquals(0,display.getReferenceCount()); @@ -102,13 +102,6 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); - // Setup/Verify default DestroyWhenUnused behavior - if(destroyWhenUnused) { - screen.setDestroyWhenUnused(true); - } - Assert.assertEquals(destroyWhenUnused,display.getDestroyWhenUnused()); - Assert.assertEquals(destroyWhenUnused,screen.getDestroyWhenUnused()); - // Create Window, pending lazy native creation GLWindow window = createWindow(screen, caps, width, height); Assert.assertEquals(screen,window.getScreen()); @@ -118,6 +111,9 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(true,display.getEDTUtil().isRunning()); Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); + + Assert.assertNotNull(window.getScreen()); + Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -163,16 +159,17 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { } System.err.println("duration: "+window.getDuration()); - // recoverable destruction, ie Display/Screen untouched - window.destroy(false); + // destruction .. + window.destroy(); Assert.assertEquals(screen,window.getScreen()); - Assert.assertEquals(1,Display.getActiveDisplayNumber()); - Assert.assertEquals(1,display.getReferenceCount()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(0,Display.getActiveDisplayNumber()); + Assert.assertEquals(0,display.getReferenceCount()); + Assert.assertEquals(false,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); - Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(1,screen.getReferenceCount()); - Assert.assertEquals(true,screen.isNativeValid()); + Assert.assertEquals(false,display.getEDTUtil().isRunning()); + Assert.assertEquals(0,screen.getReferenceCount()); + Assert.assertEquals(false,screen.isNativeValid()); + Assert.assertEquals(true, window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); window.resetCounter(); @@ -205,35 +202,9 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { } System.err.println("duration: "+window.getDuration()); - // unrecoverable destruction, ie Display/Screen will be unreferenced - window.destroy(true); - Assert.assertEquals(null,window.getScreen()); + // destruction .. + window.destroy(); display.dumpDisplayList("Post destroy(true)"); - if(!destroyWhenUnused) { - // display/screen untouched when unused, default - Assert.assertEquals(1,Display.getActiveDisplayNumber()); - Assert.assertEquals(1,display.getReferenceCount()); - Assert.assertEquals(true,display.isNativeValid()); - Assert.assertNotNull(display.getEDTUtil()); - Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(0,screen.getReferenceCount()); - Assert.assertEquals(true,screen.isNativeValid()); - - // manual destruction: Screen - screen.destroy(); - Assert.assertEquals(1,Display.getActiveDisplayNumber()); - Assert.assertEquals(0,display.getReferenceCount()); - Assert.assertEquals(true,display.isNativeValid()); - Assert.assertNotNull(display.getEDTUtil()); - Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(0,screen.getReferenceCount()); - Assert.assertEquals(false,screen.isNativeValid()); - - // manual destruction: Display - display.destroy(); - } else { - // display/screen destroyed when unused - } // end-state == start-state Assert.assertEquals(0,Display.getActiveDisplayNumber()); @@ -244,32 +215,21 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); + Assert.assertNotNull(window.getScreen()); + Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); } @Test - public void testDisplayCreate01_DestroyWhenUnused_False() throws InterruptedException { - Assert.assertEquals(0,Display.getActiveDisplayNumber()); - - // Create Display/Screen, pending lazy native creation - Display display = NewtFactory.createDisplay(null); - Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - testDisplayCreate01(display, screen, false); - testDisplayCreate01(display, screen, false); - - Assert.assertEquals(0,Display.getActiveDisplayNumber()); - } - - @Test - public void testDisplayCreate01_DestroyWhenUnused_True() throws InterruptedException { + public void testDisplayCreate01_AutoDestroyLifecycle() throws InterruptedException { Assert.assertEquals(0,Display.getActiveDisplayNumber()); // Create Display/Screen, pending lazy native creation Display display = NewtFactory.createDisplay(null); Screen screen = NewtFactory.createScreen(display, 0); // screen 0 - testDisplayCreate01(display, screen, true); - testDisplayCreate01(display, screen, true); + testDisplayCreate01(display, screen); + testDisplayCreate01(display, screen); Assert.assertEquals(0,Display.getActiveDisplayNumber()); } @@ -298,17 +258,7 @@ public class TestDisplayLifecycle01NEWT extends UITestCase { } System.err.println("durationPerTest: "+durationPerTest); String tstname = TestDisplayLifecycle01NEWT.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); + org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java index 7253b7353..9fc6e3bc9 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle02NEWT.java @@ -94,9 +94,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Screen screen = window.getScreen(); Display display = screen.getDisplay(); - Assert.assertEquals(true,display.getDestroyWhenUnused()); - Assert.assertEquals(true,screen.getDestroyWhenUnused()); - Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); Assert.assertEquals(0,display.getReferenceCount()); @@ -151,19 +148,22 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { } System.err.println("duration: "+window.getDuration()); - // recoverable destruction, ie Display/Screen untouched - window.destroy(false); + // destruction.. ref count down, but keep all + window.destroy(); Assert.assertEquals(screen,window.getScreen()); - Assert.assertEquals(1,Display.getActiveDisplayNumber()); - Assert.assertEquals(1,display.getReferenceCount()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(0,Display.getActiveDisplayNumber()); + Assert.assertEquals(0,display.getReferenceCount()); + Assert.assertEquals(false,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); - Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(1,Screen.getActiveScreenNumber()); - Assert.assertEquals(1,screen.getReferenceCount()); - Assert.assertEquals(true,screen.isNativeValid()); + Assert.assertEquals(false,display.getEDTUtil().isRunning()); + Assert.assertEquals(0,Screen.getActiveScreenNumber()); + Assert.assertEquals(0,screen.getReferenceCount()); + Assert.assertEquals(false,screen.isNativeValid()); + Assert.assertNotNull(window.getScreen()); + Assert.assertEquals(true,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); + window.resetCounter(); Assert.assertEquals(0, window.getTotalFrames()); @@ -179,6 +179,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(screen,window.getScreen()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); Assert.assertEquals(1,display.getReferenceCount()); + Assert.assertEquals(true,window.isValid()); Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,display.getEDTUtil().isRunning()); Assert.assertEquals(1,Screen.getActiveScreenNumber()); @@ -195,9 +196,10 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { } System.err.println("duration: "+window.getDuration()); - // unrecoverable destruction, ie Display/Screen will be unreferenced - window.destroy(true); - Assert.assertEquals(null,window.getScreen()); + // destruction + invalidate, ie Display/Screen will be unreferenced + window.invalidate(); + Assert.assertNull(window.getScreen()); + Assert.assertEquals(false,window.isValid()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -240,9 +242,6 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertSame(display, window2.getScreen().getDisplay()); window2.setPosition(screen.getWidth()-width, 0); - Assert.assertEquals(true,display.getDestroyWhenUnused()); - Assert.assertEquals(true,screen.getDestroyWhenUnused()); - Assert.assertEquals(0,Display.getActiveDisplayNumber()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -297,9 +296,10 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(true,window1.isNativeValid()); Assert.assertEquals(false,window1.isVisible()); - // unrecoverable destruction, ie Display/Screen will be unreferenced - window1.destroy(true); - Assert.assertEquals(null,window1.getScreen()); + // destruction ... + window1.destroy(); + Assert.assertNotNull(window1.getScreen()); + Assert.assertEquals(true,window1.isValid()); Assert.assertEquals(false,window1.isNativeValid()); Assert.assertEquals(false,window1.isVisible()); @@ -312,9 +312,10 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(1,screen.getReferenceCount()); Assert.assertEquals(true,screen.isNativeValid()); - // unrecoverable destruction, ie Display/Screen will be unreferenced - window2.destroy(true); - Assert.assertEquals(null,window2.getScreen()); + // destruction + window2.destroy(); + Assert.assertNotNull(window2.getScreen()); + Assert.assertEquals(true,window2.isValid()); Assert.assertEquals(false,window2.isNativeValid()); Assert.assertEquals(false,window2.isVisible()); @@ -328,6 +329,20 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { Assert.assertEquals(0,screen.getReferenceCount()); Assert.assertEquals(false,screen.isNativeValid()); + // invalidate .. remove all refs + window1.invalidate(); + Assert.assertNull(window1.getScreen()); + Assert.assertEquals(false,window1.isValid()); + Assert.assertEquals(false,window1.isNativeValid()); + Assert.assertEquals(false,window1.isVisible()); + + // invalidate .. remove all refs + window2.invalidate(); + Assert.assertNull(window2.getScreen()); + Assert.assertEquals(false,window2.isValid()); + Assert.assertEquals(false,window2.isNativeValid()); + Assert.assertEquals(false,window2.isVisible()); + } @Test @@ -365,17 +380,7 @@ public class TestDisplayLifecycle02NEWT extends UITestCase { } System.err.println("durationPerTest: "+durationPerTest); String tstname = TestDisplayLifecycle02NEWT.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); + org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java b/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java index 8776b7be8..ff791b03a 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java +++ b/src/junit/com/jogamp/test/junit/newt/TestEventSourceNotAWTBug.java @@ -88,7 +88,7 @@ public class TestEventSourceNotAWTBug extends UITestCase { f_jf.dispose(); } }); - glWindow.destroy(true); + glWindow.invalidate(); } public static void main(String args[]) throws IOException { diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java index 762e906fc..d597af889 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus01SwingAWTRobot.java @@ -175,7 +175,7 @@ public class TestFocus01SwingAWTRobot extends UITestCase { // Shutdown the test. animator.stop(); frame1.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } static int atoi(String a) { diff --git a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java index 3ce6080a9..b96279cac 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java +++ b/src/junit/com/jogamp/test/junit/newt/TestFocus02SwingAWTRobot.java @@ -261,7 +261,7 @@ public class TestFocus02SwingAWTRobot extends UITestCase { _jFrame1.dispose(); } }); - glWindow1.destroy(true); + glWindow1.invalidate(); } @Test diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows00NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows00NEWT.java index 5568f2e1a..d28dd2c11 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows00NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows00NEWT.java @@ -87,8 +87,9 @@ public class TestGLWindows00NEWT extends UITestCase { static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.destroy(true); + glWindow.invalidate(); Assert.assertEquals(false,glWindow.isNativeValid()); + Assert.assertEquals(false,glWindow.isValid()); } } diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java index 279f2c370..934d75f7c 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java @@ -71,15 +71,11 @@ public class TestGLWindows01NEWT extends UITestCase { // GLWindow glWindow; if(null!=screen) { - boolean destroyWhenUnused = screen.getDestroyWhenUnused(); - Assert.assertEquals(destroyWhenUnused, screen.getDisplay().getDestroyWhenUnused()); glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); - Assert.assertEquals(destroyWhenUnused, glWindow.getScreen().getDestroyWhenUnused()); } else { glWindow = GLWindow.create(caps); Assert.assertNotNull(glWindow); - Assert.assertTrue(glWindow.getScreen().getDestroyWhenUnused()); } glWindow.setUndecorated(onscreen && undecorated); @@ -121,18 +117,11 @@ public class TestGLWindows01NEWT extends UITestCase { return glWindow; } - static void destroyWindow(GLWindow glWindow, Screen screen, Display display, boolean unrecoverable) { + static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.destroy(unrecoverable); + glWindow.invalidate(); Assert.assertEquals(false,glWindow.isNativeValid()); - } - if(null!=screen) { - screen.destroy(); - Assert.assertEquals(false,screen.isNativeValid()); - } - if(null!=display) { - display.destroy(); - Assert.assertEquals(false,display.isNativeValid()); + Assert.assertEquals(false,glWindow.isValid()); } } @@ -146,7 +135,7 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - window.destroy(false); + window.destroy(); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -162,7 +151,7 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); - destroyWindow(window, null, null, true); + destroyWindow(window); } @Test @@ -175,7 +164,7 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - window.destroy(false); + window.destroy(); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); @@ -191,7 +180,7 @@ public class TestGLWindows01NEWT extends UITestCase { Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(false,window.isVisible()); - destroyWindow(window, null, null, true); + destroyWindow(window); } @Test @@ -207,7 +196,7 @@ public class TestGLWindows01NEWT extends UITestCase { Thread.sleep(100); } System.out.println("duration: "+window.getDuration()); - destroyWindow(window, null, null, true); + destroyWindow(window); } @Test @@ -223,7 +212,7 @@ public class TestGLWindows01NEWT extends UITestCase { Thread.sleep(100); } System.out.println("duration: "+window.getDuration()); - destroyWindow(window, null, null, true); + destroyWindow(window); } @Test @@ -238,8 +227,7 @@ public class TestGLWindows01NEWT extends UITestCase { Thread.sleep(100); } System.out.println("duration: "+window.getDuration()); - destroyWindow(window, null, null, false); - destroyWindow(window, null, null, true); + destroyWindow(window); } @Test @@ -249,7 +237,6 @@ public class TestGLWindows01NEWT extends UITestCase { Display display = NewtFactory.createDisplay(null); // local display Assert.assertNotNull(display); - display.setDestroyWhenUnused(true); Screen screen = NewtFactory.createScreen(display, 0); // screen 0 Assert.assertNotNull(screen); @@ -279,8 +266,8 @@ public class TestGLWindows01NEWT extends UITestCase { System.out.println("duration1: "+window1.getDuration()); System.out.println("duration2: "+window2.getDuration()); - destroyWindow(window1, null, null, true); - destroyWindow(window2, null, null, true); + destroyWindow(window1); + destroyWindow(window2); Assert.assertEquals(0,Display.getActiveDisplayNumber()); @@ -300,10 +287,8 @@ public class TestGLWindows01NEWT extends UITestCase { Display display1 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display1); - display1.setDestroyWhenUnused(true); Display display2 = NewtFactory.createDisplay(null, false); // local display Assert.assertNotNull(display2); - display2.setDestroyWhenUnused(true); Assert.assertNotSame(display1, display2); Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0 @@ -349,8 +334,8 @@ public class TestGLWindows01NEWT extends UITestCase { // opening them, otherwise some driver related bug appears. // You may test this, ie just reverse the destroy order below. // See also native test: jogl/test/native/displayMultiple02.c - destroyWindow(window1, null, null, true); - destroyWindow(window2, null, null, true); + destroyWindow(window1); + destroyWindow(window2); Assert.assertEquals(0,Display.getActiveDisplayNumber()); @@ -393,17 +378,7 @@ public class TestGLWindows01NEWT extends UITestCase { } System.out.println("durationPerTest: "+durationPerTest); String tstname = TestGLWindows01NEWT.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); + org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java index a6809e0bd..78b9773a8 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java +++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java @@ -114,9 +114,9 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { return glWindow; } - static void destroyWindow(GLWindow glWindow, boolean deep) { + static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.destroy(deep); + glWindow.destroy(); } } @@ -130,7 +130,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { while(animator.isAnimating() && animator.getDuration()<durationPerTest) { Thread.sleep(100); } - destroyWindow(window, true); + destroyWindow(window); Assert.assertEquals(false, animator.isAnimating()); } @@ -144,8 +144,8 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { while(animator.isAnimating() && animator.getDuration()<durationPerTest) { Thread.sleep(100); } - destroyWindow(window, false); - destroyWindow(window, true); + destroyWindow(window); + destroyWindow(window); Assert.assertEquals(false, animator.isAnimating()); } @@ -175,10 +175,10 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } - destroyWindow(window1, true); + destroyWindow(window1); Assert.assertEquals(false, animator1.isAnimating()); - destroyWindow(window2, true); + destroyWindow(window2); Assert.assertEquals(false, animator2.isAnimating()); } @Test @@ -212,10 +212,10 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { Thread.sleep(100); } - destroyWindow(window1, true); + destroyWindow(window1); Assert.assertEquals(false, animator1.isAnimating()); - destroyWindow(window2, true); + destroyWindow(window2); Assert.assertEquals(false, animator2.isAnimating()); } @@ -242,17 +242,7 @@ public class TestGLWindows02NEWTAnimated extends UITestCase { } } String tstname = TestGLWindows02NEWTAnimated.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); + org.junit.runner.JUnitCore.main(tstname); } } diff --git a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java index 39eb47ca9..4407ffef1 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java @@ -119,7 +119,7 @@ public class TestListenerCom01AWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow.destroy(true); + glWindow.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/junit/com/jogamp/test/junit/newt/TestRemoteGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestRemoteGLWindows01NEWT.java index 623651f2d..fc5327c9d 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestRemoteGLWindows01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestRemoteGLWindows01NEWT.java @@ -88,8 +88,9 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { static void destroyWindow(GLWindow glWindow) { if(null!=glWindow) { - glWindow.destroy(true); + glWindow.invalidate(); Assert.assertEquals(false,glWindow.isNativeValid()); + Assert.assertEquals(false,glWindow.isValid()); } } @@ -109,7 +110,6 @@ public class TestRemoteGLWindows01NEWT extends UITestCase { // Eager initialization of NEWT Display -> AbstractGraphicsDevice -> GLProfile (device) Display display2 = NewtFactory.createDisplay("charelle:0.0"); // remote display - display2.setDestroyWhenUnused(true); try { display2.createNative(); } catch (NativeWindowException nwe) { diff --git a/src/junit/com/jogamp/test/junit/newt/TestScreenMode00NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestScreenMode00NEWT.java index 06911e82b..9f39274c5 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestScreenMode00NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestScreenMode00NEWT.java @@ -120,9 +120,12 @@ public class TestScreenMode00NEWT extends UITestCase { Assert.assertNotNull(sm_c); System.err.println("orig: "+sm_o); System.err.println("curr: "+sm_c); + } else { + // no support .. + System.err.println("Your platform has no ScreenMode change support, sorry"); } - window.destroy(true); + window.invalidate(); Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); diff --git a/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java index fe17857ef..de4def2fa 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestScreenMode01NEWT.java @@ -72,26 +72,18 @@ public class TestScreenMode01NEWT extends UITestCase { Assert.assertNotNull(caps); caps.setOnscreen(onscreen); - boolean destroyWhenUnused = screen.getDestroyWhenUnused(); GLWindow window = GLWindow.create(screen, caps); window.setSize(width, height); window.addGLEventListener(new Gears()); Assert.assertNotNull(window); - Assert.assertEquals(destroyWhenUnused, window.getScreen().getDestroyWhenUnused()); window.setVisible(true); return window; } - static void destroyWindow(Display display, Screen screen, Window window) { + static void destroyWindow(Window window) { if(null!=window) { window.destroy(); } - if(null!=screen) { - screen.destroy(); - } - if(null!=display) { - display.destroy(); - } } @Test @@ -118,7 +110,7 @@ public class TestScreenMode01NEWT extends UITestCase { Thread.sleep(waitTimeShort); animator.stop(); - destroyWindow(display, screen, window); + destroyWindow(window); } @Test @@ -137,7 +129,8 @@ public class TestScreenMode01NEWT extends UITestCase { List screenModes = screen.getScreenModes(); if(null==screenModes) { // no support .. - destroyWindow(display, screen, window); + System.err.println("Your platform has no ScreenMode change support, sorry"); + destroyWindow(window); return; } Assert.assertTrue(screenModes.size()>0); @@ -183,15 +176,14 @@ public class TestScreenMode01NEWT extends UITestCase { Assert.assertEquals(true,window.isVisible()); animator.stop(); - destroyWindow(null, screen, window); + destroyWindow(window); Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,screen.isNativeValid()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(false,display.isNativeValid()); - screen = NewtFactory.createScreen(display, 0); // screen 0 - screen.addReference(); // trigger native creation + screen.createNative(); // trigger native re-creation Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); @@ -202,7 +194,7 @@ public class TestScreenMode01NEWT extends UITestCase { Assert.assertNotNull(smCurrent); Assert.assertEquals(saveOrigMode, smOrig); - destroyWindow(display, screen, null); + screen.destroy(); Assert.assertEquals(false,screen.isNativeValid()); Assert.assertEquals(false,display.isNativeValid()); @@ -236,7 +228,7 @@ public class TestScreenMode01NEWT extends UITestCase { List screenModes = screen.getScreenModes(); if(null==screenModes) { // no support .. - destroyWindow(display, screen, window); + destroyWindow(window); return; } Assert.assertTrue(screenModes.size()>0); @@ -272,10 +264,9 @@ public class TestScreenMode01NEWT extends UITestCase { ScreenMode saveOrigMode = (ScreenMode) smOrig.clone(); animator.stop(); - destroyWindow(null, screen, window); + destroyWindow(window); - screen = NewtFactory.createScreen(display, 0); // screen 0 - screen.addReference(); // trigger native creation + screen.createNative(); // trigger native re-creation ScreenMode smCurrent = screen.getCurrentScreenMode(); System.err.println("[1] current/orig: "+smCurrent); @@ -283,7 +274,7 @@ public class TestScreenMode01NEWT extends UITestCase { Assert.assertNotNull(smCurrent); Assert.assertEquals(saveOrigMode, smOrig); - destroyWindow(display, screen, null); + screen.destroy(); } public static void main(String args[]) throws IOException { diff --git a/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java index 98c8fd58c..011af6330 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestScreenMode02NEWT.java @@ -70,26 +70,19 @@ public class TestScreenMode02NEWT extends UITestCase { Assert.assertNotNull(caps); caps.setOnscreen(onscreen); - boolean destroyWhenUnused = screen.getDestroyWhenUnused(); GLWindow window = GLWindow.create(screen, caps); window.setSize(width, height); window.addGLEventListener(new Gears()); Assert.assertNotNull(window); - Assert.assertEquals(destroyWhenUnused, window.getScreen().getDestroyWhenUnused()); window.setVisible(true); + Assert.assertTrue(window.isVisible()); return window; } - static void destroyWindow(Display display, Screen screen, Window window) { + static void destroyWindow(Window window) { if(null!=window) { window.destroy(); } - if(null!=screen) { - screen.destroy(); - } - if(null!=display) { - display.destroy(); - } } @Test @@ -108,7 +101,8 @@ public class TestScreenMode02NEWT extends UITestCase { List screenModes = screen.getScreenModes(); if(null==screenModes) { // no support .. - destroyWindow(display, screen, window); + System.err.println("Your platform has no ScreenMode change support, sorry"); + destroyWindow(window); return; } Assert.assertTrue(screenModes.size()>0); @@ -129,7 +123,8 @@ public class TestScreenMode02NEWT extends UITestCase { screenModes = ScreenModeUtil.filterByRotation(screenModes, 90); if(null==screenModes) { // no rotation support .. - destroyWindow(display, screen, window); + System.err.println("Your platform has no rotation support, sorry"); + destroyWindow(window); return; } Assert.assertTrue(screenModes.size()>0); @@ -158,15 +153,14 @@ public class TestScreenMode02NEWT extends UITestCase { Assert.assertEquals(true,window.isVisible()); animator.stop(); - destroyWindow(null, screen, window); + destroyWindow(window); Assert.assertEquals(false,window.isVisible()); Assert.assertEquals(false,window.isNativeValid()); Assert.assertEquals(false,screen.isNativeValid()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(false,display.isNativeValid()); - screen = NewtFactory.createScreen(display, 0); // screen 0 - screen.addReference(); // trigger native creation + screen.createNative(); // trigger native re-creation Assert.assertEquals(true,display.isNativeValid()); Assert.assertEquals(true,screen.isNativeValid()); @@ -177,7 +171,7 @@ public class TestScreenMode02NEWT extends UITestCase { Assert.assertNotNull(smCurrent); Assert.assertEquals(saveOrigMode, smOrig); - destroyWindow(display, screen, null); + screen.destroy(); Assert.assertEquals(false,screen.isNativeValid()); Assert.assertEquals(false,display.isNativeValid()); diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java index 88edd89ba..706ad5192 100644 --- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java @@ -173,17 +173,7 @@ public class TestWindows01NEWT extends UITestCase { public static void main(String args[]) throws IOException { String tstname = TestWindows01NEWT.class.getName(); - org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] { - tstname, - "filtertrace=true", - "haltOnError=false", - "haltOnFailure=false", - "showoutput=true", - "outputtoformatters=true", - "logfailedtests=true", - "logtestlistenerevents=true", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter", - "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+".xml" } ); + org.junit.runner.JUnitCore.main(tstname); } } 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 b9182dbaa..1f45c6c1d 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java @@ -78,7 +78,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertNull(glWindow1.getParent()); screen = glWindow1.getScreen(); display = screen.getDisplay(); - Assert.assertEquals(true,display.getDestroyWhenUnused()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); @@ -105,7 +104,6 @@ public class TestParenting01NEWT extends UITestCase { setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); - Assert.assertEquals(true,display.getDestroyWhenUnused()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); @@ -226,7 +224,7 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(2,screen.getReferenceCount()); + Assert.assertEquals(1,screen.getReferenceCount()); Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); @@ -238,13 +236,13 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(true, glWindow2.isValid()); - Assert.assertEquals(1,display.getReferenceCount()); - Assert.assertEquals(true,display.isNativeValid()); + Assert.assertEquals(0,display.getReferenceCount()); + Assert.assertEquals(false,display.isNativeValid()); Assert.assertNotNull(display.getEDTUtil()); - Assert.assertEquals(true,display.getEDTUtil().isRunning()); - Assert.assertEquals(2,screen.getReferenceCount()); - Assert.assertEquals(true,screen.isNativeValid()); - Assert.assertEquals(1,Display.getActiveDisplayNumber()); + Assert.assertEquals(false,display.getEDTUtil().isRunning()); + Assert.assertEquals(0,screen.getReferenceCount()); + Assert.assertEquals(false,screen.isNativeValid()); + Assert.assertEquals(0,Display.getActiveDisplayNumber()); // recreation .. glWindow1.resetCounter(); @@ -269,11 +267,11 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(1,Display.getActiveDisplayNumber()); - // cannot be recreated, will drop Display/Screen refs - glWindow1.destroy(true); - Assert.assertEquals(false, glWindow1.isValid()); + // chain glwindow1 -> glwindow2 ; can be recreated .. + glWindow1.destroy(); + Assert.assertEquals(true, glWindow1.isValid()); Assert.assertEquals(false, glWindow1.isNativeValid()); - Assert.assertEquals(false, glWindow2.isValid()); + Assert.assertEquals(true, glWindow2.isValid()); Assert.assertEquals(false, glWindow2.isNativeValid()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -283,9 +281,13 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); - // test double destroy .. - glWindow2.destroy(true); - Assert.assertEquals(false, glWindow2.isValid()); + glWindow1.invalidate(); + Assert.assertEquals(false, glWindow1.isValid()); + Assert.assertEquals(false, glWindow2.isValid()); + + // test double destroy/invalidate .. + glWindow2.invalidate(); + Assert.assertEquals(false, glWindow2.isValid()); Assert.assertEquals(0,display.getReferenceCount()); Assert.assertEquals(false,display.isNativeValid()); @@ -328,7 +330,6 @@ public class TestParenting01NEWT extends UITestCase { screen1 = glWindow1.getScreen(); display1 = screen1.getDisplay(); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(0,display1.getReferenceCount()); Assert.assertEquals(false,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -345,7 +346,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertSame(screen1, glWindow2.getScreen()); Assert.assertSame(display1, glWindow2.getScreen().getDisplay()); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(0,display1.getReferenceCount()); Assert.assertEquals(false,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -442,6 +442,10 @@ public class TestParenting01NEWT extends UITestCase { } state++; } + // + // both windows are now top level + // + animator1.stop(); Assert.assertEquals(false, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); @@ -461,9 +465,13 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); // destroy glWindow2 - glWindow2.destroy(true); + glWindow2.destroy(); Assert.assertEquals(true, glWindow1.isValid()); - Assert.assertEquals(false, glWindow2.isValid()); + Assert.assertEquals(true, glWindow1.isNativeValid()); + Assert.assertEquals(true, glWindow1.isVisible()); + Assert.assertEquals(true, glWindow2.isValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); + Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); @@ -475,9 +483,13 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); // destroy glWindow1 - glWindow1.destroy(true); - Assert.assertEquals(false, glWindow1.isValid()); - Assert.assertEquals(false, glWindow2.isValid()); + glWindow1.destroy(); + Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(false, glWindow1.isNativeValid()); + Assert.assertEquals(false, glWindow1.isVisible()); + Assert.assertEquals(true, glWindow2.isValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); + Assert.assertEquals(false, glWindow2.isVisible()); Assert.assertEquals(0,display1.getReferenceCount()); Assert.assertEquals(false,display1.isNativeValid()); @@ -487,6 +499,13 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false,screen1.isNativeValid()); Assert.assertEquals(0,Display.getActiveDisplayNumber()); + + glWindow1.invalidate(); + Assert.assertEquals(false, glWindow1.isValid()); + Assert.assertEquals(true, glWindow2.isValid()); + + glWindow2.invalidate(); + Assert.assertEquals(false, glWindow2.isValid()); } @Test @@ -520,7 +539,6 @@ public class TestParenting01NEWT extends UITestCase { setDemoFields(demo1, glWindow1, false); glWindow1.addGLEventListener(demo1); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(0,display1.getReferenceCount()); Assert.assertEquals(false,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -537,7 +555,6 @@ public class TestParenting01NEWT extends UITestCase { setDemoFields(demo2, glWindow2, false); glWindow2.addGLEventListener(demo2); - Assert.assertEquals(true,display2.getDestroyWhenUnused()); Assert.assertEquals(0,display2.getReferenceCount()); Assert.assertEquals(false,display2.isNativeValid()); Assert.assertNotNull(display2.getEDTUtil()); @@ -556,7 +573,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertTrue(0 < glWindow2.getTotalFrames()); Assert.assertTrue(0 < glWindow1.getTotalFrames()); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -606,6 +622,10 @@ public class TestParenting01NEWT extends UITestCase { } state++; } + // + // glwindow2 is child of glwindow1 + // + animator1.stop(); Assert.assertEquals(false, animator1.isAnimating()); Assert.assertEquals(false, animator1.isPaused()); @@ -615,7 +635,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(false, animator2.isPaused()); Assert.assertEquals(null, animator2.getThread()); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(1,display1.getReferenceCount()); Assert.assertEquals(true,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -627,11 +646,14 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(1,Display.getActiveDisplayNumber()); - glWindow1.destroy(true); // should destroy both windows, actually, since glWindow2 is a child - Assert.assertEquals(false, glWindow1.isValid()); - Assert.assertEquals(false, glWindow2.isValid()); + glWindow1.destroy(); // should destroy both windows, actually, since glWindow2 is a child + Assert.assertEquals(true, glWindow1.isValid()); + Assert.assertEquals(false, glWindow1.isNativeValid()); + Assert.assertEquals(false, glWindow1.isVisible()); + Assert.assertEquals(true, glWindow2.isValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); + Assert.assertEquals(false, glWindow2.isVisible()); - Assert.assertEquals(true,display1.getDestroyWhenUnused()); Assert.assertEquals(0,display1.getReferenceCount()); Assert.assertEquals(false,display1.isNativeValid()); Assert.assertNotNull(display1.getEDTUtil()); @@ -639,7 +661,6 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0,screen1.getReferenceCount()); Assert.assertEquals(false,screen1.isNativeValid()); - Assert.assertEquals(true,display2.getDestroyWhenUnused()); Assert.assertEquals(0,display2.getReferenceCount()); Assert.assertEquals(false,display2.isNativeValid()); Assert.assertNotNull(display2.getEDTUtil()); @@ -649,7 +670,11 @@ public class TestParenting01NEWT extends UITestCase { Assert.assertEquals(0,Display.getActiveDisplayNumber()); - glWindow2.destroy(true); + glWindow2.destroy(); // dbl destroy check .. + Assert.assertEquals(false, glWindow1.isNativeValid()); + Assert.assertEquals(false, glWindow2.isNativeValid()); + + glWindow1.invalidate(); // parent -> child Assert.assertEquals(false, glWindow1.isValid()); Assert.assertEquals(false, glWindow2.isValid()); @@ -698,3 +723,4 @@ public class TestParenting01NEWT extends UITestCase { } } + 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 931cf2d5f..2c3455cb0 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java @@ -143,7 +143,7 @@ public class TestParenting01aAWT extends UITestCase { frame1.dispose(); Assert.assertEquals(true, glWindow1.isValid()); - glWindow1.destroy(true); + glWindow1.invalidate(); //Assert.assertEquals(false, glWindow1.isValid()); } @@ -188,7 +188,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } @Test @@ -223,7 +223,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(true, animator1.isAnimating()); // !!! frame.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } @Test @@ -273,7 +273,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } @Test @@ -328,7 +328,7 @@ public class TestParenting01aAWT extends UITestCase { Assert.assertEquals(false, animator1.isAnimating()); frame.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } @Test @@ -393,7 +393,7 @@ public class TestParenting01aAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { 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 9eecf31a1..89cefa8b1 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java @@ -156,7 +156,7 @@ public class TestParenting01bAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { 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 2dcc7af9b..b79f4c57c 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java @@ -137,7 +137,7 @@ public class TestParenting01cAWT extends UITestCase { frame1.dispose(); Assert.assertEquals(true, glWindow1.isValid()); - glWindow1.destroy(true); + glWindow1.invalidate(); //Assert.assertEquals(false, glWindow1.isValid()); } @@ -196,7 +196,7 @@ public class TestParenting01cAWT extends UITestCase { frame1.dispose(); frame2.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { 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 3fc39a3f1..ec54a0f9e 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java @@ -189,7 +189,7 @@ public class TestParenting01cSwingAWT extends UITestCase { } }); Assert.assertEquals(true, glWindow1.isValid()); - glWindow1.destroy(true); + glWindow1.invalidate(); //Assert.assertEquals(false, glWindow1.isValid()); } @@ -324,7 +324,7 @@ public class TestParenting01cSwingAWT extends UITestCase { } }); Assert.assertEquals(true, glWindow1.isValid()); - glWindow1.destroy(true); + glWindow1.invalidate(); //Assert.assertEquals(false, glWindow1.isValid()); } 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 3311bc691..6c9e5b2b2 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java @@ -213,7 +213,7 @@ public class TestParenting02AWT extends UITestCase { } Thread.sleep(waitReparent); - glWindow.destroy(true); + glWindow.invalidate(); if(useLayout) { frame.remove(newtCanvasAWT); } diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java index 5fa7dee41..61086099c 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03AWT.java @@ -152,7 +152,7 @@ public class TestParenting03AWT extends UITestCase { Assert.assertEquals(null, animator1.getThread()); frame1.dispose(); - glWindow1.destroy(true); + glWindow1.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java index b4ced6973..a31e49b45 100644 --- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java +++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting03bAWT.java @@ -206,8 +206,8 @@ public class TestParenting03bAWT extends UITestCase { Assert.assertEquals(null, animator2.getThread()); frame1.dispose(); - glWindow1.destroy(true); - glWindow2.destroy(true); + glWindow1.invalidate(); + glWindow2.invalidate(); } public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) { |