29package com.jogamp.opengl.test.junit.newt;
31import org.junit.Assert;
32import org.junit.BeforeClass;
34import org.junit.FixMethodOrder;
35import org.junit.runners.MethodSorters;
37import com.jogamp.nativewindow.*;
39import com.jogamp.newt.*;
40import java.io.IOException;
42import com.jogamp.opengl.test.junit.util.UITestCase;
44@FixMethodOrder(MethodSorters.NAME_ASCENDING)
46 static int width, height;
55 static Window createWindow(
final Capabilities caps,
final int x,
final int y,
final int width,
final int height,
final boolean onscreen,
final boolean undecorated)
throws InterruptedException {
56 final boolean userPos = x>=0 && y>=0 ;
58 Assert.assertNotNull(caps);
59 caps.setOnscreen(onscreen);
66 Assert.assertNotNull(window);
75 Assert.assertEquals(
false,window.
isVisible());
81 Assert.assertEquals(
true,window.
isVisible());
83 Assert.assertEquals(width, window.
getWidth());
84 Assert.assertEquals(height, window.
getHeight());
96 Assert.assertNotNull(chosenCapabilities);
98 Assert.assertTrue(chosenCapabilities.
getBlueBits()>=5);
99 Assert.assertTrue(chosenCapabilities.
getRedBits()>=5);
100 Assert.assertEquals(chosenCapabilities.
isOnscreen(),onscreen);
105 static void destroyWindow(
final Window window,
final boolean last) {
121 Assert.assertEquals(
false,window.
isVisible());
128 Assert.assertNotNull(caps);
130 final Window window = createWindow(caps, -1, -1, width, height,
true ,
false );
131 destroyWindow(window,
true);
138 Assert.assertNotNull(caps);
140 final Window window = createWindow(caps, 100, 100, width, height,
true ,
false );
141 destroyWindow(window,
true);
147 Assert.assertNotNull(caps);
149 final Window window = createWindow(caps, -1, -1, width, height,
true ,
false );
150 destroyWindow(window,
true);
154 Assert.assertEquals(
true,window.
isVisible());
155 Assert.assertEquals(width, window.
getWidth());
156 Assert.assertEquals(height, window.
getHeight());
158 destroyWindow(window,
true);
164 Assert.assertNotNull(caps);
166 final Window window = createWindow(caps, -1, -1, width, height,
true ,
false );
167 destroyWindow(window,
true);
168 destroyWindow(window,
true);
174 Assert.assertNotNull(caps);
176 final Window window1 = createWindow(caps, -1, -1, width, height,
true ,
false );
177 final Window window2 = createWindow(caps, 100, 100, width, height,
true ,
false );
178 destroyWindow(window2,
false);
179 destroyWindow(window1,
true);
182 public static void main(
final String args[])
throws IOException {
184 org.junit.runner.JUnitCore.
main(tstname);
Specifies a set of capabilities that a window's rendering context must support, such as color depth p...
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 boolean isNativeValid()
static Window createWindow(final CapabilitiesImmutable caps)
Create a top level Window entity on the default Display and default Screen.
A screen may span multiple MonitorDevices representing their combined virtual size.
abstract Display getDisplay()
abstract boolean isNativeValid()
void testWindowDecorTwoWin()
void testWindowDecorDestroyWinTwiceA()
void testWindowDecorSimpleUserPos()
void testWindowNativeRecreate01Simple()
void testWindowDecorSimpleWMPos()
static void main(final String args[])
CapabilitiesImmutable getChosenCapabilities()
Return the capabilities reflecting this graphics configuration, which may differ from the capabilitie...
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.
int getHeight()
Returns the height of the client area excluding insets (window decorations) in window units.
int getWidth()
Returns the width of the client area excluding insets (window decorations) in window units.
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 setPosition(int x, int y)
Sets the location of the window's client area excluding insets (window decorations) in window units.
void setUndecorated(boolean value)
void destroy()
Destroys this window incl.releasing all related resources.