JAL-3253-applet JAL-3423 TestNG/Win
[jalview.git] / test / jalview / gui / AlignmentPanelTest.java
index 1b0ec35..fd67ac4 100644 (file)
@@ -33,8 +33,6 @@ import jalview.viewmodel.ViewportRanges;
 
 import java.lang.reflect.InvocationTargetException;
 
-import javax.swing.SwingUtilities;
-
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -145,14 +143,7 @@ public class AlignmentPanelTest
     af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
             DataSourceType.FILE);
     
-    /*
-     * ensure the panel has been repainted and so ViewportRanges set
-     */
-    SwingUtilities.invokeAndWait(new Runnable() {
-               @Override
-               public void run() {
-                   af.repaint();
-               }});
+    af.paintImmediately(af.getBounds());
 
     /*
      * wait for Consensus thread to complete
@@ -163,7 +154,7 @@ public class AlignmentPanelTest
       {
         try
         {
-          wait(50);
+          wait(250); // BH was 50
         } catch (InterruptedException e)
         {
         }
@@ -202,6 +193,8 @@ public class AlignmentPanelTest
     int scrollpos = 60;
     af.getViewport().hideColumns(30, 50);
     af.alignPanel.setScrollValues(scrollpos, 5);
+
+    af.paintImmediately(af.getBounds());
     assertEquals(ranges.getEndRes(), oldres + scrollpos);
 
     // scroll to position within hidden columns, still sets endres to oldres +
@@ -219,6 +212,7 @@ public class AlignmentPanelTest
     scrollpos = 130;
     af.getViewport().showAllHiddenColumns();
     af.alignPanel.setScrollValues(scrollpos, 5);
+    af.paintImmediately(af.getBounds());
     assertEquals(ranges.getEndRes(), af.getViewport()
             .getAlignment().getWidth() - 1);
 
@@ -227,6 +221,7 @@ public class AlignmentPanelTest
     // endRes should be set to width of alignment - 1 - the number of hidden
     // columns
     af.getViewport().hideColumns(30, 50);
+    af.paintImmediately(af.getBounds());
     af.alignPanel.setScrollValues(scrollpos, 5);
     assertEquals(ranges.getEndRes(), af.getViewport()
             .getAlignment().getWidth() - 1 - 21); // 21 is the number of hidden
@@ -247,6 +242,7 @@ public class AlignmentPanelTest
     // wrap
     af.alignPanel.getAlignViewport().setWrapAlignment(true);
     af.alignPanel.updateLayout();
+    af.paintImmediately(af.getBounds());
 
     // endRes has changed
     assertNotEquals(ranges.getEndRes(), endres);
@@ -254,7 +250,7 @@ public class AlignmentPanelTest
     // unwrap
     af.alignPanel.getAlignViewport().setWrapAlignment(false);
     af.alignPanel.updateLayout();
-
+    af.paintImmediately(af.getBounds());
     // endRes back to original value
     assertEquals(ranges.getEndRes(), endres);