JAL-2740 additional unit testing bug/JAL-2740
authorkiramt <k.mourao@dundee.ac.uk>
Tue, 26 Sep 2017 11:10:52 +0000 (12:10 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Tue, 26 Sep 2017 11:10:52 +0000 (12:10 +0100)
test/jalview/gui/AnnotationColumnChooserTest.java

index a9b973e..06478d5 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.gui;
 
  */
 package jalview.gui;
 
+import static org.testng.Assert.assertFalse;
 import static org.testng.AssertJUnit.assertEquals;
 
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
 import static org.testng.AssertJUnit.assertEquals;
 
 import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
@@ -152,5 +153,24 @@ public class AnnotationColumnChooserTest
     regions = currentHidden.getHiddenColumnsCopy();
     assertEquals(regions.get(0)[0], 10);
     assertEquals(regions.get(0)[1], 20);
     regions = currentHidden.getHiddenColumnsCopy();
     assertEquals(regions.get(0)[0], 10);
     assertEquals(regions.get(0)[1], 20);
+
+    // check works with empty hidden columns as old columns
+    oldhidden = new HiddenColumns();
+    acc.setOldHiddenColumns(oldhidden);
+    acc.reset();
+    currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+    assertFalse(currentHidden.hasHiddenColumns());
+
+    // check works with empty hidden columns as new columns
+    oldhidden.hideColumns(10, 20);
+    acc.setOldHiddenColumns(oldhidden);
+    currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+    assertFalse(currentHidden.hasHiddenColumns());
+
+    acc.reset();
+    currentHidden = af.getViewport().getAlignment().getHiddenColumns();
+    regions = currentHidden.getHiddenColumnsCopy();
+    assertEquals(regions.get(0)[0], 10);
+    assertEquals(regions.get(0)[1], 20);
   }
 }
   }
 }