JAL-3171 more complex project test - where sequences were copied from one alignment...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 16:13:26 +0000 (16:13 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 16:24:11 +0000 (16:24 +0000)
examples/testdata/projects/manyViews.jvp [new file with mode: 0644]
test/jalview/project/Jalview2xmlTests.java

diff --git a/examples/testdata/projects/manyViews.jvp b/examples/testdata/projects/manyViews.jvp
new file mode 100644 (file)
index 0000000..065b29c
Binary files /dev/null and b/examples/testdata/projects/manyViews.jvp differ
index 72cbc50..5dd3040 100644 (file)
@@ -1045,10 +1045,46 @@ public class Jalview2xmlTests extends Jalview2xmlBase
    */
   public void testMergeDatasetsforViews() throws IOException
   {
+    // simple project - two views on one alignment
     AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
             "examples/testdata/projects/twoViews.jvp", DataSourceType.FILE);
     assertNotNull(af);
     assertTrue(af.getAlignPanels().size() > 1);
+    verifyDs(af);
+  }
+
+  /**
+   * pre 2.11 - jalview 2.10 erroneously created new dataset entries for each
+   * view (JAL-3171) this test ensures we can import and merge those views This
+   * is a more complex project
+   */
+  public void testMergeDatasetsforManyViews() throws IOException
+  {
+    Desktop.instance.closeAll_actionPerformed(null);
+
+    // complex project - one dataset, several views on several alignments
+    AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
+            "examples/testdata/projects/manyViews.jvp",
+            DataSourceType.FILE);
+    assertNotNull(af);
+
+    AlignmentI ds = null;
+    for (AlignFrame alignFrame : Desktop.getAlignFrames())
+    {
+      if (ds == null)
+      {
+        ds = verifyDs(alignFrame);
+      }
+      else
+      {
+        // check that this frame's dataset matches the last
+        assertTrue(ds == verifyDs(alignFrame));
+      }
+    }
+  }
+
+  private AlignmentI verifyDs(AlignFrame af)
+  {
     AlignmentI ds = null;
     for (AlignmentViewPanel ap : af.getAlignPanels())
     {
@@ -1062,5 +1098,6 @@ public class Jalview2xmlTests extends Jalview2xmlBase
                 "Dataset was not the same for imported 2.10.5 project with several alignment views");
       }
     }
+    return ds;
   }
 }