JAL-1369 make sure desktop is cleared before test starts
[jalview.git] / test / jalview / io / Jalview2xmlTests.java
index 21bf846..b45cd2a 100644 (file)
@@ -45,6 +45,7 @@ import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
+@Test(singleThreaded = true)
 public class Jalview2xmlTests
 {
 
@@ -420,9 +421,10 @@ public class Jalview2xmlTests
    * 
    * @throws Exception
    */
-  @Test(groups = { "Functional" }, enabled = true)
+  @Test(groups = { "Functional" })
   public void testStoreAndRecoverReferenceSeqSettings() throws Exception
   {
+    Desktop.instance.closeAll_actionPerformed(null);
     String afid = "";
     {
       AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
@@ -464,15 +466,20 @@ public class Jalview2xmlTests
     {
       AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(
             tfile.getAbsolutePath(), FormatAdapter.FILE);
+      afid = af.getViewport().getSequenceSetId();
     }
-    for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(Desktop
-            .getAlignFrames()[0].getViewport().getSequenceSetId()))
+    for (AlignmentViewPanel ap : Desktop.getAlignmentPanels(afid))
     {
       // check representative
       SequenceI rep = ap.getAlignment().getSeqrep();
       Assert.assertNotNull(rep,
               "Couldn't restore sequence representative from project");
-      Assert.assertEquals(refs.get(ap.getViewName()), rep,
+      // can't use a strong equals here, because by definition, the sequence IDs
+      // will be different.
+      // could set vamsas session save/restore flag to preserve IDs across
+      // load/saves.
+      Assert.assertEquals(refs.get(ap.getViewName()).toString(),
+              rep.toString(),
               "Representative wasn't the same when recovered.");
       Assert.assertTrue(ap.getAlignViewport().isDisplayReferenceSeq(),
               "Display reference sequence view setting not set.");