public class HiddenColumnsCursorTest
{
+
+ @Test(groups = { "Functional" })
+ public void testConstructor()
+ {
+ HiddenColumnsCursor cursor = new HiddenColumnsCursor();
+ assertNull(cursor.findRegionForColumn(0, false));
+
+ List<int[]> hlist = new ArrayList<>();
+ cursor = new HiddenColumnsCursor(hlist);
+ assertNull(cursor.findRegionForColumn(0, false));
+
+ cursor = new HiddenColumnsCursor(hlist, 3, 12);
+ assertNull(cursor.findRegionForColumn(0, false));
+
+ hlist.add(new int[] { 3, 7 });
+ hlist.add(new int[] { 15, 25 });
+ cursor = new HiddenColumnsCursor(hlist);
+ HiddenCursorPosition p = cursor.findRegionForColumn(8, false);
+ assertEquals(1, p.getRegionIndex());
+
+ cursor = new HiddenColumnsCursor(hlist, 1, 5);
+ p = cursor.findRegionForColumn(8, false);
+ assertEquals(1, p.getRegionIndex());
+ }
+
/**
* Test the method which finds the corresponding region given a column
*/
* Test the method which counts the number of hidden columns before a column
*/
@Test(groups = { "Functional" })
- public void testGetHiddenOffset()
+ public void testFindRegionForColumn_Visible()
{
HiddenColumnsCursor cursor = new HiddenColumnsCursor();
assertEquals(46, offset);
}
+ /**
+ * Test the method which updates for a deleted region
+ */
+ @Test(groups = { "Functional" })
+ public void testUpdateForDeletedRegion()
+ {
+ List<int[]> hlist = new ArrayList<>();
+ HiddenColumnsCursor cursor = new HiddenColumnsCursor(hlist, 1, 5);
+ cursor.updateForDeletedRegion(hlist, 0);
+ assertNull(cursor.findRegionForColumn(30, false));
+
+ hlist.add(new int[] { 3, 7 });
+ hlist.add(new int[] { 15, 25 });
+
+ cursor = new HiddenColumnsCursor(hlist, 1, 5);
+
+ HiddenCursorPosition p = cursor.findRegionForColumn(30, false);
+ assertEquals(16, p.getHiddenSoFar());
+
+ List<int[]> hlist2 = new ArrayList<>();
+ hlist2.add(new int[] { 3, 7 });
+ cursor.updateForDeletedRegion(hlist2, 11);
+ p = cursor.findRegionForColumn(30, false);
+ assertEquals(5, p.getHiddenSoFar());
+ }
+
}