From 733cc83bf15815102c8d745d5f912855354f818b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 9 Nov 2013 20:12:32 +0100 Subject: Tests: Add com/jogamp/opengl/test/junit/jogl/acore/anim Animator test package --- .../jogl/acore/anim/Bug898AnimatorFromEDTAWT.java | 129 +++++++++ .../TestAWTCardLayoutAnimatorStartStopBug532.java | 228 ++++++++++++++++ .../jogl/acore/anim/TestAnimatorGLJPanel01AWT.java | 301 +++++++++++++++++++++ .../acore/anim/TestAnimatorGLWindow01NEWT.java | 267 ++++++++++++++++++ .../junit/jogl/awt/Bug898AnimatorFromEDTAWT.java | 129 --------- .../TestAWTCardLayoutAnimatorStartStopBug532.java | 228 ---------------- 6 files changed, 925 insertions(+), 357 deletions(-) create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLJPanel01AWT.java create mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAnimatorGLWindow01NEWT.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/awt/Bug898AnimatorFromEDTAWT.java delete mode 100644 src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java (limited to 'src') diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java new file mode 100644 index 000000000..55e045d48 --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/Bug898AnimatorFromEDTAWT.java @@ -0,0 +1,129 @@ +/** + * Copyright 2013 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 com.jogamp.opengl.test.junit.jogl.acore.anim; + +import java.awt.BorderLayout; +import java.awt.Dimension; + +import javax.media.opengl.GLAutoDrawable; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLEventListener; +import javax.media.opengl.GLProfile; +import javax.media.opengl.awt.GLCanvas; +import javax.swing.SwingUtilities; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.util.Animator; + +/** + * Manual test case to validate Animator pause/resume on AWT-EDT. + *

+ * Even though (AWT) Animator is not able to block until pause/resume is finished + * when issued on AWT-EDT, best effort shall be made to preserve functionality. + *

+ * Original Author: kosukek from JogAmp forum; Modifier a bit. + */ +@SuppressWarnings("serial") +public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { + + public Bug898AnimatorFromEDTAWT() { + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + //Layout + setMinimumSize(new Dimension(640, 480)); + getContentPane().setLayout(new BorderLayout()); + GLCanvas panel = new GLCanvas(new GLCapabilities(GLProfile.getMaxProgrammable(true))); + getContentPane().add(panel, BorderLayout.CENTER); + pack(); + //Animator + final Animator animator = new Animator(); + animator.add(panel); + //GLEventListener + panel.addGLEventListener(new GearsES2(1)); + panel.addGLEventListener(new GLEventListener() { + long startTime = 0, lastTime = 0; + long step = 1; + + @Override + public void init(GLAutoDrawable glad) { + startTime = System.currentTimeMillis(); + } + + @Override + public void dispose(GLAutoDrawable glad) { + } + + @Override + public void display(GLAutoDrawable glad) { + long time = System.currentTimeMillis(); + if (animator.isAnimating() && step * 2000 < time - startTime) { + long td = time - lastTime; + lastTime = time; + animator.pause(); + System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator); + new Thread() { + public void run() { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + long td = System.currentTimeMillis() - lastTime; + if (animator.isPaused()) { + animator.resume(); //Doesn't work on v2.0.2 or higher + System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator); + } else { + System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator); + } + } } ); + } + }.start(); + step++; + } + } + + @Override + public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) { + } + }); + //Start animation + animator.start(); + System.out.println("animator.start()"); + } + + public static void main(String args[]) { + java.awt.EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + new Bug898AnimatorFromEDTAWT().setVisible(true); + } + }); + } +} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java new file mode 100644 index 000000000..7f861d89b --- /dev/null +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/anim/TestAWTCardLayoutAnimatorStartStopBug532.java @@ -0,0 +1,228 @@ +package com.jogamp.opengl.test.junit.jogl.acore.anim; + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Dimension; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; + +import javax.media.opengl.GLAnimatorControl; +import javax.media.opengl.GLCapabilities; +import javax.media.opengl.GLProfile; +import javax.media.opengl.awt.GLCanvas; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +import org.junit.Test; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; + +import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; +import com.jogamp.opengl.test.junit.util.MiscUtils; +import com.jogamp.opengl.test.junit.util.UITestCase; +import com.jogamp.opengl.util.Animator; +import com.jogamp.opengl.util.FPSAnimator; + +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase { + static final String LABEL = "Label"; + static final String CANVAS = "GLCanvas"; + + public enum AnimatorControlBehavior { + StartStop, PauseResume, Continue; + } + + static long durationPerTest = 200*4; // ms + static boolean manual = false; + static volatile boolean shouldStop = false; + + private String selected = LABEL; + + @Test + public void testFPSAnimatorStartStop() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.StartStop, true); + } + + @Test + public void testFPSAnimatorResumePause() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.PauseResume, true); + } + + @Test + public void testFPSAnimatorContinue() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.Continue, true); + } + + @Test + public void testAnimatorStartStop() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.StartStop, false); + } + + @Test + public void testAnimatorResumePause() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.PauseResume, false); + } + + @Test + public void testAnimatorContinue() throws InterruptedException, InvocationTargetException { + testImpl(AnimatorControlBehavior.Continue, false); + } + + void testImpl(final AnimatorControlBehavior animCtrl, boolean useFPSAnimator) throws InterruptedException, InvocationTargetException { + final GLProfile glp = GLProfile.get(GLProfile.GL2); + final GLCapabilities caps = new GLCapabilities(glp); + final GLCanvas canvas = new GLCanvas(caps); + canvas.setPreferredSize(new Dimension(640, 480)); + + final GLAnimatorControl animatorCtrl = useFPSAnimator ? new FPSAnimator(canvas, 60) : new Animator(canvas); + animatorCtrl.setUpdateFPSFrames(60, null);// System.err); + switch (animCtrl) { + case PauseResume: + animatorCtrl.start(); + animatorCtrl.pause(); + break; + case Continue: + animatorCtrl.start(); + break; + default: + } + + canvas.addGLEventListener(new GearsES2(1)); + /* if(Platform.OS_TYPE == Platform.OSType.WINDOWS) { + canvas.addGLEventListener(new GLEventListener() { + public void init(GLAutoDrawable drawable) { } + public void dispose(GLAutoDrawable drawable) { } + public void display(GLAutoDrawable drawable) { + final NativeWindow win = (NativeWindow) drawable.getNativeSurface(); + long hdc = win.getSurfaceHandle(); + long hdw = win.getWindowHandle(); + long hdw_hdc = GDI.WindowFromDC(hdc); + System.err.println("*** hdc 0x"+Long.toHexString(hdc)+", hdw(hdc) 0x"+Long.toHexString(hdw_hdc)+", hdw 0x"+Long.toHexString(hdw) + " - " + Thread.currentThread().getName() + ", " + animatorCtrl); + // System.err.println(drawable.getNativeSurface().toString()); + } + public void reshape(GLAutoDrawable drawable, int x, int y, int width, + int height) { } + }); + } */ + + final JFrame frame = new JFrame(); + frame.setTitle(getSimpleTestName(" - ")); + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + animatorCtrl.stop(); + shouldStop = true; + } + }); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + + final JPanel cards = new JPanel(new CardLayout()); + final JPanel comboBoxPanel = new JPanel(); // nicer look .. + final JComboBox comboBox = new JComboBox(new String[] { LABEL, CANVAS }); + comboBox.setEditable(false); + comboBox.addItemListener(new ItemListener() { + public void itemStateChanged(final ItemEvent evt) { + final CardLayout cl = (CardLayout)(cards.getLayout()); + final String newSelection = (String)evt.getItem(); + if(!newSelection.equals(selected)) { + final String oldSelected = selected; + if(newSelection.equals(CANVAS)) { + cl.show(cards, CANVAS); + switch (animCtrl) { + case StartStop: + animatorCtrl.start(); + break; + case PauseResume: + animatorCtrl.resume(); + break; + default: + } + selected = CANVAS; + } else if(newSelection.equals(LABEL)) { + switch (animCtrl) { + case StartStop: + animatorCtrl.stop(); + break; + case PauseResume: + animatorCtrl.pause(); + break; + default: + } + cl.show(cards, LABEL); + selected = LABEL; + } else { + throw new RuntimeException("oops .. unexpected item: "+evt); + } + System.err.println("Item Change: "+oldSelected+" -> "+selected+", "+animatorCtrl); + } else { + System.err.println("Item Stays: "+selected+", "+animatorCtrl); + } + } + }); + comboBoxPanel.add(comboBox); + + cards.add(new JLabel("A label to cover the canvas"), LABEL); + cards.add(canvas, CANVAS); + + frame.add(comboBoxPanel, BorderLayout.PAGE_START); + frame.add(cards, BorderLayout.CENTER); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.pack(); + frame.setVisible(true); + }}); + + if(manual) { + for(long w=durationPerTest; !shouldStop && w>0; w-=100) { + Thread.sleep(100); + } + } else { + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + comboBox.setSelectedItem(LABEL); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + comboBox.setSelectedItem(CANVAS); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + comboBox.setSelectedItem(LABEL); + }}); + Thread.sleep(durationPerTest/4); + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + comboBox.setSelectedItem(CANVAS); + }}); + Thread.sleep(durationPerTest/4); + } + + javax.swing.SwingUtilities.invokeAndWait(new Runnable() { + public void run() { + frame.setVisible(false); + frame.dispose(); + }}); + + } + + public static void main(String args[]) { + for(int i=0; i - * Even though (AWT) Animator is not able to block until pause/resume is finished - * when issued on AWT-EDT, best effort shall be made to preserve functionality. - *

- * Original Author: kosukek from JogAmp forum; Modifier a bit. - */ -@SuppressWarnings("serial") -public class Bug898AnimatorFromEDTAWT extends javax.swing.JFrame { - - public Bug898AnimatorFromEDTAWT() { - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - //Layout - setMinimumSize(new Dimension(640, 480)); - getContentPane().setLayout(new BorderLayout()); - GLCanvas panel = new GLCanvas(new GLCapabilities(GLProfile.getMaxProgrammable(true))); - getContentPane().add(panel, BorderLayout.CENTER); - pack(); - //Animator - final Animator animator = new Animator(); - animator.add(panel); - //GLEventListener - panel.addGLEventListener(new GearsES2(1)); - panel.addGLEventListener(new GLEventListener() { - long startTime = 0, lastTime = 0; - long step = 1; - - @Override - public void init(GLAutoDrawable glad) { - startTime = System.currentTimeMillis(); - } - - @Override - public void dispose(GLAutoDrawable glad) { - } - - @Override - public void display(GLAutoDrawable glad) { - long time = System.currentTimeMillis(); - if (animator.isAnimating() && step * 2000 < time - startTime) { - long td = time - lastTime; - lastTime = time; - animator.pause(); - System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.pause(): paused "+animator); - new Thread() { - public void run() { - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - SwingUtilities.invokeLater(new Runnable() { - @Override - public void run() { - long td = System.currentTimeMillis() - lastTime; - if (animator.isPaused()) { - animator.resume(); //Doesn't work on v2.0.2 or higher - System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): animating "+animator); - } else { - System.out.println(Thread.currentThread().getName()+": #"+step+" "+td+" ms: animator.resume(): Ooops - not paused! - animating "+animator); - } - } } ); - } - }.start(); - step++; - } - } - - @Override - public void reshape(GLAutoDrawable glad, int i, int i1, int i2, int i3) { - } - }); - //Start animation - animator.start(); - System.out.println("animator.start()"); - } - - public static void main(String args[]) { - java.awt.EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - new Bug898AnimatorFromEDTAWT().setVisible(true); - } - }); - } -} diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java deleted file mode 100644 index d757d9522..000000000 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestAWTCardLayoutAnimatorStartStopBug532.java +++ /dev/null @@ -1,228 +0,0 @@ -package com.jogamp.opengl.test.junit.jogl.awt; - -import java.awt.BorderLayout; -import java.awt.CardLayout; -import java.awt.Dimension; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.lang.reflect.InvocationTargetException; - -import javax.media.opengl.GLAnimatorControl; -import javax.media.opengl.GLCapabilities; -import javax.media.opengl.GLProfile; -import javax.media.opengl.awt.GLCanvas; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.junit.Test; -import org.junit.FixMethodOrder; -import org.junit.runners.MethodSorters; - -import com.jogamp.opengl.test.junit.jogl.demos.es2.GearsES2; -import com.jogamp.opengl.test.junit.util.MiscUtils; -import com.jogamp.opengl.test.junit.util.UITestCase; -import com.jogamp.opengl.util.Animator; -import com.jogamp.opengl.util.FPSAnimator; - -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -public class TestAWTCardLayoutAnimatorStartStopBug532 extends UITestCase { - static final String LABEL = "Label"; - static final String CANVAS = "GLCanvas"; - - public enum AnimatorControlBehavior { - StartStop, PauseResume, Continue; - } - - static long durationPerTest = 200*4; // ms - static boolean manual = false; - static volatile boolean shouldStop = false; - - private String selected = LABEL; - - @Test - public void testFPSAnimatorStartStop() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.StartStop, true); - } - - @Test - public void testFPSAnimatorResumePause() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.PauseResume, true); - } - - @Test - public void testFPSAnimatorContinue() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.Continue, true); - } - - @Test - public void testAnimatorStartStop() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.StartStop, false); - } - - @Test - public void testAnimatorResumePause() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.PauseResume, false); - } - - @Test - public void testAnimatorContinue() throws InterruptedException, InvocationTargetException { - testImpl(AnimatorControlBehavior.Continue, false); - } - - void testImpl(final AnimatorControlBehavior animCtrl, boolean useFPSAnimator) throws InterruptedException, InvocationTargetException { - final GLProfile glp = GLProfile.get(GLProfile.GL2); - final GLCapabilities caps = new GLCapabilities(glp); - final GLCanvas canvas = new GLCanvas(caps); - canvas.setPreferredSize(new Dimension(640, 480)); - - final GLAnimatorControl animatorCtrl = useFPSAnimator ? new FPSAnimator(canvas, 60) : new Animator(canvas); - animatorCtrl.setUpdateFPSFrames(60, null);// System.err); - switch (animCtrl) { - case PauseResume: - animatorCtrl.start(); - animatorCtrl.pause(); - break; - case Continue: - animatorCtrl.start(); - break; - default: - } - - canvas.addGLEventListener(new GearsES2(1)); - /* if(Platform.OS_TYPE == Platform.OSType.WINDOWS) { - canvas.addGLEventListener(new GLEventListener() { - public void init(GLAutoDrawable drawable) { } - public void dispose(GLAutoDrawable drawable) { } - public void display(GLAutoDrawable drawable) { - final NativeWindow win = (NativeWindow) drawable.getNativeSurface(); - long hdc = win.getSurfaceHandle(); - long hdw = win.getWindowHandle(); - long hdw_hdc = GDI.WindowFromDC(hdc); - System.err.println("*** hdc 0x"+Long.toHexString(hdc)+", hdw(hdc) 0x"+Long.toHexString(hdw_hdc)+", hdw 0x"+Long.toHexString(hdw) + " - " + Thread.currentThread().getName() + ", " + animatorCtrl); - // System.err.println(drawable.getNativeSurface().toString()); - } - public void reshape(GLAutoDrawable drawable, int x, int y, int width, - int height) { } - }); - } */ - - final JFrame frame = new JFrame(); - frame.setTitle(getSimpleTestName(" - ")); - frame.addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { - animatorCtrl.stop(); - shouldStop = true; - } - }); - frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - - final JPanel cards = new JPanel(new CardLayout()); - final JPanel comboBoxPanel = new JPanel(); // nicer look .. - final JComboBox comboBox = new JComboBox(new String[] { LABEL, CANVAS }); - comboBox.setEditable(false); - comboBox.addItemListener(new ItemListener() { - public void itemStateChanged(final ItemEvent evt) { - final CardLayout cl = (CardLayout)(cards.getLayout()); - final String newSelection = (String)evt.getItem(); - if(!newSelection.equals(selected)) { - final String oldSelected = selected; - if(newSelection.equals(CANVAS)) { - cl.show(cards, CANVAS); - switch (animCtrl) { - case StartStop: - animatorCtrl.start(); - break; - case PauseResume: - animatorCtrl.resume(); - break; - default: - } - selected = CANVAS; - } else if(newSelection.equals(LABEL)) { - switch (animCtrl) { - case StartStop: - animatorCtrl.stop(); - break; - case PauseResume: - animatorCtrl.pause(); - break; - default: - } - cl.show(cards, LABEL); - selected = LABEL; - } else { - throw new RuntimeException("oops .. unexpected item: "+evt); - } - System.err.println("Item Change: "+oldSelected+" -> "+selected+", "+animatorCtrl); - } else { - System.err.println("Item Stays: "+selected+", "+animatorCtrl); - } - } - }); - comboBoxPanel.add(comboBox); - - cards.add(new JLabel("A label to cover the canvas"), LABEL); - cards.add(canvas, CANVAS); - - frame.add(comboBoxPanel, BorderLayout.PAGE_START); - frame.add(cards, BorderLayout.CENTER); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.pack(); - frame.setVisible(true); - }}); - - if(manual) { - for(long w=durationPerTest; !shouldStop && w>0; w-=100) { - Thread.sleep(100); - } - } else { - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - comboBox.setSelectedItem(LABEL); - }}); - Thread.sleep(durationPerTest/4); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - comboBox.setSelectedItem(CANVAS); - }}); - Thread.sleep(durationPerTest/4); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - comboBox.setSelectedItem(LABEL); - }}); - Thread.sleep(durationPerTest/4); - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - comboBox.setSelectedItem(CANVAS); - }}); - Thread.sleep(durationPerTest/4); - } - - javax.swing.SwingUtilities.invokeAndWait(new Runnable() { - public void run() { - frame.setVisible(false); - frame.dispose(); - }}); - - } - - public static void main(String args[]) { - for(int i=0; i