29package com.jogamp.opengl.test.junit.jogl.awt;
31import com.jogamp.opengl.*;
33import com.jogamp.opengl.util.Animator;
35import com.jogamp.opengl.awt.GLCanvas;
36import javax.swing.JFrame;
37import javax.swing.JRootPane;
38import javax.swing.JScrollPane;
39import javax.swing.JSplitPane;
41import com.jogamp.newt.event.awt.AWTWindowAdapter;
42import com.jogamp.newt.event.TraceWindowAdapter;
43import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
44import com.jogamp.opengl.test.junit.util.AWTRobotUtil;
45import com.jogamp.opengl.test.junit.util.MiscUtils;
46import com.jogamp.opengl.test.junit.util.UITestCase;
47import com.jogamp.opengl.test.junit.util.QuitAdapter;
49import java.lang.reflect.InvocationTargetException;
51import org.junit.Assert;
53import org.junit.FixMethodOrder;
54import org.junit.runners.MethodSorters;
65@FixMethodOrder(MethodSorters.NAME_ASCENDING)
67 static long duration = 1600;
68 static int width=640, height=480;
71 public void test() throws InterruptedException, InvocationTargetException {
74 final JFrame frame =
new JFrame(
"TestBug816OSXCALayerPos02AWT");
75 Assert.assertNotNull(frame);
78 Assert.assertNotNull(glCanvas1);
82 animator.
add(glCanvas1);
89 final JSplitPane verticalSplitPane =
new JSplitPane(JSplitPane.VERTICAL_SPLIT,
90 true,
new JScrollPane(), glCanvas1);
91 verticalSplitPane.setResizeWeight(0.5);
92 final JSplitPane horizontalSplitPane =
new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
93 true,
new JScrollPane(), verticalSplitPane);
94 horizontalSplitPane.setResizeWeight(0.5);
95 final JRootPane intermediateRootPane =
new JRootPane();
96 intermediateRootPane.setContentPane(horizontalSplitPane);
97 frame.add(intermediateRootPane);
99 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
101 frame.setSize(width, height);
102 frame.setVisible(
true);
109 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 - Swing JFrame w/ 2 JRootPanes and 2 JSplitPanes.
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.
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.