JAL-2823 JAL-2822 JAL-2684 test sequence start and dataset sequence are recovered...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 7 Nov 2017 15:54:47 +0000 (15:54 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 7 Nov 2017 15:54:47 +0000 (15:54 +0000)
test/jalview/commands/EditCommandTest.java

index ad033cb..23486d3 100644 (file)
@@ -290,7 +290,7 @@ public class EditCommandTest
     // 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, "----",
+    EditCommand edit = new EditCommand("", Action.REPLACE, "----",
             new SequenceI[]
             { seqs[1] }, 0, 4, al);
     // trimmed start
@@ -301,6 +301,17 @@ public class EditCommandTest
     assertEquals("fghjklmnopq", dsseq.getSequenceAsString());
     // and that alignment sequence start has been adjusted
     assertEquals(5, seqs[1].getStart());
+    AlignmentI[] views = new AlignmentI[] { new Alignment(seqs) };
+    // and undo
+    edit.undoCommand(views);
+
+    // dataset sequence unchanged
+    assertTrue(dsseq == seqs[1].getDatasetSequence());
+    // restore sequence
+    assertEquals("fghjklmnopq", seqs[1].getSequenceAsString());
+    // and start/end numbering also restored
+    assertEquals(1, seqs[1].getStart());
+
   }
 
   /**