29package com.jogamp.opengl.test.junit.jogl.awt;
31import java.awt.BorderLayout;
32import java.awt.Dialog;
34import java.lang.reflect.InvocationTargetException;
36import com.jogamp.opengl.GLCapabilities;
37import com.jogamp.opengl.GLProfile;
38import com.jogamp.opengl.awt.GLCanvas;
40import org.junit.Assert;
41import org.junit.FixMethodOrder;
43import org.junit.runners.MethodSorters;
45import com.jogamp.newt.event.TraceWindowAdapter;
46import com.jogamp.newt.event.awt.AWTWindowAdapter;
47import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
48import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
49import com.jogamp.opengl.test.junit.util.MiscUtils;
50import com.jogamp.opengl.test.junit.util.QuitAdapter;
51import com.jogamp.opengl.test.junit.util.UITestCase;
52import com.jogamp.opengl.util.Animator;
60@FixMethodOrder(MethodSorters.NAME_ASCENDING)
62 static long duration = 1600;
63 static int width=640, height=480;
66 public void test() throws InterruptedException, InvocationTargetException {
69 final Frame frame =
new Frame(
"TestBug816OSXCALayerPos04aAWT");
70 Assert.assertNotNull(frame);
73 Assert.assertNotNull(glCanvas1);
77 animator.
add(glCanvas1);
83 frame.setSize(400, 400);
85 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
87 frame.setLocation(100, 100);
88 frame.setSize(width, height);
89 frame.setVisible(
true);
93 final Dialog dialog =
new Dialog(frame,
"Bug 816 AWT Top-Level Dialog");
94 dialog.setLayout(
new BorderLayout());
95 dialog.add(glCanvas1, BorderLayout.CENTER);
97 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
99 dialog.setLocation(200, 200);
100 dialog.setSize(width/2, height/2);
101 dialog.setVisible(
true);
108 Assert.assertTrue(animator.isAnimating());
111 final long t0 = System.currentTimeMillis();
113 while(!quitAdapter.shouldQuit() && t1 - t0 < duration) {
115 t1 = System.currentTimeMillis();
118 Assert.assertNotNull(frame);
119 Assert.assertNotNull(glCanvas1);
121 Assert.assertNotNull(animator);
123 Assert.assertFalse(animator.isAnimating());
124 Assert.assertFalse(animator.
isStarted());
126 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
128 frame.setVisible(
false);
130 Assert.assertEquals(
false, frame.isVisible());
131 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
133 frame.remove(glCanvas1);
142 public static void main(
final String args[]) {
143 for(
int i=0; i<args.length; i++) {
144 if(args[i].equals(
"-time")) {
synchronized AWTAdapter addTo(final java.awt.Component awtComponent)
Due to the fact that some NEWT com.jogamp.newt.event.NEWTEventListener are mapped to more than one ja...
Specifies a set of OpenGL capabilities.
Specifies the the OpenGL profile.
static GLProfile getMaxProgrammableCore(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer)
Returns the highest profile, implementing the programmable shader core pipeline only.
A heavyweight AWT component which provides OpenGL rendering support.
void addGLEventListener(final GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Bug 816: OSX CALayer Positioning Bug - AWT Frame w/ (top-level) Dialog child containing the GLCanvas.
static void main(final String args[])
static boolean waitForRealized(final java.awt.Component comp, final boolean realized, final Runnable waitAction)
static boolean waitForVisible(final java.awt.Component comp, final boolean visible, final Runnable waitAction)
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 void setUpdateFPSFrames(final int frames, final PrintStream out)
synchronized boolean isStarted()
Indicates whether this animator has been started.
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.