summaryrefslogtreecommitdiffstats
path: root/maven/tests/test-jogl-all-noawt/src/test/java
diff options
context:
space:
mode:
authorMark Raynsford <[email protected]>2014-07-11 19:09:32 +0000
committerMark Raynsford <[email protected]>2014-07-11 19:09:32 +0000
commit6c2d8d425df5436663f85a5cf0a5396ae3de7d6f (patch)
treeb3fc7345e4494517327832306b8b4317a2050228 /maven/tests/test-jogl-all-noawt/src/test/java
parentc386cf285bfaf797c6779189c09e42d68e43b102 (diff)
Add jogl-main, nativewindow-main, newt-main - frontends for the atomics
packages that allow for pulling in all platform natives easily. Add test suite. Bug: 1023
Diffstat (limited to 'maven/tests/test-jogl-all-noawt/src/test/java')
-rw-r--r--maven/tests/test-jogl-all-noawt/src/test/java/org/jogamp/maven/tests/TestNEWT.java91
1 files changed, 91 insertions, 0 deletions
diff --git a/maven/tests/test-jogl-all-noawt/src/test/java/org/jogamp/maven/tests/TestNEWT.java b/maven/tests/test-jogl-all-noawt/src/test/java/org/jogamp/maven/tests/TestNEWT.java
new file mode 100644
index 0000000..8776f5e
--- /dev/null
+++ b/maven/tests/test-jogl-all-noawt/src/test/java/org/jogamp/maven/tests/TestNEWT.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2010 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL JogAmp Community OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of JogAmp Community.
+ */
+
+package org.jogamp.maven.tests;
+
+import javax.media.opengl.GL;
+import javax.media.opengl.GLAutoDrawable;
+import javax.media.opengl.GLCapabilities;
+import javax.media.opengl.GLEventListener;
+import javax.media.opengl.GLProfile;
+
+import org.junit.Test;
+
+import com.jogamp.newt.opengl.GLWindow;
+
+@SuppressWarnings("static-method") public final class TestNEWT
+{
+ @Test public void testOpen()
+ throws InterruptedException
+ {
+ final GLProfile pro = GLProfile.getDefault();
+ final GLCapabilities caps = new GLCapabilities(pro);
+ final GLWindow window = GLWindow.create(caps);
+
+ window.setSize(640, 480);
+ window.addGLEventListener(new GLEventListener() {
+ @Override public void reshape(
+ final GLAutoDrawable drawable,
+ final int w,
+ final int h,
+ final int x,
+ final int y)
+ {
+ // Nothing
+ }
+
+ @Override public void init(
+ final GLAutoDrawable drawable)
+ {
+ // Nothing
+ }
+
+ @Override public void dispose(
+ final GLAutoDrawable drawable)
+ {
+ // Nothing
+ }
+
+ @Override public void display(
+ final GLAutoDrawable drawable)
+ {
+ final GL gl = drawable.getGL();
+ gl.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
+ gl.glClear(GL.GL_COLOR_BUFFER_BIT);
+ }
+ });
+
+ window.display();
+ window.setVisible(true);
+ Thread.sleep(1000);
+ window.setVisible(false);
+ window.destroy();
+ }
+}