From 24485ead77a368ae3b77108248e067ad1f44ef0a Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * Checkbox toggles GLCanvas visibility state.
- *
- * Validates bugs:
- *
- *
- *
- * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 - *
- */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBug816OSXCALayerPos03aAWT extends UITestCase { - static long duration = 1600; // ms - static int width=640, height=480; - - @Test - public void test() throws InterruptedException, InvocationTargetException { - final GLCapabilities caps = new GLCapabilities(getGLP()); - - final Frame frame = new Frame("TestBug816OSXCALayerPos03aAWT"); - Assert.assertNotNull(frame); - - final GLCanvas glCanvas1 = new GLCanvas(caps); - Assert.assertNotNull(glCanvas1); - glCanvas1.addGLEventListener(new GearsES2(1)); - - final Animator animator = new Animator(); - animator.add(glCanvas1); - QuitAdapter quitAdapter = new QuitAdapter(); - - new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - - // Create a check box that hides / shows canvas - final Checkbox checkbox = new Checkbox("Visible canvas", true); - checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { - glCanvas1.setVisible(checkbox.getState()); - System.out.println("Canvas visible: "+glCanvas1.isVisible()); - if( glCanvas1.isVisible() ) { - frame.validate(); // take care of resized frame while hidden - } - } - }); - - // Build a GUI that displays canvas and check box - frame.setLayout(new BorderLayout()); - frame.add(glCanvas1, BorderLayout.CENTER); - frame.add(checkbox, BorderLayout.NORTH); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setSize(width, height); - frame.setVisible(true); - }}); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - - animator.start(); - Assert.assertTrue(animator.isStarted()); - Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - - final long t0 = System.currentTimeMillis(); - long t1 = t0; - while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { - Thread.sleep(100); - t1 = System.currentTimeMillis(); - } - - Assert.assertNotNull(frame); - Assert.assertNotNull(glCanvas1); - - Assert.assertNotNull(animator); - animator.stop(); - Assert.assertFalse(animator.isAnimating()); - Assert.assertFalse(animator.isStarted()); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(false); - }}); - Assert.assertEquals(false, frame.isVisible()); - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.remove(glCanvas1); - frame.dispose(); - }}); - } - - static GLProfile getGLP() { - return GLProfile.getMaxProgrammableCore(true); - } - - public static void main(String args[]) { - for(int i=0; i+ * Validates bugs: + *
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 + *
+ */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBug816OSXCALayerPos03aB729AWT extends UITestCase { + static long duration = 1600; // ms + static int width=640, height=480; + + @Test + public void test() throws InterruptedException, InvocationTargetException { + final GLCapabilities caps = new GLCapabilities(getGLP()); + + final Frame frame = new Frame("TestBug816OSXCALayerPos03aAWT"); + Assert.assertNotNull(frame); + + final GLCanvas glCanvas1 = new GLCanvas(caps); + Assert.assertNotNull(glCanvas1); + glCanvas1.addGLEventListener(new GearsES2(1)); + + final Animator animator = new Animator(); + animator.add(glCanvas1); + QuitAdapter quitAdapter = new QuitAdapter(); + + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); + + // Create a check box that hides / shows canvas + final Checkbox checkbox = new Checkbox("Visible canvas", true); + checkbox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent ev) { + glCanvas1.setVisible(checkbox.getState()); + System.out.println("Canvas visible: "+glCanvas1.isVisible()); + if( glCanvas1.isVisible() ) { + frame.validate(); // take care of resized frame while hidden + } + } + }); + + // Build a GUI that displays canvas and check box + frame.setLayout(new BorderLayout()); + frame.add(glCanvas1, BorderLayout.CENTER); + frame.add(checkbox, BorderLayout.NORTH); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setSize(width, height); + frame.setVisible(true); + }}); + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + + animator.start(); + Assert.assertTrue(animator.isStarted()); + Assert.assertTrue(animator.isAnimating()); + animator.setUpdateFPSFrames(60, System.err); + + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { + Thread.sleep(100); + t1 = System.currentTimeMillis(); + } + + Assert.assertNotNull(frame); + Assert.assertNotNull(glCanvas1); + + Assert.assertNotNull(animator); + animator.stop(); + Assert.assertFalse(animator.isAnimating()); + Assert.assertFalse(animator.isStarted()); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + }}); + Assert.assertEquals(false, frame.isVisible()); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.remove(glCanvas1); + frame.dispose(); + }}); + } + + static GLProfile getGLP() { + return GLProfile.getMaxProgrammableCore(true); + } + + public static void main(String args[]) { + for(int i=0; i- * Validates bugs: - *
- * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 - *
- */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBug816OSXCALayerPos03bAWT extends UITestCase { - static long duration = 1600; // ms - static int width=640, height=480; - - @Test - public void test() throws InterruptedException, InvocationTargetException { - final GLCapabilities caps = new GLCapabilities(getGLP()); - - final Frame frame = new Frame("TestBug816OSXCALayerPos03bAWT"); - Assert.assertNotNull(frame); - - final GLCanvas glCanvas1 = new GLCanvas(caps); - Assert.assertNotNull(glCanvas1); - glCanvas1.addGLEventListener(new GearsES2(1)); - // Put it in a panel - final Panel panel = new Panel(new GridLayout(1, 1)); - panel.add(glCanvas1); - - final Animator animator = new Animator(); - animator.add(glCanvas1); - QuitAdapter quitAdapter = new QuitAdapter(); - - new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - - // Create a check box that hides / shows canvas - final Checkbox checkbox = new Checkbox("Visible canvas", true); - checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { - panel.setVisible(checkbox.getState()); - System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]"); - if( panel.isVisible() ) { - frame.validate(); // take care of resized frame while hidden - } - } - }); - - // Build a GUI that displays canvas and check box - frame.setLayout(new BorderLayout()); - frame.add(panel, BorderLayout.CENTER); - frame.add(checkbox, BorderLayout.NORTH); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setSize(width, height); - frame.setVisible(true); - }}); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - - animator.start(); - Assert.assertTrue(animator.isStarted()); - Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - - final long t0 = System.currentTimeMillis(); - long t1 = t0; - while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { - Thread.sleep(100); - t1 = System.currentTimeMillis(); - } - - Assert.assertNotNull(frame); - Assert.assertNotNull(glCanvas1); - - Assert.assertNotNull(animator); - animator.stop(); - Assert.assertFalse(animator.isAnimating()); - Assert.assertFalse(animator.isStarted()); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(false); - }}); - Assert.assertEquals(false, frame.isVisible()); - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.remove(panel); - frame.dispose(); - }}); - } - - static GLProfile getGLP() { - return GLProfile.getMaxProgrammableCore(true); - } - - public static void main(String args[]) { - for(int i=0; i+ * Validates bugs: + *
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 + *
+ */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBug816OSXCALayerPos03bB849AWT extends UITestCase { + static long duration = 1600; // ms + static int width=640, height=480; + + @Test + public void test() throws InterruptedException, InvocationTargetException { + final GLCapabilities caps = new GLCapabilities(getGLP()); + + final Frame frame = new Frame("TestBug816OSXCALayerPos03bAWT"); + Assert.assertNotNull(frame); + + final GLCanvas glCanvas1 = new GLCanvas(caps); + Assert.assertNotNull(glCanvas1); + glCanvas1.addGLEventListener(new GearsES2(1)); + // Put it in a panel + final Panel panel = new Panel(new GridLayout(1, 1)); + panel.add(glCanvas1); + + final Animator animator = new Animator(); + animator.add(glCanvas1); + QuitAdapter quitAdapter = new QuitAdapter(); + + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); + + // Create a check box that hides / shows canvas + final Checkbox checkbox = new Checkbox("Visible canvas", true); + checkbox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent ev) { + panel.setVisible(checkbox.getState()); + System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]"); + if( panel.isVisible() ) { + frame.validate(); // take care of resized frame while hidden + } + } + }); + + // Build a GUI that displays canvas and check box + frame.setLayout(new BorderLayout()); + frame.add(panel, BorderLayout.CENTER); + frame.add(checkbox, BorderLayout.NORTH); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setSize(width, height); + frame.setVisible(true); + }}); + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + + animator.start(); + Assert.assertTrue(animator.isStarted()); + Assert.assertTrue(animator.isAnimating()); + animator.setUpdateFPSFrames(60, System.err); + + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { + Thread.sleep(100); + t1 = System.currentTimeMillis(); + } + + Assert.assertNotNull(frame); + Assert.assertNotNull(glCanvas1); + + Assert.assertNotNull(animator); + animator.stop(); + Assert.assertFalse(animator.isAnimating()); + Assert.assertFalse(animator.isStarted()); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + }}); + Assert.assertEquals(false, frame.isVisible()); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.remove(panel); + frame.dispose(); + }}); + } + + static GLProfile getGLP() { + return GLProfile.getMaxProgrammableCore(true); + } + + public static void main(String args[]) { + for(int i=0; i- * Validates bugs: - *
- * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 - *
- */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestBug816OSXCALayerPos03cAWT extends UITestCase { - static long duration = 1600; // ms - static int width=640, height=480; - - @Test - public void test() throws InterruptedException, InvocationTargetException { - final GLCapabilities caps = new GLCapabilities(getGLP()); - - final JFrame frame = new JFrame("TestBug816OSXCALayerPos03cAWT"); - Assert.assertNotNull(frame); - final Container framePane = frame.getContentPane(); - - final GLCanvas glCanvas1 = new GLCanvas(caps); - Assert.assertNotNull(glCanvas1); - glCanvas1.addGLEventListener(new GearsES2(1)); - // Put it in a panel - final JPanel panel = new JPanel(new GridLayout(1, 1)); - panel.add(glCanvas1); - - final Animator animator = new Animator(); - animator.add(glCanvas1); - QuitAdapter quitAdapter = new QuitAdapter(); - - new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); - - // Create a check box that hides / shows canvas - final JCheckBox checkbox = new JCheckBox("Visible canvas", true); - checkbox.addItemListener(new ItemListener() { - public void itemStateChanged(ItemEvent ev) { - panel.setVisible(checkbox.getSelectedObjects()!=null); - System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]"); - if( panel.isVisible() ) { - frame.validate(); // take care of resized frame while hidden - } - } - }); - - // Build a GUI that displays canvas and check box - framePane.setLayout(new BorderLayout()); - framePane.add(panel, BorderLayout.CENTER); - framePane.add(checkbox, BorderLayout.NORTH); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setSize(width, height); - frame.setVisible(true); - }}); - Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); - Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); - - animator.start(); - Assert.assertTrue(animator.isStarted()); - Assert.assertTrue(animator.isAnimating()); - animator.setUpdateFPSFrames(60, System.err); - - final long t0 = System.currentTimeMillis(); - long t1 = t0; - while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { - Thread.sleep(100); - t1 = System.currentTimeMillis(); - } - - Assert.assertNotNull(frame); - Assert.assertNotNull(glCanvas1); - - Assert.assertNotNull(animator); - animator.stop(); - Assert.assertFalse(animator.isAnimating()); - Assert.assertFalse(animator.isStarted()); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(false); - }}); - Assert.assertEquals(false, frame.isVisible()); - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - framePane.remove(panel); - frame.dispose(); - }}); - } - - static GLProfile getGLP() { - return GLProfile.getMaxProgrammableCore(true); - } - - public static void main(String args[]) { - for(int i=0; i+ * Validates bugs: + *
+ * Diff. OSX CALayer positioning w/ java6, [7uxx..7u40[, and >= 7u40 + *
+ */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestBug816OSXCALayerPos03cB849AWT extends UITestCase { + static long duration = 1600; // ms + static int width=640, height=480; + + @Test + public void test() throws InterruptedException, InvocationTargetException { + final GLCapabilities caps = new GLCapabilities(getGLP()); + + final JFrame frame = new JFrame("TestBug816OSXCALayerPos03cAWT"); + Assert.assertNotNull(frame); + final Container framePane = frame.getContentPane(); + + final GLCanvas glCanvas1 = new GLCanvas(caps); + Assert.assertNotNull(glCanvas1); + glCanvas1.addGLEventListener(new GearsES2(1)); + // Put it in a panel + final JPanel panel = new JPanel(new GridLayout(1, 1)); + panel.add(glCanvas1); + + final Animator animator = new Animator(); + animator.add(glCanvas1); + QuitAdapter quitAdapter = new QuitAdapter(); + + new AWTWindowAdapter(new TraceWindowAdapter(quitAdapter)).addTo(frame); + + // Create a check box that hides / shows canvas + final JCheckBox checkbox = new JCheckBox("Visible canvas", true); + checkbox.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent ev) { + panel.setVisible(checkbox.getSelectedObjects()!=null); + System.out.println("Visible: [panel "+panel.isVisible()+", canvas "+glCanvas1.isVisible()+"]; Displayable: [panel "+panel.isDisplayable()+", canvas "+glCanvas1.isDisplayable()+"]"); + if( panel.isVisible() ) { + frame.validate(); // take care of resized frame while hidden + } + } + }); + + // Build a GUI that displays canvas and check box + framePane.setLayout(new BorderLayout()); + framePane.add(panel, BorderLayout.CENTER); + framePane.add(checkbox, BorderLayout.NORTH); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setSize(width, height); + frame.setVisible(true); + }}); + Assert.assertEquals(true, AWTRobotUtil.waitForVisible(frame, true)); + Assert.assertEquals(true, AWTRobotUtil.waitForRealized(glCanvas1, true)); + + animator.start(); + Assert.assertTrue(animator.isStarted()); + Assert.assertTrue(animator.isAnimating()); + animator.setUpdateFPSFrames(60, System.err); + + final long t0 = System.currentTimeMillis(); + long t1 = t0; + while(!quitAdapter.shouldQuit() && t1 - t0 < duration) { + Thread.sleep(100); + t1 = System.currentTimeMillis(); + } + + Assert.assertNotNull(frame); + Assert.assertNotNull(glCanvas1); + + Assert.assertNotNull(animator); + animator.stop(); + Assert.assertFalse(animator.isAnimating()); + Assert.assertFalse(animator.isStarted()); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + }}); + Assert.assertEquals(false, frame.isVisible()); + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + framePane.remove(panel); + frame.dispose(); + }}); + } + + static GLProfile getGLP() { + return GLProfile.getMaxProgrammableCore(true); + } + + public static void main(String args[]) { + for(int i=0; i