Merge branch 'Jalview-JS/jim/JAL-3253-JAL-3418' into Jalview-JS/JAL-3253-applet
[jalview.git] / test / jalview / gui / SeqPanelTest.java
index 0d49936..17e04bf 100644 (file)
@@ -252,22 +252,22 @@ public class SeqPanelTest
   @AfterMethod(alwaysRun = true)
   public void tearDown()
   {
-    Desktop.instance.closeAll_actionPerformed(null);
+    Desktop.getInstance().closeAll_actionPerformed(null);
   }
 
   @Test(groups = "Functional")
   public void testFindMousePosition_wrapped_annotations()
   {
-    Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "true");
-    Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+    Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "true");
+    Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
     AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     AlignViewportI av = alignFrame.getViewport();
     av.setScaleAboveWrapped(false);
     av.setScaleLeftWrapped(false);
     av.setScaleRightWrapped(false);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    waitForSwing(); // for Swing thread
+
+    alignFrame.alignPanel.updateLayout();
 
     final int charHeight = av.getCharHeight();
     final int charWidth = av.getCharWidth();
@@ -433,16 +433,15 @@ public class SeqPanelTest
   @Test(groups = "Functional")
   public void testFindMousePosition_wrapped_scaleAbove()
   {
-    Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "true");
-    Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+    Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "true");
+    Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
     AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     AlignViewportI av = alignFrame.getViewport();
     av.setScaleAboveWrapped(true);
     av.setScaleLeftWrapped(false);
     av.setScaleRightWrapped(false);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    waitForSwing();
+    alignFrame.alignPanel.updateLayout();
 
     final int charHeight = av.getCharHeight();
     final int charWidth = av.getCharWidth();
@@ -629,16 +628,15 @@ public class SeqPanelTest
   @Test(groups = "Functional")
   public void testFindMousePosition_wrapped_noAnnotations()
   {
-    Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "false");
-    Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+    Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "false");
+    Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
     AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     AlignViewportI av = alignFrame.getViewport();
     av.setScaleAboveWrapped(false);
     av.setScaleLeftWrapped(false);
     av.setScaleRightWrapped(false);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    waitForSwing();
+    alignFrame.alignPanel.updateLayout();
 
     final int charHeight = av.getCharHeight();
     final int charWidth = av.getCharWidth();
@@ -718,7 +716,7 @@ public class SeqPanelTest
   @Test(groups = "Functional")
   public void testFindColumn_unwrapped()
   {
-    Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "false");
+    Cache.setPropertyNoSave("WRAP_ALIGNMENT", "false");
     AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
@@ -784,16 +782,14 @@ public class SeqPanelTest
   @Test(groups = "Functional")
   public void testFindColumn_wrapped()
   {
-    Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+    Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
     AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
             "examples/uniref50.fa", DataSourceType.FILE);
     AlignViewport av = alignFrame.getViewport();
     av.setScaleAboveWrapped(false);
     av.setScaleLeftWrapped(false);
     av.setScaleRightWrapped(false);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    // need to wait for repaint to finish!
-    waitForSwing();
+    alignFrame.alignPanel.updateLayout();
     SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
     int x = 0;
     final int charWidth = av.getCharWidth();
@@ -827,8 +823,7 @@ public class SeqPanelTest
      * x over scale left (before drawn columns) results in -1
      */
     av.setScaleLeftWrapped(true);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    waitForSwing();
+    alignFrame.alignPanel.updateLayout();
     SeqCanvas seqCanvas = testee.seqCanvas;
     int labelWidth = (int) PA.getValue(seqCanvas, "labelWidthWest");
     assertTrue(labelWidth > 0);
@@ -856,8 +851,7 @@ public class SeqPanelTest
      * x over scale right (beyond drawn columns) results in -1
      */
     av.setScaleRightWrapped(true);
-    alignFrame.alignPanel.paintAlignment(false, false);
-    waitForSwing();
+    alignFrame.alignPanel.updateLayout();
     labelWidth = (int) PA.getValue(seqCanvas, "labelWidthEast");
     assertTrue(labelWidth > 0);
     int residuesWide2 = av.getRanges().getViewportWidth();