public void testColPageBreaks() {
short rowFrom = 0;
short rowTo = (short)65535;
InternalSheet worksheet = InternalSheet.createSheet();
PageSettingsBlock sheet = worksheet.getPageSettings();
sheet.setColumnBreak((short)0, rowFrom, rowTo);
assertTrue("no col break at 0", sheet.isColumnBroken(0));
assertEquals("1 col break available", 1, sheet.getNumColumnBreaks());
sheet.setColumnBreak((short)0, rowFrom, rowTo);
assertTrue("no col break at 0", sheet.isColumnBroken(0));
assertEquals("1 col break available", 1, sheet.getNumColumnBreaks());
sheet.setColumnBreak((short)1, rowFrom, rowTo);
sheet.setColumnBreak((short)10, rowFrom, rowTo);
sheet.setColumnBreak((short)15, rowFrom, rowTo);
assertTrue("no col break at 1", sheet.isColumnBroken(1));
assertTrue("no col break at 10", sheet.isColumnBroken(10));
assertTrue("no col break at 15", sheet.isColumnBroken(15));
assertEquals("4 col break available", 4, sheet.getNumColumnBreaks());
boolean is10 = false;
boolean is0 = false;
boolean is1 = false;
boolean is15 = false;
int[] colBreaks = sheet.getColumnBreaks();
for (int i = 0; i < colBreaks.length; i++) {
int main = colBreaks[i];
if (main != 0 && main != 1 && main != 10 && main != 15) fail("Invalid page break");
if (main == 0) is0 = true;
if (main == 1) is1 = true;
if (main == 10) is10= true;
if (main == 15) is15 = true;
}
assertTrue("one of the breaks didnt make it", is0 && is1 && is10 && is15);
sheet.removeColumnBreak(15);
assertFalse("column break should not be there", sheet.isColumnBroken(15));
sheet.removeColumnBreak(0);
assertFalse("column break should not be there", sheet.isColumnBroken(0));
sheet.removeColumnBreak(1);
assertFalse("column break should not be there", sheet.isColumnBroken(1));
sheet.removeColumnBreak(10);
assertFalse("column break should not be there", sheet.isColumnBroken(10));
assertEquals("no more breaks", 0, sheet.getNumColumnBreaks());
}