[Schmitzm-commits] r2318 - trunk/schmitzm-core/src/test/java/de/schmitzm/testing

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Mon May 27 17:24:35 CEST 2013


Author: mojays
Date: 2013-05-27 17:24:35 +0200 (Mon, 27 May 2013)
New Revision: 2318

Modified:
   trunk/schmitzm-core/src/test/java/de/schmitzm/testing/SwingUtilTest.java
Log:


Modified: trunk/schmitzm-core/src/test/java/de/schmitzm/testing/SwingUtilTest.java
===================================================================
--- trunk/schmitzm-core/src/test/java/de/schmitzm/testing/SwingUtilTest.java	2013-05-27 15:23:58 UTC (rev 2317)
+++ trunk/schmitzm-core/src/test/java/de/schmitzm/testing/SwingUtilTest.java	2013-05-27 15:24:35 UTC (rev 2318)
@@ -4,6 +4,7 @@
 
 import java.awt.BorderLayout;
 import java.awt.Color;
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.event.ActionEvent;
 import java.text.DecimalFormat;
@@ -11,16 +12,23 @@
 
 import javax.swing.AbstractAction;
 import javax.swing.JButton;
+import javax.swing.JFrame;
 
 import org.junit.Ignore;
 import org.junit.Test;
 
+import com.sun.jini.action.GetPropertyAction;
+
+import de.schmitzm.io.ConsoleProgressBar;
+import de.schmitzm.io.ProgressUpdater;
 import de.schmitzm.io.SMTPSettings;
 import de.schmitzm.swing.EditableComboBox;
 import de.schmitzm.swing.ExceptionDialog;
 import de.schmitzm.swing.JPanel;
+import de.schmitzm.swing.ProgressBarUpdater;
 import de.schmitzm.swing.SMTPSettingsPanel;
 import de.schmitzm.swing.SwingUtil;
+import de.schmitzm.swing.SwingWorker;
 import de.schmitzm.swing.input.FileInputOption;
 import de.schmitzm.swing.input.ManualInputOption;
 import de.schmitzm.swing.input.ManualInputOption.PasswordViewable;
@@ -112,11 +120,9 @@
       assertEquals(2, format.getMaximumFractionDigits());
 	}
 	
-	
-	
-	@Test
-	@Ignore
-	public void testFreeComboBox() throws Throwable {
+    @Test
+    @Ignore
+    public void testFreeComboBox() throws Throwable {
       if ( !isInteractive() )
         return;
       final Vector<String> items = new Vector<String>();
@@ -147,6 +153,34 @@
       panel.add(button, BorderLayout.SOUTH);
       
       TestingUtil.testGui(panel,-1);
+    }
+	
+	
+	@Test
+	@Ignore
+	public void testProgressBarUpdate() throws Throwable {
+      if ( !isInteractive() )
+        return;
+      
+      SwingWorker.Work work = new SwingWorker.Work() {
+        @Override
+        public Object execute() throws Exception {
+          ProgressUpdater updater = new ProgressBarUpdater(getSwingWorker().getDialog().getProgressBar());
+//          ProgressUpdater updater = new ConsoleProgressBar();
+          final int maxValue = 65;
+          updater.initProgress(0, maxValue);
+          
+          for (int i=0; i<=maxValue; i++) {
+            Thread.sleep(100);
+            updater.updateProgress(i);
+          }
+          return null;
+        }
+      };
+      SwingWorker worker = new SwingWorker(work, null, "Working...");
+      worker.setKeepOpen(true);
+      TestingUtil.testGui(new JPanel() ,0);
+      worker.start();
 	}
 	
 	@Test



More information about the Schmitzm-commits mailing list