29package com.jogamp.opengl.test.junit.newt;
31import org.junit.Assert;
32import org.junit.BeforeClass;
34import org.junit.FixMethodOrder;
35import org.junit.runners.MethodSorters;
39import com.jogamp.opengl.*;
41import com.jogamp.opengl.util.Animator;
42import com.jogamp.newt.*;
43import com.jogamp.newt.opengl.*;
44import com.jogamp.newt.awt.NewtCanvasAWT;
46import java.io.IOException;
47import java.lang.reflect.InvocationTargetException;
49import com.jogamp.opengl.test.junit.util.*;
50import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2;
52@FixMethodOrder(MethodSorters.NAME_ASCENDING)
54 static int width, height;
55 static long durationPerTest = 500;
56 static boolean verbose =
false;
68 Assert.assertNotNull(glWindow);
71 System.out.println(
"durationPerTest "+durationPerTest);
74 setDemoFields(demo, glWindow,
false);
77 final WindowEventCom1 wl1 =
new WindowEventCom1();
78 final WindowEventCom2 wl2 =
new WindowEventCom2();
79 final WindowEventCom3 wl3 =
new WindowEventCom3();
95 final Frame frame =
new Frame(
"AWT Parent Frame");
96 frame.add(newtCanvasAWT);
97 frame.setSize(width, height);
98 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
100 frame.setVisible(
true);
108 width+=10; height+=10;
109 frame.setSize(width, height);
112 Assert.assertEquals(
false, animator1.isAnimating());
114 javax.swing.SwingUtilities.invokeAndWait(
new Runnable() {
122 Assert.assertNotNull(demo);
123 Assert.assertNotNull(glWindow);
134 static int atoi(
final String a) {
137 i = Integer.parseInt(a);
138 }
catch (
final Exception ex) { ex.printStackTrace(); }
142 public static void main(
final String args[])
throws IOException {
144 for(
int i=0; i<args.length; i++) {
145 if(args[i].equals(
"-time")) {
146 durationPerTest = atoi(args[++i]);
150 org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.
main(
new String[] {
154 "haltOnFailure=false",
156 "outputtoformatters=true",
157 "logfailedtests=true",
158 "logtestlistenerevents=true",
159 "formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter",
160 "formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,TEST-"+tstname+
".xml" } );
AWT Canvas containing a NEWT Window using native parenting.
An implementation of GLAutoDrawable and Window interface, using a delegated Window instance,...
final void setTitle(final String title)
final void addWindowListener(final WindowListener l)
Appends the given com.jogamp.newt.event.WindowListener to the end of the list.
final WindowListener getWindowListener(final int index)
final void destroy()
Destroys all resources associated with this GLAutoDrawable, inclusive the GLContext.
final Window getDelegatedWindow()
If the implementation uses delegation, return the delegated Window instance, otherwise return this in...
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.
static void setDemoFields(final GLEventListener demo, final GLWindow glWindow, final boolean debug)
static void main(final String args[])
void testListenerStringPassingAndOrder()
static boolean setFieldIfExists(final Object instance, final String fieldName, final Object value)
final long getTotalFPSDuration()
final void setUpdateFPSFrames(final int frames, final PrintStream out)
final synchronized boolean start()
Starts this animator, if not running.
final synchronized boolean stop()
Stops this animator.
Specifying NEWT's Window functionality:
void addGLEventListener(GLEventListener listener)
Adds the given listener to the end of this drawable queue.
Declares events which client code can use to manage OpenGL rendering into a GLAutoDrawable.