JAL-3171 failing test for legacy projects and fixing multiple dataset references
authorJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 12:28:24 +0000 (12:28 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 16:24:00 +0000 (16:24 +0000)
examples/testdata/projects/twoViews.jvp [new file with mode: 0644]
test/jalview/project/Jalview2xmlTests.java

diff --git a/examples/testdata/projects/twoViews.jvp b/examples/testdata/projects/twoViews.jvp
new file mode 100644 (file)
index 0000000..80333cd
Binary files /dev/null and b/examples/testdata/projects/twoViews.jvp differ
index f0fc3fd..72cbc50 100644 (file)
@@ -1038,4 +1038,29 @@ public class Jalview2xmlTests extends Jalview2xmlBase
     addFeature(seq, featureType, score++);
     addFeature(seq, featureType, score);
   }
+
+  /**
+   * 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
+   */
+  public void testMergeDatasetsforViews() throws IOException
+  {
+    AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
+            "examples/testdata/projects/twoViews.jvp", DataSourceType.FILE);
+    assertNotNull(af);
+    assertTrue(af.getAlignPanels().size() > 1);
+    AlignmentI ds = null;
+    for (AlignmentViewPanel ap : af.getAlignPanels())
+    {
+      if (ds == null)
+      {
+        ds = ap.getAlignment().getDataset();
+      }
+      else
+      {
+        assertTrue(ap.getAlignment().getDataset() == ds,
+                "Dataset was not the same for imported 2.10.5 project with several alignment views");
+      }
+    }
+  }
 }