aboutsummaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-09-23 16:30:25 +0200
committerSven Gothel <[email protected]>2010-09-23 16:30:25 +0200
commit1c02f0eeb539ff5de7259b822893ab63a9cc3ab0 (patch)
tree18710de3939537dd9835f6c43b9ddc9e253237a4 /src/junit
parent0feca163be47db2ea94f7546e696136d6f9496e9 (diff)
NEWT: Changed Lifecycle of Display/Screen (part 4) - Reparenting - Tests
- Adapted tests to API changes - Notably new Display lifecycle / Reparenting tests: - TestDisplayLifecycle01NEWT - Tests display lifecycle - TestParenting01NEWT - Tests various reparenting cases (native/recreate) - TestParenting01bAWT - Tests Animator/FPSAnimator with reparenting (AWT/Newt) - Other changes: - TestGearsNEWT: Added 'on-the-fly' KeyAdapter inducing a GLRunnable into the GLWindow for fullscreen toggle. -
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java21
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java2
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java12
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java34
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java97
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java12
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java3
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java1
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java373
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java8
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java34
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java14
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java2
-rw-r--r--src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java5
19 files changed, 488 insertions, 142 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 2c43fbe66..12e016654 100644
--- a/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/acore/TestGLProfile01NEWT.java
@@ -141,7 +141,7 @@ public class TestGLProfile01NEWT {
protected void dumpVersion(GLProfile glp) {
GLCapabilities caps = new GLCapabilities(glp);
- GLWindow glWindow = GLWindow.create(caps, false);
+ GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("TestGLProfile01NEWT");
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
index 91eb6f4a0..2424ff381 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNEWT.java
@@ -64,7 +64,7 @@ public class TestGearsNEWT {
}
protected void runTestGL(GLCapabilities caps) throws InterruptedException {
- GLWindow glWindow = GLWindow.create(caps, false);
+ GLWindow glWindow = GLWindow.create(caps);
Assert.assertNotNull(glWindow);
glWindow.setTitle("Gears NEWT Test");
@@ -73,8 +73,23 @@ public class TestGearsNEWT {
Animator animator = new Animator(glWindow);
QuitAdapter quitAdapter = new QuitAdapter();
- glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
- glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ //glWindow.addKeyListener(new TraceKeyAdapter(quitAdapter));
+ //glWindow.addWindowListener(new TraceWindowAdapter(quitAdapter));
+ glWindow.addKeyListener(quitAdapter);
+ glWindow.addWindowListener(quitAdapter);
+
+ final GLWindow f_glWindow = glWindow;
+ glWindow.addKeyListener(new KeyAdapter() {
+ public void keyTyped(KeyEvent e) {
+ if(e.getKeyChar()=='f') {
+ f_glWindow.invoke(false, new GLRunnable() {
+ public void run(GLAutoDrawable drawable) {
+ GLWindow win = (GLWindow)drawable;
+ win.setFullscreen(!win.isFullscreen());
+ } });
+ }
+ }
+ });
glWindow.setSize(width, height);
glWindow.setVisible(true);
diff --git a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
index 42842936a..6ae3691d5 100644
--- a/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
+++ b/src/junit/com/jogamp/test/junit/jogl/demos/gl2/gears/TestGearsNewtAWTWrapper.java
@@ -67,7 +67,7 @@ public class TestGearsNewtAWTWrapper {
protected void runTestGL(GLCapabilities caps) throws InterruptedException {
Display nDisplay = NewtFactory.createDisplay(NativeWindowFactory.TYPE_AWT, null); // local display
Screen nScreen = NewtFactory.createScreen(NativeWindowFactory.TYPE_AWT, nDisplay, 0); // screen 0
- Window nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps, false);
+ Window nWindow = NewtFactory.createWindow(NativeWindowFactory.TYPE_AWT, nScreen, caps);
GLWindow glWindow = GLWindow.create(nWindow);
Assert.assertNotNull(glWindow);
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 cbcd07679..089d90362 100644
--- a/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/drawable/TestDrawable01NEWT.java
@@ -90,8 +90,9 @@ public class TestDrawable01NEWT {
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ window = NewtFactory.createWindow(screen, caps);
Assert.assertNotNull(window);
+ window.setUndecorated(onscreen && undecorated);
window.setSize(width, height);
window.setVisible(true);
// System.out.println("Created: "+window);
diff --git a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
index c90001f85..361d16613 100644
--- a/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/glsl/TestTransformFeedbackVeryingsBug407NEWT.java
@@ -60,7 +60,8 @@ public class TestTransformFeedbackVeryingsBug407NEWT {
Display display = NewtFactory.createDisplay(null); // local display
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
- window = NewtFactory.createWindow(screen, caps, true);
+ window = NewtFactory.createWindow(screen, caps);
+ window.setUndecorated(true);
window.setSize(800, 600);
window.setVisible(true);
diff --git a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
index 5324c2d82..9718374c7 100644
--- a/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/jogl/offscreen/TestOffscreen01NEWT.java
@@ -87,7 +87,7 @@ public class TestOffscreen01NEWT {
Assert.assertNotNull(display);
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window = NewtFactory.createWindow(screen, caps, false /* undecorated */);
+ Window window = NewtFactory.createWindow(screen, caps);
Assert.assertNotNull(window);
window.setSize(width, height);
GLWindow glWindow = GLWindow.create(window);
@@ -192,7 +192,7 @@ public class TestOffscreen01NEWT {
for(i=0; i<winnum; i++) {
System.out.println("Create Window "+i);
- windows[i] = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ windows[i] = NewtFactory.createWindow(screen, caps2);
Assert.assertNotNull(windows[i]);
windows[i].setSize(width, height);
glWindows[i] = GLWindow.create(windows[i]);
@@ -257,7 +257,7 @@ public class TestOffscreen01NEWT {
Assert.assertNotNull(displays[i]);
screens[i] = NewtFactory.createScreen(displays[i], 0); // screen 0
Assert.assertNotNull(screens[i]);
- windows[i] = NewtFactory.createWindow(screens[i], caps2, false /* undecorated */);
+ windows[i] = NewtFactory.createWindow(screens[i], caps2);
Assert.assertNotNull(windows[i]);
windows[i].setSize(width, height);
glWindows[i] = GLWindow.create(windows[i]);
@@ -316,7 +316,7 @@ public class TestOffscreen01NEWT {
Assert.assertNotNull(display);
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Window window = NewtFactory.createWindow(screen, caps2);
Assert.assertNotNull(window);
window.setSize(width, height);
GLWindow glWindow = GLWindow.create(window);
@@ -376,7 +376,7 @@ public class TestOffscreen01NEWT {
Assert.assertNotNull(display);
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Window window = NewtFactory.createWindow(screen, caps2);
Assert.assertNotNull(window);
window.setSize(width, height);
GLWindow glWindow = GLWindow.create(window);
@@ -431,7 +431,7 @@ public class TestOffscreen01NEWT {
Assert.assertNotNull(display);
Screen screen = NewtFactory.createScreen(display, 0); // screen 0
Assert.assertNotNull(screen);
- Window window = NewtFactory.createWindow(screen, caps2, false /* undecorated */);
+ Window window = NewtFactory.createWindow(screen, caps2);
Assert.assertNotNull(window);
window.setSize(width, height);
GLWindow glWindow = GLWindow.create(window);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
index f0ceba606..5999df173 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestDisplayLifecycle01NEWT.java
@@ -83,11 +83,11 @@ public class TestDisplayLifecycle01NEWT {
//
GLWindow glWindow;
if(null!=screen) {
- Window window = NewtFactory.createWindow(screen, caps, false);
+ Window window = NewtFactory.createWindow(screen, caps);
Assert.assertNotNull(window);
glWindow = GLWindow.create(window);
} else {
- glWindow = GLWindow.create(caps, false);
+ glWindow = GLWindow.create(caps);
}
GLEventListener demo = new Gears();
@@ -128,11 +128,12 @@ public class TestDisplayLifecycle01NEWT {
Assert.assertEquals(false,window.isVisible());
// lazy native creation sequence: Display, Screen and Window
+ Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
- window.display();
int wait=0;
while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.out.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -148,7 +149,7 @@ public class TestDisplayLifecycle01NEWT {
window.display();
Thread.sleep(100);
}
- System.out.println("duration: "+window.getDuration());
+ System.err.println("duration: "+window.getDuration());
// just make the Window invisible
window.setVisible(false);
@@ -156,15 +157,21 @@ public class TestDisplayLifecycle01NEWT {
Assert.assertEquals(false,window.isVisible());
// just make the Window visible again
+ window.resetPerfCounter();
+ Assert.assertEquals(0, window.getTotalFrames());
window.setVisible(true);
+ wait=0;
+ while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ System.err.println("Frames for setVisible(true) 1: "+window.getTotalFrames());
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
+ Assert.assertTrue(0 < window.getTotalFrames());
while(window.getDuration()<2*durationPerTest) {
window.display();
Thread.sleep(100);
}
- System.out.println("duration: "+window.getDuration());
+ System.err.println("duration: "+window.getDuration());
// recoverable destruction, ie Display/Screen untouched
window.destroy(false);
@@ -178,18 +185,21 @@ public class TestDisplayLifecycle01NEWT {
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
+ window.resetPerfCounter();
+ Assert.assertEquals(0, window.getTotalFrames());
// a display call shall not change a thing
window.display();
+ Assert.assertEquals(0, window.getTotalFrames());
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
// recover Window
window.setVisible(true);
- window.display();
wait=0;
while(wait<10 && window.getTotalFrames()<1) { Thread.sleep(100); wait++; }
- System.out.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
+ System.err.println("Frames for setVisible(true) 2: "+window.getTotalFrames());
+ Assert.assertTrue(0 < window.getTotalFrames());
Assert.assertEquals(screen,window.getScreen());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -205,12 +215,12 @@ public class TestDisplayLifecycle01NEWT {
window.display();
Thread.sleep(100);
}
- System.out.println("duration: "+window.getDuration());
+ System.err.println("duration: "+window.getDuration());
// unrecoverable destruction, ie Display/Screen will be unreferenced
window.destroy(true);
Assert.assertEquals(null,window.getScreen());
- Display.dumpDisplayList("Post destroy(true)");
+ display.dumpDisplayList("Post destroy(true)");
if(!destroyWhenUnused) {
// display/screen untouched when unused, default
Assert.assertEquals(1,Display.getActiveDisplayNumber());
@@ -279,7 +289,7 @@ public class TestDisplayLifecycle01NEWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getInnerWindow())) {
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) {
MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
@@ -298,7 +308,7 @@ public class TestDisplayLifecycle01NEWT {
durationPerTest = atoi(args[++i]);
}
}
- System.out.println("durationPerTest: "+durationPerTest);
+ System.err.println("durationPerTest: "+durationPerTest);
String tstname = TestDisplayLifecycle01NEWT.class.getName();
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
index 9586ad936..efd62cf32 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows01NEWT.java
@@ -81,13 +81,17 @@ public class TestGLWindows01NEWT {
//
GLWindow glWindow;
if(null!=screen) {
- Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
- Assert.assertNotNull(window);
- glWindow = GLWindow.create(window);
+ boolean destroyWhenUnused = screen.getDestroyWhenUnused();
+ glWindow = GLWindow.create(screen, caps);
+ Assert.assertNotNull(glWindow);
+ Assert.assertEquals(destroyWhenUnused, glWindow.getScreen().getDestroyWhenUnused());
} else {
- glWindow = GLWindow.create(caps, onscreen && undecorated);
+ glWindow = GLWindow.create(caps);
+ Assert.assertNotNull(glWindow);
+ Assert.assertTrue(glWindow.getScreen().getDestroyWhenUnused());
}
- Assert.assertNotNull(glWindow);
+
+ glWindow.setUndecorated(onscreen && undecorated);
Assert.assertEquals(false,glWindow.isVisible());
Assert.assertEquals(false,glWindow.isNativeValid());
@@ -100,22 +104,20 @@ public class TestGLWindows01NEWT {
glWindow.setSize(width, height);
+ Assert.assertEquals(0, glWindow.getTotalFrames());
glWindow.setVisible(true);
Assert.assertEquals(true,glWindow.isVisible());
Assert.assertEquals(true,glWindow.isNativeValid());
int wait=0;
while(wait<10 && glWindow.getTotalFrames()<1) { Thread.sleep(100); wait++; }
System.out.println("Frames for initial setVisible(true): "+glWindow.getTotalFrames());
- // FIXME: Assert.assertTrue(0<glWindow.getTotalFrames()); // native expose ..
- // Assert.assertEquals(width,glWindow.getWidth());
- // Assert.assertEquals(height,glWindow.getHeight());
- // System.out.println("Created: "+glWindow);
+ Assert.assertTrue(0 < glWindow.getTotalFrames());
//
// Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- caps = (GLCapabilities) glWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ caps = glWindow.getChosenGLCapabilities();
Assert.assertNotNull(caps);
Assert.assertTrue(caps.getGreenBits()>5);
Assert.assertTrue(caps.getBlueBits()>5);
@@ -130,11 +132,19 @@ public class TestGLWindows01NEWT {
return glWindow;
}
- static void destroyWindow(GLWindow glWindow, boolean deep) {
+ static void destroyWindow(GLWindow glWindow, Screen screen, Display display, boolean unrecoverable) {
if(null!=glWindow) {
- glWindow.destroy(deep);
+ glWindow.destroy(unrecoverable);
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());
+ }
}
@Test
@@ -163,7 +173,7 @@ public class TestGLWindows01NEWT {
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
- destroyWindow(window, true);
+ destroyWindow(window, null, null, true);
}
@Test
@@ -192,7 +202,7 @@ public class TestGLWindows01NEWT {
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
- destroyWindow(window, true);
+ destroyWindow(window, null, null, true);
}
@Test
@@ -203,11 +213,12 @@ public class TestGLWindows01NEWT {
true /* onscreen */, false /* undecorated */,
false /*addGLEventListenerAfterVisible*/);
System.out.println("Created: "+window);
- while(window.getDuration()<durationPerTest) {
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
System.out.println("duration: "+window.getDuration());
- destroyWindow(window, true);
+ destroyWindow(window, null, null, true);
}
@Test
@@ -218,11 +229,12 @@ public class TestGLWindows01NEWT {
true /* onscreen */, false /* undecorated */,
true /*addGLEventListenerAfterVisible*/);
System.out.println("Created: "+window);
- while(window.getDuration()<durationPerTest) {
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
System.out.println("duration: "+window.getDuration());
- destroyWindow(window, true);
+ destroyWindow(window, null, null, true);
}
@Test
@@ -232,12 +244,13 @@ public class TestGLWindows01NEWT {
GLWindow window = createWindow(null, caps, width, height,
true /* onscreen */, false /* undecorated */,
false /*addGLEventListenerAfterVisible*/);
- while(window.getDuration()<durationPerTest) {
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
System.out.println("duration: "+window.getDuration());
- destroyWindow(window, false);
- destroyWindow(window, true);
+ destroyWindow(window, null, null, false);
+ destroyWindow(window, null, null, true);
}
@Test
@@ -249,7 +262,7 @@ public class TestGLWindows01NEWT {
Assert.assertNotNull(display1);
Display display2 = NewtFactory.createDisplay(null); // local display
Assert.assertNotNull(display2);
- Assert.assertEquals(display1, display2); // must be equal: same thread - same display
+ Assert.assertNotSame(display1, display2);
Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
Assert.assertNotNull(screen1);
@@ -265,21 +278,53 @@ public class TestGLWindows01NEWT {
false /*addGLEventListenerAfterVisible*/);
Assert.assertNotNull(window2);
- while(window1.getDuration()<durationPerTest) {
+ Assert.assertEquals(2,Display.getActiveDisplayNumber());
+
+ Assert.assertEquals(1,display1.getReferenceCount());
+ Assert.assertEquals(true,display1.isNativeValid());
+ Assert.assertNotNull(display1.getEDTUtil());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
+
+ Assert.assertEquals(1,display2.getReferenceCount());
+ Assert.assertEquals(true,display2.isNativeValid());
+ Assert.assertNotNull(display2.getEDTUtil());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen2.getReferenceCount());
+ Assert.assertEquals(true,screen2.isNativeValid());
+
+ int state;
+ for(state=0; state*100<durationPerTest; state++) {
Thread.sleep(100);
}
System.out.println("duration1: "+window1.getDuration());
System.out.println("duration2: "+window2.getDuration());
- destroyWindow(window2, true);
+ destroyWindow(window2, screen2, display2, true);
+ destroyWindow(window1, screen1, display1, true);
+
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
+ Assert.assertEquals(0,display1.getReferenceCount());
+ Assert.assertEquals(false,display1.isNativeValid());
+ Assert.assertNotNull(display1.getEDTUtil());
+ Assert.assertEquals(false,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen1.getReferenceCount());
+ Assert.assertEquals(false,screen1.isNativeValid());
- destroyWindow(window1, true);
+ Assert.assertEquals(0,display2.getReferenceCount());
+ Assert.assertEquals(false,display2.isNativeValid());
+ Assert.assertNotNull(display2.getEDTUtil());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getInnerWindow())) {
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) {
MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
index 62bb5b7f9..0f47a34b0 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestGLWindows02NEWTAnimated.java
@@ -78,13 +78,15 @@ public class TestGLWindows02NEWTAnimated {
//
GLWindow glWindow;
if(null!=screen) {
- Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ Window window = NewtFactory.createWindow(screen, caps);
Assert.assertNotNull(window);
glWindow = GLWindow.create(window);
} else {
- glWindow = GLWindow.create(caps, onscreen && undecorated);
+ glWindow = GLWindow.create(caps);
}
Assert.assertNotNull(glWindow);
+ glWindow.setUndecorated(onscreen && undecorated);
+
GLEventListener demo = new Gears();
setDemoFields(demo, glWindow);
glWindow.addGLEventListener(demo);
@@ -104,7 +106,7 @@ public class TestGLWindows02NEWTAnimated {
// Create native OpenGL resources .. XGL/WGL/CGL ..
// equivalent to GLAutoDrawable methods: setVisible(true)
//
- caps = (GLCapabilities) glWindow.getGraphicsConfiguration().getNativeGraphicsConfiguration().getChosenCapabilities();
+ caps = glWindow.getChosenGLCapabilities();
Assert.assertNotNull(caps);
Assert.assertTrue(caps.getGreenBits()>5);
Assert.assertTrue(caps.getBlueBits()>5);
@@ -158,7 +160,7 @@ public class TestGLWindows02NEWTAnimated {
Assert.assertNotNull(display1);
Display display2 = NewtFactory.createDisplay(null); // local display
Assert.assertNotNull(display2);
- Assert.assertEquals(display1, display2); // must be equal: same thread - same display
+ Assert.assertNotSame(display1, display2);
Screen screen1 = NewtFactory.createScreen(display1, 0); // screen 0
Assert.assertNotNull(screen1);
@@ -190,7 +192,7 @@ public class TestGLWindows02NEWTAnimated {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getInnerWindow())) {
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow)) {
MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
diff --git a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
index 2159ecda5..b98ed2f4d 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestListenerCom01AWT.java
@@ -128,7 +128,7 @@ public class TestListenerCom01AWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Window window = glWindow.getWindow();
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
diff --git a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
index be917ecea..22ec08903 100644
--- a/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/TestWindows01NEWT.java
@@ -62,8 +62,9 @@ public class TestWindows01NEWT {
//
// Create native windowing resources .. X11/Win/OSX
//
- Window window = NewtFactory.createWindow(screen, caps, onscreen && undecorated);
+ Window window = NewtFactory.createWindow(screen, caps);
Assert.assertNotNull(window);
+ window.setUndecorated(onscreen && undecorated);
window.setSize(width, height);
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java b/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java
index f951253f4..2459c8687 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/GLRunnableDummy.java
@@ -54,5 +54,4 @@ public class GLRunnableDummy implements GLRunnable {
d*=-1f;
}
}
-
}
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 fdeb09604..56b9f2876 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01NEWT.java
@@ -26,7 +26,6 @@
* or implied, of JogAmp Community.
*/
-
package com.jogamp.test.junit.newt.parenting;
import java.lang.reflect.*;
@@ -63,7 +62,6 @@ public class TestParenting01NEWT {
static int width, height;
static long durationPerTest = 500;
- static long waitReparent = 0;
static GLCapabilities glCaps;
@BeforeClass
@@ -128,7 +126,17 @@ public class TestParenting01NEWT {
Assert.assertEquals(0,Display.getActiveDisplayNumber());
// visible test
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
+ int wait;
+ for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
+ Thread.sleep(100);
+ }
+ System.err.println("Frames for setVisible(true): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
@@ -146,24 +154,78 @@ public class TestParenting01NEWT {
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(false, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
+ glWindow1.resetPerfCounter();
+ glWindow2.resetPerfCounter();
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
+ for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
+ Thread.sleep(100);
+ }
+ System.err.println("Frames for setVisible(true): A2: "+glWindow1.getTotalFrames()+", B2: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
+ glWindow1.resetPerfCounter();
+ glWindow2.resetPerfCounter();
Animator animator1 = new Animator(glWindow1);
animator1.start();
+ Assert.assertEquals(true, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertNotNull(animator1.getThread());
Animator animator2 = new Animator(glWindow2);
animator2.start();
+ Assert.assertEquals(true, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertNotNull(animator2.getThread());
while(animator1.isAnimating() && animator1.getDuration()<durationPerTest) {
Thread.sleep(100);
}
+ System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
+ animator1.pause();
+ Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(true, animator1.isPaused());
+ Assert.assertNotNull(animator1.getThread());
+ animator2.pause();
+ Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(true, animator2.isPaused());
+ Assert.assertNotNull(animator2.getThread());
+
+ glWindow1.resetPerfCounter();
+ glWindow2.resetPerfCounter();
+ animator1.resume();
+ Assert.assertEquals(true, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertNotNull(animator1.getThread());
+ animator2.resume();
+ Assert.assertEquals(true, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertNotNull(animator2.getThread());
+ for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
+ Thread.sleep(100);
+ }
+ System.err.println("Frames for setVisible(true): A4: "+glWindow1.getTotalFrames()+", B4: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertEquals(null, animator1.getThread());
animator2.stop();
Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertEquals(null, animator2.getThread());
Assert.assertEquals(1,display.getReferenceCount());
Assert.assertEquals(true,display.isNativeValid());
@@ -206,9 +268,21 @@ public class TestParenting01NEWT {
Assert.assertEquals(1,Display.getActiveDisplayNumber());
// recreation ..
+ glWindow1.resetPerfCounter();
+ glWindow2.resetPerfCounter();
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
+ for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
+ Thread.sleep(100);
+ }
+ System.err.println("Frames for setVisible(true): A3: "+glWindow1.getTotalFrames()+", B3: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
+
Assert.assertEquals(true, glWindow1.isVisible());
Assert.assertEquals(true, glWindow1.isNativeValid());
+
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertEquals(1,display.getReferenceCount());
@@ -247,7 +321,19 @@ public class TestParenting01NEWT {
}
@Test
- public void testWindowParenting02ReparentTop2Win() throws InterruptedException {
+ public void testWindowParenting02ReparentTop2WinReparentRecreate() throws InterruptedException {
+ testWindowParenting02ReparentTop2WinImpl(true);
+ }
+
+ @Test
+ public void testWindowParenting02ReparentTop2WinReparentNative() throws InterruptedException {
+ testWindowParenting02ReparentTop2WinImpl(false);
+ }
+
+ /**
+ * @param reparentRecreate true, if the followup reparent should utilize destroy/create, instead of native reparenting
+ */
+ protected void testWindowParenting02ReparentTop2WinImpl(boolean reparentRecreate) throws InterruptedException {
int x = 0;
int y = 0;
@@ -297,7 +383,13 @@ public class TestParenting01NEWT {
Assert.assertNotSame(screen1, screen2);
Assert.assertNotSame(display1, display2);
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
glWindow1.setVisible(true);
+ int wait=0;
+ while(wait<10 && glWindow1.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ System.err.println("Frames for setVisible(true) A1: "+glWindow1.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -306,7 +398,13 @@ public class TestParenting01NEWT {
Assert.assertEquals(true,screen1.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow2.setVisible(true);
+ wait=0;
+ while(wait<10 && glWindow2.getTotalFrames()<1) { Thread.sleep(100); wait++; }
+ System.err.println("Frames for setVisible(true) B1: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow1.getTotalFrames());
+
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
@@ -329,112 +427,155 @@ public class TestParenting01NEWT {
animator2.start();
int state = 0;
+ int reparentAction;
while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
// glWindow2 -- child --> glWindow1: compatible
Assert.assertEquals(true, glWindow2.isVisible());
- glWindow2.reparentWindow(glWindow1);
+ reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
+ 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.assertNotSame(screen1,glWindow2.getScreen());
- Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
Assert.assertEquals(true,display1.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen1.getReferenceCount());
Assert.assertEquals(true,screen1.isNativeValid());
-
- Assert.assertEquals(1,display2.getReferenceCount());
- Assert.assertEquals(true,display2.isNativeValid());
Assert.assertNotNull(display2.getEDTUtil());
- Assert.assertEquals(true,display2.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen2.getReferenceCount());
- Assert.assertEquals(true,screen2.isNativeValid());
-
- Assert.assertEquals(2,Display.getActiveDisplayNumber());
+ if(Window.ReparentAction.ACTION_NATIVE_REPARENTING >= reparentAction) {
+ Assert.assertNotSame(screen1,glWindow2.getScreen());
+ Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(1,screen1.getReferenceCount());
+ Assert.assertEquals(1,display2.getReferenceCount());
+ Assert.assertEquals(true,display2.isNativeValid());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen2.getReferenceCount());
+ Assert.assertEquals(true,screen2.isNativeValid());
+ Assert.assertEquals(2,Display.getActiveDisplayNumber());
+ } else {
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(2,screen1.getReferenceCount());
+ Assert.assertEquals(0,display2.getReferenceCount());
+ Assert.assertEquals(false,display2.isNativeValid());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ }
break;
case 1:
// glWindow2 --> top
Assert.assertEquals(true, glWindow2.isVisible());
- glWindow2.reparentWindow(null);
+
+ reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
+ 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+", B3: "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertNull(glWindow2.getParentNativeWindow());
- Assert.assertNotSame(screen1,glWindow2.getScreen());
- Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
Assert.assertEquals(true,display1.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen1.getReferenceCount());
Assert.assertEquals(true,screen1.isNativeValid());
-
- Assert.assertEquals(1,display2.getReferenceCount());
- Assert.assertEquals(true,display2.isNativeValid());
Assert.assertNotNull(display2.getEDTUtil());
- Assert.assertEquals(true,display2.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen2.getReferenceCount());
- Assert.assertEquals(true,screen2.isNativeValid());
+ if(Window.ReparentAction.ACTION_NATIVE_REPARENTING >= reparentAction) {
+ Assert.assertNotSame(screen1,glWindow2.getScreen());
+ Assert.assertNotSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(1,screen1.getReferenceCount());
+ Assert.assertEquals(1,display2.getReferenceCount());
+ Assert.assertEquals(true,display2.isNativeValid());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen2.getReferenceCount());
+ Assert.assertEquals(true,screen2.isNativeValid());
+ Assert.assertEquals(2,Display.getActiveDisplayNumber());
+ } else {
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(2,screen1.getReferenceCount());
+ Assert.assertEquals(0,display2.getReferenceCount());
+ Assert.assertEquals(false,display2.isNativeValid());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ }
- Assert.assertEquals(2,Display.getActiveDisplayNumber());
break;
}
state++;
}
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertEquals(null, animator1.getThread());
animator2.stop();
Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertEquals(null, animator2.getThread());
// pre-destroy check (both valid and running)
Assert.assertEquals(1,display1.getReferenceCount());
Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
Assert.assertEquals(true,display1.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen1.getReferenceCount());
- Assert.assertEquals(true,screen1.isNativeValid());
-
- Assert.assertEquals(1,display2.getReferenceCount());
- Assert.assertEquals(true,display2.isNativeValid());
Assert.assertNotNull(display2.getEDTUtil());
- Assert.assertEquals(true,display2.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen2.getReferenceCount());
- Assert.assertEquals(true,screen2.isNativeValid());
-
- Assert.assertEquals(2,Display.getActiveDisplayNumber());
-
+ if(!reparentRecreate) {
+ Assert.assertEquals(1,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
+ Assert.assertEquals(1,display2.getReferenceCount());
+ Assert.assertEquals(true,display2.isNativeValid());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen2.getReferenceCount());
+ Assert.assertEquals(true,screen2.isNativeValid());
+ Assert.assertEquals(2,Display.getActiveDisplayNumber());
+ } else {
+ Assert.assertEquals(2,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
+ Assert.assertEquals(0,display2.getReferenceCount());
+ Assert.assertEquals(false,display2.isNativeValid());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
+ }
- // destroy glWindow1
- glWindow1.destroy(true);
- Assert.assertEquals(false, glWindow1.isValid());
- Assert.assertEquals(true , glWindow2.isValid());
+ // destroy glWindow2
+ glWindow2.destroy(true);
+ Assert.assertEquals(true, glWindow1.isValid());
+ Assert.assertEquals(false, glWindow2.isValid());
- Assert.assertEquals(0,display1.getReferenceCount());
- Assert.assertEquals(false,display1.isNativeValid());
+ Assert.assertEquals(1,display1.getReferenceCount());
+ Assert.assertEquals(true,display1.isNativeValid());
Assert.assertNotNull(display1.getEDTUtil());
- Assert.assertEquals(false,display1.getEDTUtil().isRunning());
- Assert.assertEquals(0,screen1.getReferenceCount());
- Assert.assertEquals(false,screen1.isNativeValid());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(1,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
- Assert.assertEquals(1,display2.getReferenceCount());
- Assert.assertEquals(true,display2.isNativeValid());
+ Assert.assertEquals(0,display2.getReferenceCount());
+ Assert.assertEquals(false,display2.isNativeValid());
Assert.assertNotNull(display2.getEDTUtil());
- Assert.assertEquals(true,display2.getEDTUtil().isRunning());
- Assert.assertEquals(1,screen2.getReferenceCount());
- Assert.assertEquals(true,screen2.isNativeValid());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
Assert.assertEquals(1,Display.getActiveDisplayNumber());
// destroy glWindow1
- glWindow2.destroy(true);
+ glWindow1.destroy(true);
Assert.assertEquals(false, glWindow1.isValid());
Assert.assertEquals(false, glWindow2.isValid());
@@ -456,26 +597,86 @@ public class TestParenting01NEWT {
}
@Test
- public void testWindowParenting03ReparentWin2Top() throws InterruptedException {
+ public void testWindowParenting03ReparentWin2TopReparentRecreate() throws InterruptedException {
+ testWindowParenting03ReparentWin2TopImpl(true);
+ }
+
+ @Test
+ public void testWindowParenting03ReparentWin2TopReparentNative() throws InterruptedException {
+ testWindowParenting03ReparentWin2TopImpl(false);
+ }
+
+ protected void testWindowParenting03ReparentWin2TopImpl(boolean reparentRecreate) throws InterruptedException {
int x = 0;
int y = 0;
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+ Display display1 = null;
+ Screen screen1 = null;
+ Display display2 = null;
+ Screen screen2 = null;
+
GLWindow glWindow1 = GLWindow.create(glCaps);
+ screen1 = glWindow1.getScreen();
+ display1 = screen1.getDisplay();
glWindow1.setTitle("testWindowParenting03ReparentWin2Top");
glWindow1.setSize(640, 480);
GLEventListener demo1 = new RedSquare();
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());
+ Assert.assertEquals(false,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen1.getReferenceCount());
+ Assert.assertEquals(false,screen1.isNativeValid());
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
GLWindow glWindow2 = GLWindow.create(glWindow1, glCaps);
+ screen2 = glWindow2.getScreen();
+ display2 = screen2.getDisplay();
glWindow2.setSize(320, 240);
GLEventListener demo2 = new Gears();
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());
+ Assert.assertEquals(true,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+
+ Assert.assertEquals(0, glWindow1.getTotalFrames());
+ Assert.assertEquals(0, glWindow2.getTotalFrames());
glWindow1.setVisible(true);
+ int wait;
+ for(wait=0; wait<10 && ( glWindow2.getTotalFrames()<1 || glWindow1.getTotalFrames()<1 ); wait++) {
+ Thread.sleep(100);
+ }
+ System.err.println("Frames for setVisible(): A1: "+glWindow1.getTotalFrames()+", B1: "+glWindow2.getTotalFrames());
+ 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());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(2,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
+ Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow());
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
Animator animator1 = new Animator(glWindow1);
animator1.start();
@@ -483,48 +684,99 @@ public class TestParenting01NEWT {
animator2.start();
int state = 0;
+ int reparentAction;
while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
Assert.assertEquals(true, glWindow2.isVisible());
- glWindow2.reparentWindow(null);
+ reparentAction = glWindow2.reparentWindow(null, reparentRecreate);
+ 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.assertNull(glWindow2.getParentNativeWindow());
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
break;
case 1:
Assert.assertEquals(true, glWindow2.isVisible());
- glWindow2.reparentWindow(glWindow1);
+ reparentAction = glWindow2.reparentWindow(glWindow1, reparentRecreate);
+ 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+", B3 "+glWindow2.getTotalFrames());
+ Assert.assertTrue(0 < glWindow2.getTotalFrames());
Assert.assertEquals(true, glWindow2.isVisible());
Assert.assertEquals(true, glWindow2.isNativeValid());
Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow());
+ Assert.assertSame(screen1,glWindow2.getScreen());
+ Assert.assertSame(display1,glWindow2.getScreen().getDisplay());
+ Assert.assertEquals(1,Display.getActiveDisplayNumber());
break;
}
state++;
}
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertEquals(null, animator1.getThread());
animator2.stop();
Assert.assertEquals(false, animator2.isAnimating());
+ Assert.assertEquals(false, animator2.isPaused());
+ Assert.assertEquals(null, animator2.getThread());
- glWindow1.destroy(true);
+ Assert.assertEquals(true,display1.getDestroyWhenUnused());
+ Assert.assertEquals(1,display1.getReferenceCount());
+ Assert.assertEquals(true,display1.isNativeValid());
+ Assert.assertNotNull(display1.getEDTUtil());
+ Assert.assertEquals(true,display1.getEDTUtil().isRunning());
+ Assert.assertEquals(2,screen1.getReferenceCount());
+ Assert.assertEquals(true,screen1.isNativeValid());
+ Assert.assertSame(glWindow1,glWindow2.getParentNativeWindow());
+ Assert.assertSame(screen1,glWindow2.getScreen());
+
+ 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());
+
+ Assert.assertEquals(true,display1.getDestroyWhenUnused());
+ Assert.assertEquals(0,display1.getReferenceCount());
+ Assert.assertEquals(false,display1.isNativeValid());
+ Assert.assertNotNull(display1.getEDTUtil());
+ Assert.assertEquals(false,display1.getEDTUtil().isRunning());
+ 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());
+ Assert.assertEquals(false,display2.getEDTUtil().isRunning());
+ Assert.assertEquals(0,screen2.getReferenceCount());
+ Assert.assertEquals(false,screen2.isNativeValid());
+
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
+
glWindow2.destroy(true);
Assert.assertEquals(false, glWindow1.isValid());
Assert.assertEquals(false, glWindow2.isValid());
+
+ Assert.assertEquals(0,Display.getActiveDisplayNumber());
}
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
}
- if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getWindow())) {
MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
@@ -541,10 +793,9 @@ public class TestParenting01NEWT {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-time")) {
durationPerTest = atoi(args[++i]);
- } else if(args[i].equals("-wait")) {
- waitReparent = atoi(args[++i]);
}
}
+ System.err.println("durationPerTest: "+durationPerTest);
String tstname = TestParenting01NEWT.class.getName();
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(new String[] {
tstname,
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 fa04edd50..aad060f05 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01aAWT.java
@@ -340,7 +340,8 @@ public class TestParenting01aAWT {
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
- GLWindow glWindow1 = GLWindow.create(glCaps, true);
+ GLWindow glWindow1 = GLWindow.create(glCaps);
+ glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquare();
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
@@ -399,13 +400,12 @@ public class TestParenting01aAWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
- Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Assert.assertNotNull(glWindow);
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
}
- if(!MiscUtils.setFieldIfExists(demo, "window", window)) {
+ if(!MiscUtils.setFieldIfExists(demo, "window", glWindow.getWindow())) {
MiscUtils.setFieldIfExists(demo, "glWindow", glWindow);
}
}
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 e9c58b136..29b045be2 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01bAWT.java
@@ -50,6 +50,7 @@ import javax.media.opengl.*;
import javax.media.nativewindow.*;
import com.jogamp.opengl.util.Animator;
+import com.jogamp.opengl.util.FPSAnimator;
import com.jogamp.newt.*;
import com.jogamp.newt.event.*;
import com.jogamp.newt.opengl.*;
@@ -79,13 +80,23 @@ public class TestParenting01bAWT {
}
@Test
- public void testWindowParenting05ReparentAWTWinHopFrame2Frame() throws InterruptedException {
+ public void testWindowParenting05ReparentAWTWinHopFrame2FrameFPS25Animator() throws InterruptedException {
+ testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(25);
+ }
+
+ @Test
+ public void testWindowParenting05ReparentAWTWinHopFrame2FrameStdAnimator() throws InterruptedException {
+ testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(0);
+ }
+
+ public void testWindowParenting05ReparentAWTWinHopFrame2FrameImpl(int fps) throws InterruptedException {
int x = 0;
int y = 0;
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
- GLWindow glWindow1 = GLWindow.create(glCaps, true);
+ GLWindow glWindow1 = GLWindow.create(glCaps);
+ glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquare();
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
@@ -115,11 +126,16 @@ public class TestParenting01bAWT {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
- Animator animator1 = new Animator(glWindow1);
+ GLAnimatorControl animator1;
+ if(fps>0) {
+ animator1 = new FPSAnimator(glWindow1, fps);
+ } else {
+ animator1 = new Animator(glWindow1);
+ }
animator1.start();
- int state = 0;
- while(animator1.isAnimating() && animator1.getDuration()<3*durationPerTest) {
+ int state;
+ for(state=0; state<3; state++) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
@@ -131,11 +147,15 @@ public class TestParenting01bAWT {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
break;
}
- state++;
}
+ Assert.assertEquals(true, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertNotNull(animator1.getThread());
animator1.stop();
Assert.assertEquals(false, animator1.isAnimating());
+ Assert.assertEquals(false, animator1.isPaused());
+ Assert.assertEquals(null, animator1.getThread());
frame1.dispose();
frame2.dispose();
@@ -145,7 +165,7 @@ public class TestParenting01bAWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Window window = glWindow.getWindow();
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
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 669ff0a42..5bba968a6 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cAWT.java
@@ -50,7 +50,6 @@ import java.awt.Dimension;
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.*;
@@ -82,6 +81,7 @@ public class TestParenting01cAWT {
public void testWindowParenting01CreateVisibleDestroy1() throws InterruptedException {
int x = 0;
int y = 0;
+ int i;
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
@@ -123,7 +123,7 @@ public class TestParenting01cAWT {
frame1.setVisible(true);
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
- while(glWindow1.getDuration()<durationPerTest) {
+ for(i=0; i*100<durationPerTest; i++) {
Thread.sleep(100);
}
@@ -151,7 +151,8 @@ public class TestParenting01cAWT {
NEWTEventFiFo eventFifo = new NEWTEventFiFo();
- GLWindow glWindow1 = GLWindow.create(glCaps, true);
+ GLWindow glWindow1 = GLWindow.create(glCaps);
+ glWindow1.setUndecorated(true);
GLEventListener demo1 = new RedSquare();
setDemoFields(demo1, glWindow1, false);
glWindow1.addGLEventListener(demo1);
@@ -181,8 +182,8 @@ public class TestParenting01cAWT {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
Assert.assertEquals(newtCanvasAWT.getNativeWindow(),glWindow1.getParentNativeWindow());
- int state = 0;
- while(glWindow1.getDuration()<3*durationPerTest) {
+ int state;
+ for(state=0; state<3; state++) {
Thread.sleep(durationPerTest);
switch(state) {
case 0:
@@ -194,7 +195,6 @@ public class TestParenting01cAWT {
frame1.add(newtCanvasAWT, BorderLayout.CENTER);
break;
}
- state++;
}
frame1.dispose();
@@ -205,7 +205,7 @@ public class TestParenting01cAWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Window window = glWindow.getWindow();
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
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 3277999e2..a9aa11586 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting01cSwingAWT.java
@@ -334,7 +334,7 @@ public class TestParenting01cSwingAWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Window window = glWindow.getWindow();
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
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 f67d93da3..57008bb56 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02AWT.java
@@ -226,7 +226,7 @@ public class TestParenting02AWT {
public static void setDemoFields(GLEventListener demo, GLWindow glWindow, boolean debug) {
Assert.assertNotNull(demo);
Assert.assertNotNull(glWindow);
- Window window = glWindow.getInnerWindow();
+ Window window = glWindow.getWindow();
if(debug) {
MiscUtils.setFieldIfExists(demo, "glDebug", true);
MiscUtils.setFieldIfExists(demo, "glTrace", true);
diff --git a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
index af0df9f0f..1e093c508 100644
--- a/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
+++ b/src/junit/com/jogamp/test/junit/newt/parenting/TestParenting02NEWT.java
@@ -71,14 +71,15 @@ public class TestParenting02NEWT {
static Window createWindow(Screen screen, Capabilities caps) {
Assert.assertNotNull(caps);
- Window window = NewtFactory.createWindow(screen, caps, false) ;
+ Window window = NewtFactory.createWindow(screen, caps) ;
Assert.assertNotNull(window);
return window;
}
static Window createWindow(NativeWindow parent, Capabilities caps) {
Assert.assertNotNull(caps);
- Window window = NewtFactory.createWindow(parent, caps, true);
+ Window window = NewtFactory.createWindow(parent, caps);
+ window.setUndecorated(true);
Assert.assertNotNull(window);
return window;
}