Merge branch 'Jalview-JS/JAL-3253-applet' of https://source.jalview.org/git/jalview...
[jalview.git] / test / jalview / structure / Mapping.java
index ceb098b..f8461f8 100644 (file)
@@ -23,11 +23,13 @@ package jalview.structure;
 import static org.testng.AssertJUnit.assertEquals;
 import static org.testng.AssertJUnit.assertTrue;
 
+import jalview.bin.Cache;
 import jalview.datamodel.AlignmentAnnotation;
 import jalview.datamodel.Annotation;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
+import jalview.gui.JvOptionPane;
 import jalview.io.DataSourceType;
 import jalview.io.FileFormat;
 import jalview.io.FileLoader;
@@ -35,10 +37,23 @@ import jalview.io.StructureFile;
 
 import org.testng.Assert;
 import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeClass;
 import org.testng.annotations.Test;
 
 public class Mapping
 {
+  @BeforeClass(alwaysRun = true)
+  public void setUp()
+  {
+    Cache.initLogger();
+  }
+
+  @BeforeClass(alwaysRun = true)
+  public void setUpJvOptionPane()
+  {
+    JvOptionPane.setInteractiveMode(false);
+    JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+  }
 
   /*
    * more test data
@@ -66,7 +81,8 @@ public class Mapping
       int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[]
       { 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 };
 
-      StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+      StructureSelectionManager ssm = StructureSelectionManager
+              .getStructureSelectionManager(null);
       StructureFile pmap = ssm.setMapping(true, new SequenceI[] { uprot },
               new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb",
               DataSourceType.FILE);
@@ -135,7 +151,8 @@ public class Mapping
             "EIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPNATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKM");
     Sequence sq1 = new Sequence(sq);
     String inFile;
-    StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(null);
     // Associate the 1GAQ pdb file with the subsequence 'imported' from another
     // source
     StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq },
@@ -230,11 +247,12 @@ public class Mapping
   public void mapFer1From3W5V() throws Exception
   {
     AlignFrame seqf = new FileLoader(false)
-            .LoadFileWaitTillLoaded(
+            .loadFileWaitTillLoaded(
                     ">FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor\nMATVLGSPRAPAFFFSSSSLRAAPAPTAVALPAAKVGIMGRSASSRRRLRAQATYNVKLITPEGEVELQVPD\nDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKE\nEELTGA",
                     DataSourceType.PASTE, FileFormat.Fasta);
     SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0);
-    StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(null);
     StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
             new String[] { null }, "examples/3W5V.pdb",
             DataSourceType.FILE);
@@ -251,6 +269,8 @@ public class Mapping
   @Test(groups = { "Functional" })
   public void compareTransferredToRefPDBAnnot() throws Exception
   {
+    StructureImportSettings.setProcessSecondaryStructure(true);
+    StructureImportSettings.setVisibleChainAnnotation(true);
     StructureImportSettings.setShowSeqFeatures(true);
     AlignFrame ref = new FileLoader(false)
             .LoadFileWaitTillLoaded("test/jalview/ext/jmol/1QCF.pdb",
@@ -261,7 +281,8 @@ public class Mapping
     // make it harder by shifting the copy vs the reference
     newseq.setStart(refseq.getStart() + 25);
     newseq.setEnd(refseq.getLength() + 25 + refseq.getStart());
-    StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+    StructureSelectionManager ssm = StructureSelectionManager
+            .getStructureSelectionManager(null);
     ssm.setProcessSecondaryStructure(true);
     ssm.setAddTempFacAnnot(true);
     StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },