From c8317d9cfda770edc1ca9f201955718b9ab2e840 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 24 Oct 2017 14:55:40 +0100 Subject: [PATCH] JAL-2541 verify sequence features unaffected on dataset sequence before checking dataset size is correct, and make that assert conditional --- test/jalview/commands/EditCommandTest.java | 69 ++++++++++++++++++---------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 63ceebe..f25529a 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -782,6 +782,7 @@ public class EditCommandTest * and validate the resulting remaining sequence features! */ SequenceI[] sqs = new SequenceI[] { seq0 }; + boolean checkDsSize = false; for (int from = 0; from < seq0.getLength(); from++) { @@ -799,12 +800,17 @@ public class EditCommandTest assertEquals("Original dataset sequence was modified", copySequenceFeatures, copySeq0.getSequenceFeatures().toString()); - /* - * verify a new dataset sequence has appeared - */ - assertEquals("Wrong Dataset size after cut", 2, - alignment.getDataset().getHeight()); - + if (checkDsSize) + { + /* + * verify a new dataset sequence has appeared + */ + assertEquals("Wrong Dataset size after cut", + copySeq0.getDatasetSequence() == seq0.getDatasetSequence() + ? 1 + : 2, + alignment.getDataset().getHeight()); + } /* * undo and verify all restored */ @@ -821,12 +827,17 @@ public class EditCommandTest copySequenceFeatures, copySeq0.getSequenceFeatures().toString()); - /* - * verify dataset sequence has shrunk - */ - assertEquals("Wrong Dataset size after cut", 1, - alignment.getDataset().getHeight()); - + if (checkDsSize) + { + /* + * verify dataset sequence has shrunk + */ + assertEquals("Wrong Dataset size after cut", + copySeq0.getDatasetSequence() == seq0.getDatasetSequence() + ? 1 + : 2, + alignment.getDataset().getHeight()); + } /* * redo and verify */ @@ -840,12 +851,17 @@ public class EditCommandTest copySequenceFeatures, copySeq0.getSequenceFeatures().toString()); - /* - * verify a new dataset sequence has appeared again - */ - assertEquals("Wrong Dataset size after cut", 2, - alignment.getDataset().getHeight()); - + if (checkDsSize) + { + /* + * verify a new dataset sequence has appeared again + */ + assertEquals("Wrong Dataset size after cut", + copySeq0.getDatasetSequence() == seq0.getDatasetSequence() + ? 1 + : 2, + alignment.getDataset().getHeight()); + } /* * undo ready for next cut */ @@ -857,12 +873,17 @@ public class EditCommandTest assertEquals("Original dataset sequence was modified", copySequenceFeatures, copySeq0.getSequenceFeatures().toString()); - /* - * and that dataset sequence has shrunk - */ - assertEquals("Wrong Dataset size after cut", 1, - alignment.getDataset().getHeight()); - + if (checkDsSize) + { + /* + * and that dataset sequence has shrunk + */ + assertEquals("Wrong Dataset size after cut", + copySeq0.getDatasetSequence() == seq0.getDatasetSequence() + ? 1 + : 2, + alignment.getDataset().getHeight()); + } } } } -- 1.7.10.2