[Schmitzm-commits] r909 - in trunk: src/schmitzm/swing src_junit/schmitzm/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Jun 20 20:05:03 CEST 2010


Author: alfonx
Date: 2010-06-20 20:05:02 +0200 (Sun, 20 Jun 2010)
New Revision: 909

Added:
   trunk/src/schmitzm/swing/TestingUtil.java
Removed:
   trunk/src_junit/schmitzm/swing/TestingUtil.java
Log:
Moved class TestingUtil intot he main src dir, as it is not availbale for JUnit tests in other projects otherwise.

Copied: trunk/src/schmitzm/swing/TestingUtil.java (from rev 908, trunk/src_junit/schmitzm/swing/TestingUtil.java)
===================================================================
--- trunk/src_junit/schmitzm/swing/TestingUtil.java	2010-06-13 01:04:51 UTC (rev 908)
+++ trunk/src/schmitzm/swing/TestingUtil.java	2010-06-20 18:05:02 UTC (rev 909)
@@ -0,0 +1,68 @@
+package schmitzm.swing;
+
+import java.awt.GraphicsEnvironment;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+
+import schmitzm.lang.LangUtil;
+
+/**
+ * Helpers to test Swing applications
+ * 
+ * @author stefan tzeggai
+ */
+public class TestingUtil {
+
+	public static final boolean INTERACTIVE = !GraphicsEnvironment.isHeadless();
+	
+
+	/**
+	 * Opens a {@link JFrame} and shows the passed {@link JComponent}. If a
+	 * {@link ExceptionDialog} is opens in the GUI, an exception is thrown.<br/>
+	 * The test is skipped if the JVM is running headless.
+	 * 
+	 * @param contentPane
+	 * @param title can be used to explain the tests what to check
+	 */
+	public static void testPanel(JComponent contentPane, String title) throws Throwable {
+
+		final AtomicBoolean stopFlag = new AtomicBoolean(false);
+
+		final AtomicReference<Throwable> err = new AtomicReference<Throwable>();
+
+		if (GraphicsEnvironment.isHeadless())
+			return;
+
+		ExceptionDialog.addListener(new ActionListener() {
+
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				err.set((Throwable) e.getSource());
+				stopFlag.set(true);
+			}
+		});
+
+		JFrame f = new JFrame(title);
+		f.setContentPane(contentPane);
+		f.pack();
+		f.setVisible(true);
+		while (f.isVisible() && !stopFlag.get())
+			LangUtil.sleepExceptionless(100);
+		f.dispose();
+		if (stopFlag.get()) {
+			throw err.get();
+		}
+
+	}
+
+
+	public static void testPanel(JComponent contentPane) throws Throwable {
+		testPanel(contentPane,contentPane.getClass().getSimpleName());
+	}
+
+}


Property changes on: trunk/src/schmitzm/swing/TestingUtil.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Id URL
Name: svn:eol-style
   + native

Deleted: trunk/src_junit/schmitzm/swing/TestingUtil.java
===================================================================
--- trunk/src_junit/schmitzm/swing/TestingUtil.java	2010-06-13 01:04:51 UTC (rev 908)
+++ trunk/src_junit/schmitzm/swing/TestingUtil.java	2010-06-20 18:05:02 UTC (rev 909)
@@ -1,68 +0,0 @@
-package schmitzm.swing;
-
-import java.awt.GraphicsEnvironment;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicReference;
-
-import javax.swing.JComponent;
-import javax.swing.JFrame;
-
-import schmitzm.lang.LangUtil;
-
-/**
- * Helpers to test Swing applications
- * 
- * @author stefan tzeggai
- */
-public class TestingUtil {
-
-	public static final boolean INTERACTIVE = !GraphicsEnvironment.isHeadless();
-	
-
-	/**
-	 * Opens a {@link JFrame} and shows the passed {@link JComponent}. If a
-	 * {@link ExceptionDialog} is opens in the GUI, an exception is thrown.<br/>
-	 * The test is skipped if the JVM is running headless.
-	 * 
-	 * @param contentPane
-	 * @param title can be used to explain the tests what to check
-	 */
-	public static void testPanel(JComponent contentPane, String title) throws Throwable {
-
-		final AtomicBoolean stopFlag = new AtomicBoolean(false);
-
-		final AtomicReference<Throwable> err = new AtomicReference<Throwable>();
-
-		if (GraphicsEnvironment.isHeadless())
-			return;
-
-		ExceptionDialog.addListener(new ActionListener() {
-
-			@Override
-			public void actionPerformed(ActionEvent e) {
-				err.set((Throwable) e.getSource());
-				stopFlag.set(true);
-			}
-		});
-
-		JFrame f = new JFrame(title);
-		f.setContentPane(contentPane);
-		f.pack();
-		f.setVisible(true);
-		while (f.isVisible() && !stopFlag.get())
-			LangUtil.sleepExceptionless(100);
-		f.dispose();
-		if (stopFlag.get()) {
-			throw err.get();
-		}
-
-	}
-
-
-	public static void testPanel(JComponent contentPane) throws Throwable {
-		testPanel(contentPane,contentPane.getClass().getSimpleName());
-	}
-
-}



More information about the Schmitzm-commits mailing list