// and region[0]-1, and then subtract from result to convert result from
// the adjusted hiddenColumn value to the adjusted region[0]-1 value
- return result - (hiddenColumn - region[0] + 1);
+ // However, if the region begins at 0 we cannot return region[0]-1
+ // just return 0
+ if (region[0] == 0)
+ {
+ return 0;
+ }
+ else
+ {
+ return result - (hiddenColumn - region[0] + 1);
+ }
}
}
return result; // return the shifted position after removing hidden columns.
// and moves column 40 to 25
assertEquals(25, cs2.findColumnPosition(40));
+
+ // check when hidden columns start at 0 that the visible column
+ // is returned as 0
+ ColumnSelection cs3 = new ColumnSelection();
+ cs3.hideColumns(0, 4);
+ assertEquals(0, cs3.findColumnPosition(2));
+
}
/**