From 2d0c9aa4f53ee6f6d80077faf014e9102c30efb6 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 13 Nov 2017 09:08:11 +0000 Subject: [PATCH] JAL-2541 enable failing test for alignment dataset --- test/jalview/commands/EditCommandTest.java | 29 ++++++++++++---------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/test/jalview/commands/EditCommandTest.java b/test/jalview/commands/EditCommandTest.java index 23486d3..9547d8e 100644 --- a/test/jalview/commands/EditCommandTest.java +++ b/test/jalview/commands/EditCommandTest.java @@ -784,6 +784,7 @@ public class EditCommandTest seq0.setEnd(end); AlignmentI alignment = new Alignment(new SequenceI[] { seq0 }); alignment.setDataset(null); + /* * create a new alignment with shared dataset sequence */ @@ -809,12 +810,13 @@ public class EditCommandTest assertEquals(func(5), sfs.size()); assertEquals(sfs, copySeq0.getSequenceFeatures()); String copySequenceFeatures = copySeq0.getSequenceFeatures().toString(); + /* * now perform all possible cuts of subranges of columns 1-5 * and validate the resulting remaining sequence features! */ SequenceI[] sqs = new SequenceI[] { seq0 }; - boolean checkDsSize = false; + boolean checkDsSize = true; for (int from = 0; from < seq0.getLength(); from++) { @@ -823,6 +825,8 @@ public class EditCommandTest EditCommand ec = new EditCommand("Cut", Action.CUT, sqs, from, (to - from + 1), alignment); final String msg = String.format("Cut %d-%d ", from + 1, to + 1); + boolean newDatasetSequence = copySeq0.getDatasetSequence() != seq0 + .getDatasetSequence(); verifyCut(seq0, from, to, msg, start); @@ -832,16 +836,15 @@ public class EditCommandTest assertEquals("Original dataset sequence was modified", copySequenceFeatures, copySeq0.getSequenceFeatures().toString()); + if (checkDsSize) { /* * verify a new dataset sequence has appeared */ assertEquals("Wrong Dataset size after cut", - copySeq0.getDatasetSequence() == seq0.getDatasetSequence() - ? 1 - : 2, - alignment.getDataset().getHeight()); + newDatasetSequence ? 2 : 1, alignment.getDataset() + .getHeight()); } /* * undo and verify all restored @@ -864,10 +867,7 @@ public class EditCommandTest /* * verify dataset sequence has shrunk */ - assertEquals("Wrong Dataset size after cut", - copySeq0.getDatasetSequence() == seq0.getDatasetSequence() - ? 1 - : 2, + assertEquals("Wrong Dataset size after cut", 1, alignment.getDataset().getHeight()); } /* @@ -889,10 +889,8 @@ public class EditCommandTest * verify a new dataset sequence has appeared again */ assertEquals("Wrong Dataset size after cut", - copySeq0.getDatasetSequence() == seq0.getDatasetSequence() - ? 1 - : 2, - alignment.getDataset().getHeight()); + newDatasetSequence ? 2 : 1, alignment.getDataset() + .getHeight()); } /* * undo ready for next cut @@ -910,10 +908,7 @@ public class EditCommandTest /* * and that dataset sequence has shrunk */ - assertEquals("Wrong Dataset size after cut", - copySeq0.getDatasetSequence() == seq0.getDatasetSequence() - ? 1 - : 2, + assertEquals("Wrong Dataset size after cut", 1, alignment.getDataset().getHeight()); } } -- 1.7.10.2