Bug 57231: Add missing ArrayRecord.clone()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1647255 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
12353bca7f
commit
76af8804d5
@ -95,4 +95,14 @@ public final class ArrayRecord extends SharedValueRecordBase {
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
ArrayRecord rec = new ArrayRecord(_formula.copy(), getRange());
|
||||
|
||||
// they both seem unused, but clone them nevertheless to have an exact copy
|
||||
rec._options = _options;
|
||||
rec._field3notUsed = _field3notUsed;
|
||||
|
||||
return rec;
|
||||
}
|
||||
}
|
||||
|
@ -19,14 +19,17 @@ package org.apache.poi.hssf.record;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.CellRangeAddress8Bit;
|
||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||
import org.apache.poi.ss.formula.Formula;
|
||||
import org.apache.poi.ss.formula.FormulaParser;
|
||||
import org.apache.poi.ss.formula.FormulaRenderer;
|
||||
import org.apache.poi.ss.formula.FormulaType;
|
||||
import org.apache.poi.ss.formula.Formula;
|
||||
import org.apache.poi.util.HexRead;
|
||||
import org.apache.poi.ss.formula.ptg.Ptg;
|
||||
import org.apache.poi.util.HexDump;
|
||||
import org.apache.poi.util.HexRead;
|
||||
|
||||
public final class TestArrayRecord extends TestCase {
|
||||
|
||||
@ -53,7 +56,22 @@ public final class TestArrayRecord extends TestCase {
|
||||
byte[] ser = r2.serialize();
|
||||
//serialize and check that the data is the same as in r1
|
||||
assertEquals(HexDump.toHex(data), HexDump.toHex(ser));
|
||||
}
|
||||
|
||||
public void testBug57231() {
|
||||
HSSFWorkbook wb = HSSFTestDataSamples
|
||||
.openSampleWorkbook("57231_MixedGasReport.xls");
|
||||
HSSFSheet sheet = wb.getSheet("master");
|
||||
|
||||
HSSFSheet newSheet = wb.cloneSheet(wb.getSheetIndex(sheet));
|
||||
int idx = wb.getSheetIndex(newSheet);
|
||||
wb.setSheetName(idx, "newName");
|
||||
|
||||
// Write the output to a file
|
||||
HSSFWorkbook wbBack = HSSFTestDataSamples.writeOutAndReadBack(wb);
|
||||
assertNotNull(wbBack);
|
||||
|
||||
assertNotNull(wbBack.getSheet("master"));
|
||||
assertNotNull(wbBack.getSheet("newName"));
|
||||
}
|
||||
}
|
BIN
test-data/spreadsheet/57231_MixedGasReport.xls
Normal file
BIN
test-data/spreadsheet/57231_MixedGasReport.xls
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user