git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'merge/JAL-3140' into develop
[jalview.git]
/
test
/
jalview
/
gui
/
ProgressBarTest.java
diff --git
a/test/jalview/gui/ProgressBarTest.java
b/test/jalview/gui/ProgressBarTest.java
index
4346420
..
72a288b
100644
(file)
--- a/
test/jalview/gui/ProgressBarTest.java
+++ b/
test/jalview/gui/ProgressBarTest.java
@@
-29,13
+29,22
@@
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
import org.testng.Assert;
import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class ProgressBarTest
{
import org.testng.annotations.Test;
public class ProgressBarTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
private JPanel statusPanel;
private JLabel statusBar;
private JPanel statusPanel;
private JLabel statusBar;
@@
-111,8
+120,15
@@
public class ProgressBarTest
* @param layout
* @param msgs
*/
* @param layout
* @param msgs
*/
- private void verifyProgress(GridLayout layout, String[] msgs)
+ private void verifyProgress(final GridLayout layout, final String[] msgs)
{
{
+ try
+ {
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
int msgCount = msgs.length;
assertEquals(1 + msgCount, layout.getRows());
assertEquals(msgCount, statusPanel.getComponentCount());
int msgCount = msgs.length;
assertEquals(1 + msgCount, layout.getRows());
assertEquals(msgCount, statusPanel.getComponentCount());
@@
-124,5
+140,13
@@
public class ProgressBarTest
assertEquals(msgs[i++],
((JLabel) ((JPanel) c).getComponent(0)).getText());
}
assertEquals(msgs[i++],
((JLabel) ((JPanel) c).getComponent(0)).getText());
}
+ }
+ });
+ } catch (Exception e)
+ {
+ throw new AssertionError(
+ "Unexpected exception waiting for progress bar validation",
+ e);
+ }
}
}
}
}