1package com.jogamp.opengl.test.junit.newt;
3import java.io.IOException;
5import com.jogamp.nativewindow.AbstractGraphicsDevice;
6import com.jogamp.opengl.GLCapabilities;
7import com.jogamp.opengl.GLCapabilitiesImmutable;
8import com.jogamp.opengl.GLEventListener;
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.Screen;
18import com.jogamp.newt.opengl.GLWindow;
19import com.jogamp.opengl.test.junit.jogl.demos.es1.GearsES1;
20import com.jogamp.opengl.test.junit.util.UITestCase;
21import com.jogamp.opengl.util.Animator;
23@FixMethodOrder(MethodSorters.NAME_ASCENDING)
26 static int width, height;
27 static long durationPerTest = 4000;
37 throws InterruptedException
39 Assert.assertNotNull(caps);
46 Assert.assertNotNull(glWindow);
48 glWindow = GLWindow.
create(caps);
49 Assert.assertNotNull(glWindow);
58 Assert.assertEquals(
true,glWindow.
isVisible());
64 static void destroyWindow(
final GLWindow glWindow) {
67 Assert.assertEquals(
false,glWindow.isNativeValid());
74 Assert.assertNotNull(caps);
75 final GLWindow window1 = createWindow(
null, caps);
77 Assert.assertEquals(
true,window1.
isVisible());
80 animator.
add(window1);
95 destroyWindow(window1);
98 static int atoi(
final String a) {
101 i = Integer.parseInt(a);
102 }
catch (
final Exception ex) { ex.printStackTrace(); }
106 public static void main(
final String args[])
throws IOException {
107 for(
int i=0; i<args.length; i++) {
108 if(args[i].equals(
"-time")) {
109 durationPerTest = atoi(args[++i]);
112 System.out.println(
"durationPerTest: "+durationPerTest);
114 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 void warpPointer(final int x, final int y)
Moves the pointer to x/y relative to this window's origin in pixel units.
final void setPointerVisible(final boolean mouseVisible)
Makes the pointer visible or invisible.
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 boolean isPointerVisible()
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
final void requestFocus()
Request focus for this native window.
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[])
final long getTotalFPSDuration()
final synchronized void add(final GLAutoDrawable drawable)
Adds a drawable to this animator's list of rendering drawables.
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
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.