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 { final boolean userPos = x >= 0 && y >= 0; // user has specified a position Assert.assertNotNull(caps); caps.setOnscreen(onscreen); // System.out.println("Requested: "+caps); // // Create native windowing resources .. X11/Win/OSX // final Window window = NewtFactory.createWindow(caps); Assert.assertNotNull(window); final Screen screen = window.getScreen(); final Display display = screen.getDisplay(); window.setUndecorated(onscreen && undecorated); if (userPos) { window.setPosition(x, y); } window.setSize(width, height); Assert.assertEquals(false, window.isNativeValid()); Assert.assertEquals(false, window.isVisible()); window.setVisible(true); // System.err.println("************* Created: "+window); Assert.assertEquals(true, display.isNativeValid()); Assert.assertEquals(true, screen.isNativeValid()); Assert.assertEquals(true, window.isVisible()); Assert.assertEquals(true, window.isNativeValid()); Assert.assertEquals(width, window.getWidth()); Assert.assertEquals(height, window.getHeight()); /** * we don't sync on position - unreliable test Point p0 = window.getLocationOnScreen(null); * Assert.assertEquals(p0.getX(), window.getX()); Assert.assertEquals(p0.getY(), window.getY()); * if(userPos) { Assert.assertEquals(x, window.getX()); Assert.assertEquals(y, window.getY()); } */ final CapabilitiesImmutable chosenCapabilities = window.getGraphicsConfiguration().getChosenCapabilities(); Assert.assertNotNull(chosenCapabilities); Assert.assertTrue(chosenCapabilities.getGreenBits() >= 5); Assert.assertTrue(chosenCapabilities.getBlueBits() >= 5); Assert.assertTrue(chosenCapabilities.getRedBits() >= 5); Assert.assertEquals(chosenCapabilities.isOnscreen(), onscreen); return window; }