JAL-4146 Fix SeqCanvasTest setup
authorMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 17 Mar 2023 13:49:19 +0000 (14:49 +0100)
committerMateusz Warowny <mmzwarowny@dundee.ac.uk>
Fri, 17 Mar 2023 13:49:42 +0000 (14:49 +0100)
test/jalview/gui/SeqCanvasTest.java

index 0efd4c9..c6630d4 100644 (file)
@@ -30,6 +30,7 @@ import java.awt.Font;
 import java.awt.FontMetrics;
 
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import jalview.bin.Cache;
@@ -48,30 +49,34 @@ public class SeqCanvasTest
   @BeforeClass(alwaysRun = true)
   public void setUp()
   {
-      // 2.11.2 - beforeMethod setup
-      //          Cache.loadProperties("test/jalview/io/testProps.jvprops");
-      //Cache.applicationProperties.setProperty("SHOW_IDENTITY",
-      //      Boolean.TRUE.toString());
-      //    af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
-      //     DataSourceType.FILE);
-      //     /*
-      // * wait for Consensus thread to complete
-     // */
-      // do
-       // {
-       //try
-         //{
-         // Thread.sleep(50);
-       //} catch (InterruptedException x)
-         //{
-         //}
-      //    } while (af.getViewport().getCalcManager().isWorking());
-
     Cache.loadProperties(null);
     Desktop.getInstance().setVisible(false);
   }
 
   private AlignFrame af;
+  
+
+  @BeforeMethod(alwaysRun = true)
+  public void setUpMethod()
+  {
+    Cache.loadProperties("test/jalview/io/testProps.jvprops");
+    Cache.setOrRemove("SHOW_IDENTITY", Boolean.TRUE.toString());
+    af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
+            DataSourceType.FILE);
+
+    /*
+     * wait for Consensus thread to complete
+     */
+    do
+    {
+      try
+      {
+        Thread.sleep(50);
+      } catch (InterruptedException x)
+      {
+      }
+    } while (af.getViewport().getCalcManager().isWorking());
+  }
 
   /**
    * Test the method that computes wrapped width in residues, height of wrapped
@@ -375,8 +380,8 @@ public class SeqCanvasTest
   @Test(groups = "Functional")
   public void testClear_HighlightAndSelection()
   {
-    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
-            "examples/uniref50.fa", DataSourceType.FILE);
+//    AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+//            "examples/uniref50.fa", DataSourceType.FILE);
     AlignViewport av = af.getViewport();
     SearchResultsI highlight = new SearchResults();
     highlight.addResult(