29package com.jogamp.opengl.test.junit.newt;
32import org.junit.Assert;
33import org.junit.Assume;
34import org.junit.BeforeClass;
36import org.junit.FixMethodOrder;
37import org.junit.runners.MethodSorters;
39import com.jogamp.nativewindow.*;
41import com.jogamp.newt.*;
42import java.io.IOException;
44import com.jogamp.opengl.test.junit.util.UITestCase;
46@FixMethodOrder(MethodSorters.NAME_ASCENDING)
48 static int width, height;
49 static String remoteDisplay =
"localhost:0.0";
58 static Window createWindow(
final Screen screen,
final Capabilities caps,
final int width,
final int height,
final boolean onscreen,
final boolean undecorated) {
59 Assert.assertNotNull(caps);
67 Assert.assertNotNull(window);
71 Assert.assertEquals(
false,window.
isVisible());
73 Assert.assertEquals(
true,window.
isVisible());
84 Assert.assertNotNull(chosenCapabilities);
86 Assert.assertTrue(chosenCapabilities.
getBlueBits()>5);
87 Assert.assertTrue(chosenCapabilities.
getRedBits()>5);
88 Assert.assertEquals(chosenCapabilities.
isOnscreen(),onscreen);
93 static void destroyWindow(
final Display display,
final Screen screen,
final Window window) {
110 final Window window1 = createWindow(screen1, caps, width, height,
true ,
false );
114 Assert.assertEquals(
true,window1.
isVisible());
125 window2 = createWindow(screen2, caps, width, height,
true ,
false );
128 System.err.println(nwe);
129 Assume.assumeNoException(nwe);
130 destroyWindow(display1, screen1, window1);
135 Assert.assertEquals(
true,window2.
isVisible());
139 destroyWindow(display1, screen1, window1);
140 destroyWindow(display2, screen2, window2);
143 public static void main(
final String args[])
throws IOException {
144 for(
int i=0; i<args.length; i++) {
145 if(args[i].equals(
"-display")) {
146 remoteDisplay = args[++i];
149 System.out.println(
"display: "+remoteDisplay);
151 org.junit.runner.JUnitCore.
main(tstname);
Specifies a set of capabilities that a window's rendering context must support, such as color depth p...
void setOnscreen(final boolean onscreen)
Sets whether the surface shall be on- or offscreen.
A generic exception for OpenGL errors used throughout the binding as a substitute for RuntimeExceptio...
Provides a pluggable mechanism for arbitrary window toolkits to adapt their components to the NativeW...
static synchronized void initSingleton()
Static one time initialization of this factory.
abstract void destroy()
Manually trigger the destruction, incl.
abstract void createNative()
Manual trigger the native creation, if it is not done yet.
static Display createDisplay(final String name)
Create a Display entity.
static Window createWindow(final CapabilitiesImmutable caps)
Create a top level Window entity on the default Display and default Screen.
static Screen createScreen(final Display display, final int index)
Create a Screen entity.
A screen may span multiple MonitorDevices representing their combined virtual size.
abstract void destroy()
Manually trigger the destruction, incl.
void testRemoteWindow01()
static void main(final String args[])
CapabilitiesImmutable getChosenCapabilities()
Return the capabilities reflecting this graphics configuration, which may differ from the capabilitie...
A interface describing a graphics device in a toolkit-independent manner.
Specifies an immutable set of capabilities that a window's rendering context must support,...
int getBlueBits()
Returns the number of bits for the color buffer's blue component.
int getRedBits()
Returns the number of bits for the color buffer's red component.
int getGreenBits()
Returns the number of bits for the color buffer's green component.
boolean isOnscreen()
Returns whether an on- or offscreen surface is requested, available or chosen.
AbstractGraphicsConfiguration getGraphicsConfiguration()
Returns the graphics configuration corresponding to this window.
Specifying NEWT's Window functionality:
void setSize(int width, int height)
Sets the size of the window's client area in window units, excluding decorations.
void setVisible(boolean visible)
Calls setVisible(true, visible), i.e.
void setUndecorated(boolean value)
void destroy()
Destroys this window incl.releasing all related resources.