29package com.jogamp.opengl.test.junit.newt;
31import org.junit.Assert;
32import org.junit.BeforeClass;
34import org.junit.FixMethodOrder;
35import org.junit.runners.MethodSorters;
37import com.jogamp.opengl.*;
39import com.jogamp.newt.*;
40import com.jogamp.newt.opengl.*;
41import java.io.IOException;
43import com.jogamp.opengl.test.junit.util.UITestCase;
44import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
46import com.jogamp.nativewindow.AbstractGraphicsDevice;
48@FixMethodOrder(MethodSorters.NAME_ASCENDING)
51 static int width, height;
52 static boolean manual =
false;
53 static int loopVisibleToggle = 10;
54 static long durationPerTest = 100;
64 throws InterruptedException
66 Assert.assertNotNull(caps);
73 Assert.assertNotNull(glWindow);
76 Assert.assertNotNull(glWindow);
85 System.err.println(
"XXX VISIBLE.0 -> TRUE");
87 Assert.assertEquals(
true,glWindow.
isVisible());
93 static void destroyWindow(
final GLWindow glWindow) {
97 Assert.assertEquals(
false,glWindow.
isVisible());
107 Assert.assertNotNull(caps);
108 final GLWindow window = createWindow(
null, caps,
false );
110 Assert.assertEquals(
true,window.
isVisible());
115 for(
int state=0; state*100<durationPerTest; state++) {
119 destroyWindow(window);
128 Assert.assertNotNull(caps);
129 final GLWindow window = createWindow(
null, caps,
true );
131 Assert.assertEquals(
true,window.
isVisible());
136 for(
int state=0; state*100<durationPerTest; state++) {
140 destroyWindow(window);
145 test1xWindowToggleVisibility(
false , loopVisibleToggle);
152 test1xWindowToggleVisibility(
true , loopVisibleToggle);
154 private void test1xWindowToggleVisibility(
final boolean undecor,
final int loopVisibleToggle)
throws InterruptedException {
156 Assert.assertNotNull(caps);
157 final GLWindow window = createWindow(
null, caps, undecor);
159 Assert.assertEquals(
true,window.
isVisible());
163 Assert.assertEquals(
true,window.
isVisible());
164 for(
int state=0; state*100<durationPerTest; state++) {
168 for(
int i=1; i<=loopVisibleToggle; i++) {
169 System.err.println(
"XXX VISIBLE."+i+
" -> FALSE");
172 Assert.assertEquals(
false,window.
isVisible());
173 for(
int state=0; state*100<durationPerTest; state++) {
179 Assert.assertEquals(
false,window.
isVisible());
181 System.err.println(
"XXX VISIBLE."+i+
" -> TRUE");
184 Assert.assertEquals(
true,window.
isVisible());
185 for(
int state=0; state*100<durationPerTest; state++) {
190 Assert.assertEquals(
true,window.
isVisible());
193 destroyWindow(window);
196 static int atoi(
final String a) {
199 i = Integer.parseInt(a);
200 }
catch (
final Exception ex) { ex.printStackTrace(); }
204 public static void main(
final String args[])
throws IOException {
205 for(
int i=0; i<args.length; i++) {
206 if(args[i].equals(
"-time")) {
207 durationPerTest = atoi(args[++i]);
208 }
else if(args[i].equals(
"-loopvt")) {
209 loopVisibleToggle = atoi(args[++i]);
210 }
else if(args[i].equals(
"-manual")) {
214 System.out.println(
"durationPerTest: "+durationPerTest);
216 org.junit.runner.JUnitCore.
main(tstname);
abstract AbstractGraphicsDevice getGraphicsDevice()
Return the AbstractGraphicsDevice used for depending resources lifecycle, i.e.
A screen may span multiple MonitorDevices representing their combined virtual size.
abstract Display getDisplay()
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final boolean isNativeValid()
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 setUndecorated(final boolean value)
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.
void test02WindowCreateUndecor()
void test12WindowUndecorToggleVisibility()
void test11WindowSimpleToggleVisibility()
void test01WindowCreateSimple()
static void main(final String args[])
A interface describing a graphics device in a toolkit-independent manner.
String getConnection()
Returns the semantic GraphicsDevice connection.
void setUpdateFPSFrames(int frames, PrintStream out)
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Specifies an immutable set of OpenGL capabilities.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.