JAL-2541 verify sequence features unaffected on dataset sequence before checking...
authorJim Procter <jprocter@issues.jalview.org>
Tue, 24 Oct 2017 13:55:40 +0000 (14:55 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 24 Oct 2017 13:55:40 +0000 (14:55 +0100)
test/jalview/commands/EditCommandTest.java

index 63ceebe..f25529a 100644 (file)
@@ -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());
+        }
       }
     }
   }