JAL-2684 failing test for trim-start -> incorrect pairwise alignment of selected...
authorJim Procter <jprocter@issues.jalview.org>
Mon, 6 Nov 2017 17:47:53 +0000 (17:47 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 7 Nov 2017 10:35:07 +0000 (10:35 +0000)
test/jalview/commands/EditCommandTest.java

index 887d3d0..ad033cb 100644 (file)
@@ -282,6 +282,28 @@ public class EditCommandTest
   }
 
   /**
+   * Test replace command when it doesn't cause a sequence edit (see comment in
+   */
+  @Test(groups = { "Functional" })
+  public void testReplaceFirstResiduesWithGaps()
+  {
+    // test replace when gaps are inserted at start. Start/end should change
+    // w.r.t. original edited sequence.
+    SequenceI dsseq = seqs[1].getDatasetSequence();
+    new EditCommand("", Action.REPLACE, "----",
+            new SequenceI[]
+            { seqs[1] }, 0, 4, al);
+    // trimmed start
+    assertEquals("----klmnopq", seqs[1].getSequenceAsString());
+    // and ds is preserved
+    assertTrue(dsseq == seqs[1].getDatasetSequence());
+    // and it is unchanged
+    assertEquals("fghjklmnopq", dsseq.getSequenceAsString());
+    // and that alignment sequence start has been adjusted
+    assertEquals(5, seqs[1].getStart());
+  }
+
+  /**
    * Test that the addEdit command correctly merges insert gap commands when
    * possible.
    */