JAL-2780 JAL-2781 run sequentially and ensure windows are closed so structureselectio...
authorJim Procter <jprocter@issues.jalview.org>
Wed, 7 Feb 2018 16:58:09 +0000 (16:58 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Wed, 7 Feb 2018 16:58:52 +0000 (16:58 +0000)
test/jalview/structure/StructureSelectionManagerTest.java

index 5b5c4a2..1cca566 100644 (file)
@@ -60,6 +60,7 @@ import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+@Test(singleThreaded = true)
 public class StructureSelectionManagerTest extends Jalview2xmlBase
 {
 
@@ -191,9 +192,15 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
    * causes features, annotation and positions to be remapped to the wrong place
    * on viewing the structure
    */
-  @Test(groups = { "Functional" })
+  @Test(groups = { "Network" })
   public void testMapping_EqualsFeatures()
   {
+    // for some reason 'BeforeMethod' (which should be inherited from
+    // Jalview2XmlBase isn't always called)...
+    Desktop.instance.closeAll_actionPerformed(null);
+    try { 
+      Thread.sleep(200);
+    } catch (Exception foo) {}; 
     SequenceI seq = new Sequence("4IM2|A",
             "LDFCIRNIEKTVMGEISDIHTKLLRLSSSQGTIE");
     String P4IM2_MISSING = "examples/testdata/4IM2_missing.pdb";
@@ -241,6 +248,8 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
 
     AlignFrame alf = new FileLoader(false).LoadFileWaitTillLoaded(
             "examples/testdata/4IM2_missing.pdb", DataSourceType.FILE);
+    Desktop.addInternalFrame(alf, "examples/testdata/4IM2_missing.pdb", 800,
+            400);
     AlignmentI pdbal = alf.getViewport().getAlignment();
     SequenceI pdb_viewseq = pdbal.getSequenceAt(0);
     assertEquals(pdb_viewseq.getSequenceAsString(),
@@ -318,7 +327,6 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
         System.out.println(c);
       }
     }
-
   }
 
   private void verifySeqFeats(SequenceI pdbseq, int[] offset,
@@ -337,7 +345,7 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
 
   }
 
-  @Test(groups= {"Network"})
+  @Test(groups = { "Network" })
   public void testAssociatedMappingToSubSeq() throws Exception
   {
 
@@ -400,7 +408,8 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
     SiftsSettings.setMapWithSifts(true);
     StructureImportSettings.setProcessSecondaryStructure(true);
     StructureImportSettings.setVisibleChainAnnotation(true);
-    openStructureViaChooser(alf, seq, PDBID);
+    JalviewStructureDisplayI sview = openStructureViaChooser(alf, seq,
+            PDBID);
 
     AlignmentAnnotation subseq_tf=null;
     assertTrue(seq.getDBRefs() != null && seq.getDBRefs().length > 0);
@@ -454,7 +463,6 @@ public class StructureSelectionManagerTest extends Jalview2xmlBase
       ;
 
     }
-    
   }
 
   private JalviewStructureDisplayI openStructureViaChooser(AlignFrame alf,