1package com.jogamp.opengl.test.junit.newt.parenting;
3import java.io.IOException;
5import com.jogamp.nativewindow.AbstractGraphicsDevice;
6import com.jogamp.nativewindow.NativeWindow;
7import com.jogamp.opengl.GLCapabilities;
8import com.jogamp.opengl.GLCapabilitiesImmutable;
9import com.jogamp.opengl.GLProfile;
11import org.junit.Assert;
12import org.junit.BeforeClass;
14import org.junit.FixMethodOrder;
15import org.junit.runners.MethodSorters;
17import com.jogamp.newt.opengl.GLWindow;
18import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
19import com.jogamp.opengl.test.junit.util.MiscUtils;
20import com.jogamp.opengl.test.junit.util.UITestCase;
21import com.jogamp.opengl.util.Animator;
23@FixMethodOrder(MethodSorters.NAME_ASCENDING)
25 static long durationPerTest = 2*300;
27 static boolean opaque;
36 throws InterruptedException
38 Assert.assertNotNull(caps);
44 Assert.assertNotNull(glWindow);
46 glWindow.
setTitle(
"NEWT Parenting Window Test");
50 glWindow.
setSize(width, height);
52 Assert.assertEquals(
true,glWindow.
isVisible());
59 throws InterruptedException {
61 Assert.assertNotNull(nativeParentWindow);
62 Assert.assertNotNull(caps);
68 Assert.assertNotNull(glWindow);
70 glWindow.
setTitle(
"NEWT Parenting Window Test");
75 glWindow.
setSize(width, height);
77 Assert.assertEquals(
true,glWindow.
isVisible());
83 static void destroyWindow(
final GLWindow glWindow) {
86 Assert.assertEquals(
false,glWindow.isNativeValid());
95 Assert.assertNotNull(caps);
97 final GLWindow window1 = createParentWindow(caps, 400, 400);
99 Assert.assertEquals(
true,window1.
isVisible());
100 animator.
add(window1);
102 final GLWindow window2 = createNestedWindow(window1, caps, 400-300, 400-300, 300, 300);
104 Assert.assertEquals(
true,window2.
isVisible());
105 animator.
add(window2);
113 Thread.sleep(durationPerTest/2);
118 Thread.sleep(durationPerTest/2);
122 destroyWindow(window2);
123 destroyWindow(window1);
126 public static void main(
final String[] args)
throws IOException {
127 for(
int i=0; i<args.length; i++) {
128 if(args[i].equals(
"-time")) {
129 durationPerTest =
MiscUtils.
atol(args[++i], durationPerTest);
133 org.junit.runner.JUnitCore.
main(testName);
void setBackgroundOpaque(final boolean opaque)
Sets whether the surface shall be opaque or translucent.
abstract AbstractGraphicsDevice getGraphicsDevice()
Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e.
abstract Display getDisplay()
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final boolean isNativeValid()
final void setPosition(final int x, final int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
final void setTitle(final String title)
final void setSize(final int width, final int height)
Sets the size of the window's client area in window units, excluding decorations.
final boolean isVisible()
final void setVisible(final boolean visible)
Calls setVisible(true, visible), i.e.
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
static GLWindow create(final GLCapabilitiesImmutable caps)
Creates a new GLWindow attaching a new Window referencing a new default Screen and default Display wi...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static String glAvailabilityToString(final AbstractGraphicsDevice device)
static GLProfile getDefault(final AbstractGraphicsDevice device)
Returns a default GLProfile object, reflecting the best for the running platform.
static void main(final String[] args)
static long atol(final String str, final long def)
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
A interface describing a graphics device in a toolkit-independent manner.
String getConnection()
Returns the semantic GraphicsDevice connection.
Extend the NativeSurface interface with windowing information such as window-handle,...
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Specifies an immutable set of OpenGL capabilities.