JAL-653 realise virtual mappings and align when adding sequences
[jalview.git] / test / jalview / gui / AlignViewportTest.java
index b83e069..b39b2bd 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ * 
+ * This file is part of Jalview.
+ * 
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License 
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *  
+ * Jalview is distributed in the hope that it will be useful, but 
+ * WITHOUT ANY WARRANTY; without even the implied warranty 
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
+ * PURPOSE.  See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
 package jalview.gui;
 
 import static org.testng.AssertJUnit.assertEquals;
@@ -17,8 +37,8 @@ import jalview.io.FileLoader;
 import jalview.io.FormatAdapter;
 import jalview.structure.StructureSelectionManager;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
@@ -116,7 +136,7 @@ public class AlignViewportTest
     AlignedCodonFrame acf1 = new AlignedCodonFrame();
     AlignedCodonFrame acf2 = new AlignedCodonFrame();
 
-    Set<AlignedCodonFrame> mappings = new LinkedHashSet<AlignedCodonFrame>();
+    List<AlignedCodonFrame> mappings = new ArrayList<AlignedCodonFrame>();
     mappings.add(acf1);
     mappings.add(acf2);
     af1.getViewport().getAlignment().setCodonFrames(mappings);
@@ -128,18 +148,18 @@ public class AlignViewportTest
      */
     StructureSelectionManager ssm = StructureSelectionManager
             .getStructureSelectionManager(Desktop.instance);
-    assertEquals(2, ssm.seqmappings.size());
-    assertTrue(ssm.seqmappings.contains(acf1));
-    assertTrue(ssm.seqmappings.contains(acf2));
+    assertEquals(2, ssm.getSequenceMappings().size());
+    assertTrue(ssm.getSequenceMappings().contains(acf1));
+    assertTrue(ssm.getSequenceMappings().contains(acf2));
 
     /*
      * Close the second view. Verify that mappings are not removed as the first
      * view still holds a reference to them.
      */
     af1.closeMenuItem_actionPerformed(false);
-    assertEquals(2, ssm.seqmappings.size());
-    assertTrue(ssm.seqmappings.contains(acf1));
-    assertTrue(ssm.seqmappings.contains(acf2));
+    assertEquals(2, ssm.getSequenceMappings().size());
+    assertTrue(ssm.getSequenceMappings().contains(acf1));
+    assertTrue(ssm.getSequenceMappings().contains(acf2));
   }
 
   /**
@@ -163,11 +183,11 @@ public class AlignViewportTest
     AlignedCodonFrame acf2 = new AlignedCodonFrame();
     AlignedCodonFrame acf3 = new AlignedCodonFrame();
 
-    Set<AlignedCodonFrame> mappings1 = new LinkedHashSet<AlignedCodonFrame>();
+    List<AlignedCodonFrame> mappings1 = new ArrayList<AlignedCodonFrame>();
     mappings1.add(acf1);
     af1.getViewport().getAlignment().setCodonFrames(mappings1);
 
-    Set<AlignedCodonFrame> mappings2 = new LinkedHashSet<AlignedCodonFrame>();
+    List<AlignedCodonFrame> mappings2 = new ArrayList<AlignedCodonFrame>();
     mappings2.add(acf2);
     mappings2.add(acf3);
     af2.getViewport().getAlignment().setCodonFrames(mappings2);
@@ -176,7 +196,7 @@ public class AlignViewportTest
      * AlignFrame1 has mapping acf1, AlignFrame2 has acf2 and acf3
      */
 
-    Set<AlignedCodonFrame> ssmMappings = ssm.seqmappings;
+    List<AlignedCodonFrame> ssmMappings = ssm.getSequenceMappings();
     assertEquals(0, ssmMappings.size());
     ssm.registerMapping(acf1);
     assertEquals(1, ssmMappings.size());
@@ -216,12 +236,12 @@ public class AlignViewportTest
     AlignedCodonFrame acf2 = new AlignedCodonFrame();
     AlignedCodonFrame acf3 = new AlignedCodonFrame();
 
-    Set<AlignedCodonFrame> mappings1 = new LinkedHashSet<AlignedCodonFrame>();
+    List<AlignedCodonFrame> mappings1 = new ArrayList<AlignedCodonFrame>();
     mappings1.add(acf1);
     mappings1.add(acf2);
     af1.getViewport().getAlignment().setCodonFrames(mappings1);
 
-    Set<AlignedCodonFrame> mappings2 = new LinkedHashSet<AlignedCodonFrame>();
+    List<AlignedCodonFrame> mappings2 = new ArrayList<AlignedCodonFrame>();
     mappings2.add(acf2);
     mappings2.add(acf3);
     af2.getViewport().getAlignment().setCodonFrames(mappings2);
@@ -230,7 +250,7 @@ public class AlignViewportTest
      * AlignFrame1 has mappings acf1 and acf2, AlignFrame2 has acf2 and acf3
      */
 
-    Set<AlignedCodonFrame> ssmMappings = ssm.seqmappings;
+    List<AlignedCodonFrame> ssmMappings = ssm.getSequenceMappings();
     assertEquals(0, ssmMappings.size());
     ssm.registerMapping(acf1);
     assertEquals(1, ssmMappings.size());