29package com.jogamp.opengl.test.junit.jogl.awt;
31import java.awt.BorderLayout;
32import java.awt.Dimension;
33import java.awt.Window;
34import java.beans.Beans;
35import java.lang.reflect.InvocationTargetException;
37import com.jogamp.opengl.GLCapabilities;
38import com.jogamp.opengl.GLProfile;
39import com.jogamp.opengl.awt.GLCanvas;
40import javax.swing.JFrame;
41import javax.swing.SwingUtilities;
43import org.junit.Assert;
45import org.junit.FixMethodOrder;
46import org.junit.runners.MethodSorters;
48import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
49import com.jogamp.opengl.test.junit.util.MiscUtils;
50import com.jogamp.opengl.test.junit.util.UITestCase;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
54 static boolean waitForKey =
false;
55 static long durationPerTest = 200;
58 public void test01() throws InterruptedException, InvocationTargetException {
59 Beans.setDesignTime(
true);
63 final Dimension preferredGLSize =
new Dimension(400,200);
64 glCanvas.setPreferredSize(preferredGLSize);
65 glCanvas.setMinimumSize(preferredGLSize);
66 glCanvas.
setSize(preferredGLSize);
70 final Window window =
new JFrame(this.getSimpleTestName(
" - "));
71 window.setLayout(
new BorderLayout());
72 window.add(glCanvas, BorderLayout.CENTER);
75 SwingUtilities.invokeAndWait(
new Runnable() {
80 window.setVisible(
true);
85 Assert.assertTrue(
"GLCanvas didn't become displayable", glCanvas.isDisplayable());
86 if( !Beans.isDesignTime() ) {
87 Assert.assertTrue(
"GLCanvas didn't become realized", glCanvas.
isRealized());
90 Thread.sleep(durationPerTest);
92 SwingUtilities.invokeAndWait(
new Runnable() {
100 public static void main(
final String args[]) {
101 for(
int i=0; i<args.length; i++) {
102 if(args[i].equals(
"-time")) {
103 durationPerTest =
MiscUtils.
atol(args[++i], durationPerTest);
104 }
else if(args[i].equals(
"-wait")) {
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static GLProfile getGL2ES2(final AbstractGraphicsDevice device)
Returns the GL2ES2 profile implementation, hence compatible w/ GL2ES2.
A heavyweight AWT component which provides OpenGL rendering support.
boolean isRealized()
Returns true if this drawable is realized, otherwise false.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
static void main(final String args[])
static long atol(final String str, final long def)
void setSize(int width, int height)
Requests a new width and height for this AWTGLAutoDrawable.