From 9f5e5489d0cf6debde1df72336ee390eefebf17c Mon Sep 17 00:00:00 2001 From: kiramt Date: Fri, 17 Nov 2017 10:31:58 +0000 Subject: [PATCH] JAL-2759 Update tests --- src/jalview/datamodel/HiddenColumns.java | 5 +++++ src/jalview/datamodel/HiddenColumnsCursor.java | 2 +- test/jalview/datamodel/HiddenColumnsCursorTest.java | 9 +++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/jalview/datamodel/HiddenColumns.java b/src/jalview/datamodel/HiddenColumns.java index 050603e..6200a43 100644 --- a/src/jalview/datamodel/HiddenColumns.java +++ b/src/jalview/datamodel/HiddenColumns.java @@ -321,6 +321,11 @@ public class HiddenColumns } } } + if (hiddenColumn > 0 && hiddenColumn < 121) + { + System.out.println(hiddenColumn + " " + result); + } + return result; // return the shifted position after removing hidden // columns. } finally diff --git a/src/jalview/datamodel/HiddenColumnsCursor.java b/src/jalview/datamodel/HiddenColumnsCursor.java index 2d579b0..9d1351e 100644 --- a/src/jalview/datamodel/HiddenColumnsCursor.java +++ b/src/jalview/datamodel/HiddenColumnsCursor.java @@ -167,7 +167,7 @@ public class HiddenColumnsCursor // column is before or in the previous region if ((index > 0) && (hiddenColumns.get(index - 1)[1] >= column)) { - while ((index > 0) && (hiddenColumns.get(index)[1] > column)) + while ((index > 0) && (hiddenColumns.get(index - 1)[1] >= column)) { index--; int[] region = hiddenColumns.get(index); diff --git a/test/jalview/datamodel/HiddenColumnsCursorTest.java b/test/jalview/datamodel/HiddenColumnsCursorTest.java index 91cd3cd..cc8e5e5 100644 --- a/test/jalview/datamodel/HiddenColumnsCursorTest.java +++ b/test/jalview/datamodel/HiddenColumnsCursorTest.java @@ -74,6 +74,15 @@ public class HiddenColumnsCursorTest regionIndex = cursor.findRegionForColumn(0); assertEquals(0, regionIndex); + + hidden.add(new int[] { 138, 155 }); + cursor.resetCursor(hidden); + + regionIndex = cursor.findRegionForColumn(160); + assertEquals(3, regionIndex); + + regionIndex = cursor.findRegionForColumn(100); + assertEquals(1, regionIndex); } /** -- 1.7.10.2