JAL-2541 JAL-2822 verify limits for edited sequence, undone edit, and redone edit.
authorJim Procter <jprocter@issues.jalview.org>
Thu, 16 Nov 2017 16:29:48 +0000 (16:29 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 16 Nov 2017 16:29:48 +0000 (16:29 +0000)
test/jalview/commands/EditCommandTest.java

index 61ca5a6..d72fa7d 100644 (file)
@@ -314,6 +314,7 @@ public class EditCommandTest
     EditCommand edit = new EditCommand("", Action.REPLACE, "----",
             new SequenceI[]
             { seqs[1] }, 0, 4, al);
+
     // trimmed start
     assertEquals("----klmnopq", seqs[1].getSequenceAsString());
     // and ds is preserved
@@ -322,6 +323,8 @@ public class EditCommandTest
     assertEquals("fghjklmnopq", dsseq.getSequenceAsString());
     // and that alignment sequence start has been adjusted
     assertEquals(5, seqs[1].getStart());
+    assertEquals(11, seqs[1].getEnd());
+
     AlignmentI[] views = new AlignmentI[] { new Alignment(seqs) };
     // and undo
     edit.undoCommand(views);
@@ -332,6 +335,22 @@ public class EditCommandTest
     assertEquals("fghjklmnopq", seqs[1].getSequenceAsString());
     // and start/end numbering also restored
     assertEquals(1, seqs[1].getStart());
+    assertEquals(11, seqs[1].getEnd());
+
+    // now redo
+    edit.undoCommand(views);
+
+    // and repeat asserts for the original edit
+
+    // 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());
+    assertEquals(11, seqs[1].getEnd());
 
   }