View Javadoc
1 /* 2 * Scope: a generic MVC framework. 3 * Copyright (c) 2000-2002, The Scope team 4 * All rights reserved. 5 * 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * Neither the name "Scope" nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 27 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 28 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 29 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 30 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 31 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 32 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 33 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 * 35 * 36 * $Id: SuiteViewSwing.java,v 1.8 2002/09/14 11:45:34 ludovicc Exp $ 37 */ 38 package test.view.swing; 39 40 import javax.swing.SwingUtilities; 41 import junit.framework.Test; 42 import junit.framework.TestCase; 43 44 import junit.framework.TestSuite; 45 import org.scopemvc.controller.basic.ViewContext; 46 import org.scopemvc.controller.swing.SwingContext; 47 48 /*** 49 * <P> 50 * 51 * </P> 52 * 53 * @author <A HREF="mailto:smeyfroi@users.sourceforge.net>;Steve Meyfroidt</A> 54 * @created 12 September 2002 55 * @version $Revision: 1.8 $ $Date: 2002/09/14 11:45:34 $ 56 */ 57 public final class SuiteViewSwing extends TestCase { 58 59 /*** 60 * Constructor for the SuiteViewSwing object 61 * 62 * @param inName TODO: Describe the Parameter 63 */ 64 public SuiteViewSwing(String inName) { 65 super(inName); 66 } 67 68 69 /*** 70 * A unit test suite for JUnit 71 * 72 * @return The test suite 73 */ 74 public static Test suite() { 75 TestSuite suite = new TestSuite(); 76 suite.addTest(new TestSuite(TestSTableModel.class)); 77 suite.addTest(new TestSuite(TestSAbstractListModel.class)); 78 suite.addTest(new TestSuite(TestSComboBoxModel.class)); 79 suite.addTest(new TestSuite(TestSComboBox.class)); 80 suite.addTest(new TestSuite(TestSTable.class)); 81 suite.addTest(new TestSuite(TestValidationHelper.class)); 82 suite.addTest(new TestSuite(TestSButton.class)); 83 suite.addTest(new TestSuite(TestSCheckBox.class)); 84 suite.addTest(new TestSuite(TestSTextField.class)); 85 suite.addTest(new TestSuite(TestSTextArea.class)); 86 suite.addTest(new TestSuite(TestSLabel.class)); 87 suite.addTest(new TestSuite(TestSMenuItem.class)); 88 suite.addTest(new TestSuite(TestSwingView.class)); 89 suite.addTest(new TestSuite(TestSPanel.class)); 90 suite.addTest(new TestSuite(TestSUnboundPanel.class)); 91 suite.addTest(new TestSuite(TestSListCellRenderer.class)); 92 suite.addTest(new TestSuite(TestSListSelectionModel.class)); 93 suite.addTest(new TestSuite(TestSList.class)); 94 suite.addTest(new TestSuite(TestSRadioButton.class)); 95 suite.addTest(new TestSuite(TestSPasswordField.class)); 96 suite.addTest(new TestSuite(TestSSlider.class)); 97 suite.addTest(new TestSuite(TestSAction.class)); 98 suite.addTest(new TestSuite(TestSModelAction.class)); 99 suite.addTest(new TestSuite(TestSModelButton.class)); 100 return suite; 101 } 102 103 /*** 104 * Wait for AWT / Swing to execute all events in its event queue 105 * 106 * @throws Exception TODO: Describe the Exception 107 */ 108 public static void waitForAWT() throws Exception { 109 waitForAWT(100, 2000); 110 waitForAWT(100, 8000); 111 } 112 113 114 /*** 115 * The JUnit setup method 116 */ 117 public void setUp() { 118 ViewContext.setGlobalContext(new SwingContext()); 119 } 120 121 private static void waitForAWT(final long startDelay, final long timeout) throws Exception { 122 final Object lock = new Object(); 123 SwingUtilities.invokeLater( 124 new Runnable() { 125 public void run() { 126 synchronized (lock) { 127 try { 128 lock.wait(startDelay); 129 } catch (Exception ignore) {} 130 lock.notifyAll(); 131 } 132 } 133 }); 134 synchronized (lock) { 135 lock.notifyAll(); 136 lock.wait(timeout); 137 } 138 } 139 } 140

This page was automatically generated by Maven