assertEquals(1, wb.getNumberOfNames());
assertEquals(3, wb.getNumberOfSheets());
// Check all names fit within range, and use
// DeletedArea3DPtg
InternalWorkbook w = wb.getWorkbook();
for(int i=0; i<w.getNumNames(); i++) {
NameRecord r = w.getNameRecord(i);
assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
Ptg[] nd = r.getNameDefinition();
assertEquals(1, nd.length);
assertTrue(nd[0] instanceof DeletedArea3DPtg);
}
// Delete the 2nd sheet
wb.removeSheetAt(1);
// Re-check
assertEquals(1, wb.getNumberOfNames());
assertEquals(2, wb.getNumberOfSheets());
for(int i=0; i<w.getNumNames(); i++) {
NameRecord r = w.getNameRecord(i);
assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
Ptg[] nd = r.getNameDefinition();
assertEquals(1, nd.length);
assertTrue(nd[0] instanceof DeletedArea3DPtg);
}
// Save and re-load
wb = writeOutAndReadBack(wb);
w = wb.getWorkbook();
assertEquals(1, wb.getNumberOfNames());
assertEquals(2, wb.getNumberOfSheets());
for(int i=0; i<w.getNumNames(); i++) {
NameRecord r = w.getNameRecord(i);
assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
Ptg[] nd = r.getNameDefinition();
assertEquals(1, nd.length);
assertTrue(nd[0] instanceof DeletedArea3DPtg);