mirror of https://github.com/apache/poi.git
Sonar fixes
JUnit5 test classes and methods should have default package visibility git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885281 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fb2a96a048
commit
606a313c4c
Binary file not shown.
|
@ -107,8 +107,73 @@ module org.apache.poi.poi {
|
||||||
requires org.junit.jupiter.api;
|
requires org.junit.jupiter.api;
|
||||||
requires org.junit.jupiter.params;
|
requires org.junit.jupiter.params;
|
||||||
|
|
||||||
|
exports org.apache.poi.hpsf.basic to org.junit.platform.commons;
|
||||||
|
exports org.apache.poi.hssf.record.pivot to org.junit.platform.commons;
|
||||||
|
|
||||||
|
opens org.apache.poi to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.common to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.common.usermodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.common.usermodel.fonts to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ddf to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.extractor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hpsf to org.junit.platform.commons;
|
||||||
opens org.apache.poi.hpsf.basic to org.junit.platform.commons;
|
opens org.apache.poi.hpsf.basic to org.junit.platform.commons;
|
||||||
opens org.apache.poi.hssf.record.pivot to org.junit.platform.commons;
|
opens org.apache.poi.hpsf.extractor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hpsf.wellknown to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf to org.junit.platform.commons;
|
||||||
opens org.apache.poi.hssf.dev to org.junit.platform.commons;
|
opens org.apache.poi.hssf.dev to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.eventmodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.eventusermodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.eventusermodel.dummyrecord to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.extractor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.model to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.aggregates to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.cf to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.chart to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.common to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.cont to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.crypto to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.pivot to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.record.pivottable to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.usermodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.usermodel.helpers to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.hssf.util to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.common to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt.agile to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt.binaryrc4 to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt.cryptoapi to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt.standard to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.crypt.xor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.dev to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.eventfilesystem to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.filesystem to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.macros to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.nio to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.property to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.poifs.storage to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.sl.draw to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.sl.draw.geom to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.sl.extractor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.sl.image to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.sl.usermodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.extractor to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.format to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.atp to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.constant to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.eval to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.eval.forked to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.function to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.functions to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.ptg to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.formula.udf to org.junit.platform.commons;
|
||||||
opens org.apache.poi.ss.usermodel to org.junit.platform.commons;
|
opens org.apache.poi.ss.usermodel to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.usermodel.helpers to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.util to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.ss.util.cellwalk to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.util to org.junit.platform.commons;
|
||||||
|
opens org.apache.poi.wp.usermodel to org.junit.platform.commons;
|
||||||
}
|
}
|
|
@ -42,12 +42,13 @@ public final class TestSXSSFRow extends BaseTestXRow {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
|
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
|
||||||
public void testCellShiftingRight(){
|
protected void testCellShiftingRight(){
|
||||||
// Remove when SXSSFRow.shiftCellsRight() is implemented.
|
// Remove when SXSSFRow.shiftCellsRight() is implemented.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
|
@Disabled("see <https://bz.apache.org/bugzilla/show_bug.cgi?id=62030#c1>") @Test
|
||||||
public void testCellShiftingLeft(){
|
protected void testCellShiftingLeft(){
|
||||||
// Remove when SXSSFRow.shiftCellsLeft() is implemented.
|
// Remove when SXSSFRow.shiftCellsLeft() is implemented.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,7 @@ public final class TestXSSFSheetShiftRows extends BaseTestSheetShiftRows {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Test
|
protected void testShiftRowBreaks() {
|
||||||
public void testShiftRowBreaks() {
|
|
||||||
// disabled test from superclass
|
// disabled test from superclass
|
||||||
// TODO - support shifting of page breaks
|
// TODO - support shifting of page breaks
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public class TestJDK12 {
|
public class TestJDK12 {
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
void test() {
|
||||||
assertDoesNotThrow(() -> {
|
assertDoesNotThrow(() -> {
|
||||||
BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
|
||||||
Graphics2D graphics = img.createGraphics();
|
Graphics2D graphics = img.createGraphics();
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherBSERecord {
|
public final class TestEscherBSERecord {
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " +
|
String data = "01 00 00 00 24 00 00 00 05 05 01 02 03 04 " +
|
||||||
" 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 00 00 00 " +
|
" 05 06 07 08 09 0A 0B 0C 0D 0E 0F 00 01 00 00 00 " +
|
||||||
" 00 00 02 00 00 00 03 00 00 00 04 05 06 07";
|
" 00 00 02 00 00 00 03 00 00 00 04 05 06 07";
|
||||||
|
@ -52,7 +52,7 @@ public final class TestEscherBSERecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() throws IOException {
|
void testSerialize() throws IOException {
|
||||||
EscherBSERecord r = createRecord();
|
EscherBSERecord r = createRecord();
|
||||||
String exp64 = "H4sIAAAAAAAAAGNkYP+gwsDAwMrKyMTMwsrGzsHJxc3Dy8fPwMgAAkxAzAzEICkAgs9OoSwAAAA=";
|
String exp64 = "H4sIAAAAAAAAAGNkYP+gwsDAwMrKyMTMwsrGzsHJxc3Dy8fPwMgAAkxAzAzEICkAgs9OoSwAAAA=";
|
||||||
byte[] expected = RawDataUtil.decompress(exp64);
|
byte[] expected = RawDataUtil.decompress(exp64);
|
||||||
|
@ -82,7 +82,7 @@ public final class TestEscherBSERecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
EscherBSERecord record = createRecord();
|
EscherBSERecord record = createRecord();
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* BSE */\n" +
|
"{ /* BSE */\n" +
|
||||||
|
|
|
@ -34,7 +34,7 @@ public final class TestEscherBlipRecord {
|
||||||
|
|
||||||
//test reading/serializing of a PNG blip
|
//test reading/serializing of a PNG blip
|
||||||
@Test
|
@Test
|
||||||
public void testReadPNG() {
|
void testReadPNG() {
|
||||||
//provided in bug-44886
|
//provided in bug-44886
|
||||||
byte[] data = _samples.readFile("Container.dat");
|
byte[] data = _samples.readFile("Container.dat");
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public final class TestEscherBlipRecord {
|
||||||
|
|
||||||
//test reading/serializing of a PICT metafile
|
//test reading/serializing of a PICT metafile
|
||||||
@Test
|
@Test
|
||||||
public void testReadPICT() {
|
void testReadPICT() {
|
||||||
//provided in bug-44886
|
//provided in bug-44886
|
||||||
byte[] data = _samples.readFile("Container.dat");
|
byte[] data = _samples.readFile("Container.dat");
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ public final class TestEscherBlipRecord {
|
||||||
|
|
||||||
//integral test: check that the read-write-read round trip is consistent
|
//integral test: check that the read-write-read round trip is consistent
|
||||||
@Test
|
@Test
|
||||||
public void testContainer() {
|
void testContainer() {
|
||||||
byte[] data = _samples.readFile("Container.dat");
|
byte[] data = _samples.readFile("Container.dat");
|
||||||
|
|
||||||
EscherContainerRecord record = new EscherContainerRecord();
|
EscherContainerRecord record = new EscherContainerRecord();
|
||||||
|
@ -147,7 +147,7 @@ public final class TestEscherBlipRecord {
|
||||||
* The test data was created from pl031405.xls attached to Bugzilla #47143
|
* The test data was created from pl031405.xls attached to Bugzilla #47143
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test47143() {
|
void test47143() {
|
||||||
byte[] data = _samples.readFile("47143.dat");
|
byte[] data = _samples.readFile("47143.dat");
|
||||||
EscherBSERecord bse = new EscherBSERecord();
|
EscherBSERecord bse = new EscherBSERecord();
|
||||||
bse.fillFields(data, 0, new DefaultEscherRecordFactory());
|
bse.fillFields(data, 0, new DefaultEscherRecordFactory());
|
||||||
|
|
|
@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherBoolProperty {
|
public final class TestEscherBoolProperty {
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
EscherBoolProperty p = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1);
|
EscherBoolProperty p = new EscherBoolProperty(EscherPropertyTypes.GEOMETRY__FILLOK, 1);
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* GEOMETRY__FILLOK */\n" +
|
"{ /* GEOMETRY__FILLOK */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherChildAnchorRecord {
|
public final class TestEscherChildAnchorRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherChildAnchorRecord r = createRecord();
|
EscherChildAnchorRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[8 + 16];
|
byte[] data = new byte[8 + 16];
|
||||||
|
@ -41,7 +41,7 @@ public final class TestEscherChildAnchorRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "01 00 " +
|
String hexData = "01 00 " +
|
||||||
"0F F0 " +
|
"0F F0 " +
|
||||||
"10 00 00 00 " +
|
"10 00 00 00 " +
|
||||||
|
@ -63,7 +63,7 @@ public final class TestEscherChildAnchorRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString(){
|
void testToString(){
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* CHILD_ANCHOR */\n" +
|
"{ /* CHILD_ANCHOR */\n" +
|
||||||
"\t \"recordId\": -4081 /* 0xf00f */\n" +
|
"\t \"recordId\": -4081 /* 0xf00f */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TestEscherClientAnchorRecord {
|
public class TestEscherClientAnchorRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherClientAnchorRecord r = createRecord();
|
EscherClientAnchorRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[8 + 18 + 2];
|
byte[] data = new byte[8 + 18 + 2];
|
||||||
|
@ -41,7 +41,7 @@ public class TestEscherClientAnchorRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "01 00 " +
|
String hexData = "01 00 " +
|
||||||
"10 F0 " +
|
"10 F0 " +
|
||||||
"14 00 00 00 " +
|
"14 00 00 00 " +
|
||||||
|
@ -69,7 +69,7 @@ public class TestEscherClientAnchorRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* CLIENT_ANCHOR */\n" +
|
"{ /* CLIENT_ANCHOR */\n" +
|
||||||
"\t \"recordId\": -4080 /* 0xf010 */\n" +
|
"\t \"recordId\": -4080 /* 0xf010 */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TestEscherClientDataRecord {
|
public class TestEscherClientDataRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherClientDataRecord r = createRecord();
|
EscherClientDataRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[8];
|
byte[] data = new byte[8];
|
||||||
|
@ -38,7 +38,7 @@ public class TestEscherClientDataRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "02 00 " +
|
String hexData = "02 00 " +
|
||||||
"11 F0 " +
|
"11 F0 " +
|
||||||
"00 00 00 00 ";
|
"00 00 00 00 ";
|
||||||
|
@ -52,7 +52,7 @@ public class TestEscherClientDataRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* CLIENT_DATA */\n" +
|
"{ /* CLIENT_DATA */\n" +
|
||||||
"\t \"recordId\": -4079 /* 0xf011 */\n" +
|
"\t \"recordId\": -4079 /* 0xf011 */\n" +
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class TestEscherContainerRecord {
|
||||||
private static final POIDataSamples _samples = POIDataSamples.getDDFInstance();
|
private static final POIDataSamples _samples = POIDataSamples.getDDFInstance();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
EscherRecordFactory f = new DefaultEscherRecordFactory();
|
EscherRecordFactory f = new DefaultEscherRecordFactory();
|
||||||
byte[] data = HexRead.readFromString("0F 02 11 F1 00 00 00 00");
|
byte[] data = HexRead.readFromString("0F 02 11 F1 00 00 00 00");
|
||||||
EscherRecord r = f.createRecord(data, 0);
|
EscherRecord r = f.createRecord(data, 0);
|
||||||
|
@ -57,7 +57,7 @@ public final class TestEscherContainerRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
UnknownEscherRecord r = new UnknownEscherRecord();
|
UnknownEscherRecord r = new UnknownEscherRecord();
|
||||||
r.setOptions((short) 0x123F);
|
r.setOptions((short) 0x123F);
|
||||||
r.setRecordId((short) 0xF112);
|
r.setRecordId((short) 0xF112);
|
||||||
|
@ -78,7 +78,7 @@ public final class TestEscherContainerRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
EscherContainerRecord r = new EscherContainerRecord();
|
EscherContainerRecord r = new EscherContainerRecord();
|
||||||
r.setRecordId(EscherContainerRecord.SP_CONTAINER);
|
r.setRecordId(EscherContainerRecord.SP_CONTAINER);
|
||||||
r.setOptions((short) 0x000F);
|
r.setOptions((short) 0x000F);
|
||||||
|
@ -176,7 +176,7 @@ public final class TestEscherContainerRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetRecordSize() {
|
void testGetRecordSize() {
|
||||||
EscherContainerRecord r = new EscherContainerRecord();
|
EscherContainerRecord r = new EscherContainerRecord();
|
||||||
r.addChildRecord(new DummyEscherRecord());
|
r.addChildRecord(new DummyEscherRecord());
|
||||||
assertEquals(18, r.getRecordSize());
|
assertEquals(18, r.getRecordSize());
|
||||||
|
@ -187,7 +187,7 @@ public final class TestEscherContainerRecord {
|
||||||
* but hopefully we now read the correct size.
|
* but hopefully we now read the correct size.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBug44857() {
|
void testBug44857() {
|
||||||
byte[] data = _samples.readFile("Container.dat");
|
byte[] data = _samples.readFile("Container.dat");
|
||||||
|
|
||||||
// This used to fail with an OutOfMemory
|
// This used to fail with an OutOfMemory
|
||||||
|
@ -203,7 +203,7 @@ public final class TestEscherContainerRecord {
|
||||||
* Ensure {@link EscherContainerRecord} doesn't spill its guts everywhere
|
* Ensure {@link EscherContainerRecord} doesn't spill its guts everywhere
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testChildren() {
|
void testChildren() {
|
||||||
EscherContainerRecord ecr = new EscherContainerRecord();
|
EscherContainerRecord ecr = new EscherContainerRecord();
|
||||||
List<EscherRecord> children0 = ecr.getChildRecords();
|
List<EscherRecord> children0 = ecr.getChildRecords();
|
||||||
assertEquals(0, children0.size());
|
assertEquals(0, children0.size());
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherDgRecord {
|
public final class TestEscherDgRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherDgRecord r = createRecord();
|
EscherDgRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[16];
|
byte[] data = new byte[16];
|
||||||
|
@ -40,7 +40,7 @@ public final class TestEscherDgRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "10 00 " +
|
String hexData = "10 00 " +
|
||||||
"08 F0 " +
|
"08 F0 " +
|
||||||
"08 00 00 00 " +
|
"08 00 00 00 " +
|
||||||
|
@ -56,7 +56,7 @@ public final class TestEscherDgRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* DG */\n" +
|
"{ /* DG */\n" +
|
||||||
"\t \"recordId\": -4088 /* 0xf008 */\n" +
|
"\t \"recordId\": -4088 /* 0xf008 */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherDggRecord {
|
public final class TestEscherDggRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherDggRecord r = createRecord();
|
EscherDggRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[32];
|
byte[] data = new byte[32];
|
||||||
|
@ -43,7 +43,7 @@ public final class TestEscherDggRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "00 00 " +
|
String hexData = "00 00 " +
|
||||||
"06 F0 " +
|
"06 F0 " +
|
||||||
"18 00 00 00 " +
|
"18 00 00 00 " +
|
||||||
|
@ -67,7 +67,7 @@ public final class TestEscherDggRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* DGG */\n" +
|
"{ /* DGG */\n" +
|
||||||
"\t \"recordId\": -4090 /* 0xf006 */\n" +
|
"\t \"recordId\": -4090 /* 0xf006 */\n" +
|
||||||
|
@ -104,7 +104,7 @@ public final class TestEscherDggRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetRecordSize() {
|
void testGetRecordSize() {
|
||||||
EscherDggRecord r = new EscherDggRecord();
|
EscherDggRecord r = new EscherDggRecord();
|
||||||
r.setFileIdClusters(new EscherDggRecord.FileIdCluster[] { new EscherDggRecord.FileIdCluster(0,0) } );
|
r.setFileIdClusters(new EscherDggRecord.FileIdCluster[] { new EscherDggRecord.FileIdCluster(0,0) } );
|
||||||
assertEquals(32,r.getRecordSize());
|
assertEquals(32,r.getRecordSize());
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class TestEscherDump {
|
||||||
|
|
||||||
// simple test to at least cover some parts of the class
|
// simple test to at least cover some parts of the class
|
||||||
@Test
|
@Test
|
||||||
public void testSimple() throws Exception {
|
void testSimple() throws Exception {
|
||||||
// Decode the stream to bytes
|
// Decode the stream to bytes
|
||||||
byte[] bytes = RawDataUtil.decompress(recordData);
|
byte[] bytes = RawDataUtil.decompress(recordData);
|
||||||
// Dump the contents of escher to stream.
|
// Dump the contents of escher to stream.
|
||||||
|
@ -91,13 +91,13 @@ public class TestEscherDump {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithData() {
|
void testWithData() {
|
||||||
dumper.dump(8, new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, stream);
|
dumper.dump(8, new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, stream);
|
||||||
assertEquals(6, countProperties());
|
assertEquals(6, countProperties());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithSamplefile() throws Exception {
|
void testWithSamplefile() throws Exception {
|
||||||
//InputStream stream = HSSFTestDataSamples.openSampleFileStream(")
|
//InputStream stream = HSSFTestDataSamples.openSampleFileStream(")
|
||||||
byte[] data = POIDataSamples.getDDFInstance().readFile("Container.dat");
|
byte[] data = POIDataSamples.getDDFInstance().readFile("Container.dat");
|
||||||
dumper.dump(data.length, data, stream);
|
dumper.dump(data.length, data, stream);
|
||||||
|
@ -113,7 +113,7 @@ public class TestEscherDump {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCopy() throws Exception {
|
void testCopy() throws Exception {
|
||||||
byte[] data1 = RawDataUtil.decompress(recordData);
|
byte[] data1 = RawDataUtil.decompress(recordData);
|
||||||
|
|
||||||
EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
|
EscherRecordFactory recordFactory = new DefaultEscherRecordFactory();
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestEscherOptRecord {
|
public final class TestEscherOptRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
checkFillFieldsSimple();
|
checkFillFieldsSimple();
|
||||||
checkFillFieldsComplex();
|
checkFillFieldsComplex();
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public final class TestEscherOptRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
checkSerializeSimple();
|
checkSerializeSimple();
|
||||||
checkSerializeComplex();
|
checkSerializeComplex();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public final class TestEscherOptRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
EscherOptRecord r = new EscherOptRecord();
|
EscherOptRecord r = new EscherOptRecord();
|
||||||
// don't try to shoot in foot, please -- vlsergey
|
// don't try to shoot in foot, please -- vlsergey
|
||||||
// r.setOptions((short)0x000F);
|
// r.setOptions((short)0x000F);
|
||||||
|
@ -173,7 +173,7 @@ public final class TestEscherOptRecord {
|
||||||
* This test is currently broken!
|
* This test is currently broken!
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testComplexSerialise() {
|
void testComplexSerialise() {
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
0x53, 0x01, 0x0B, 0xF0-256, 0x9C-256, 0x01, 0x00, 0x00,
|
0x53, 0x01, 0x0B, 0xF0-256, 0x9C-256, 0x01, 0x00, 0x00,
|
||||||
// Simple data follows
|
// Simple data follows
|
||||||
|
@ -273,7 +273,7 @@ public final class TestEscherOptRecord {
|
||||||
* See Bug 41946 for details.
|
* See Bug 41946 for details.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test41946() throws IOException {
|
void test41946() throws IOException {
|
||||||
String data64 =
|
String data64 =
|
||||||
"H4sIAAAAAAAAAB3SuW5TQRjF8TPfOOZCHMeARAluEKIzSEgUSCQsLaLgDYCehgIJCe8L+xIgQB6"+
|
"H4sIAAAAAAAAAB3SuW5TQRjF8TPfOOZCHMeARAluEKIzSEgUSCQsLaLgDYCehgIJCe8L+xIgQB6"+
|
||||||
"AEvEAOI6zOwlhX54BpBRIiGqY+Vvy7x6d+3k8nmufje/ISzVVrjrVNftWapCb5JbSqyMX7ZJ72I"+
|
"AEvEAOI6zOwlhX54BpBRIiGqY+Vvy7x6d+3k8nmufje/ISzVVrjrVNftWapCb5JbSqyMX7ZJ72I"+
|
||||||
|
@ -302,7 +302,7 @@ public final class TestEscherOptRecord {
|
||||||
* with empty complex part.
|
* with empty complex part.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyArrayProperty() {
|
void testEmptyArrayProperty() {
|
||||||
EscherOptRecord r = new EscherOptRecord();
|
EscherOptRecord r = new EscherOptRecord();
|
||||||
EscherArrayProperty p = new EscherArrayProperty(EscherPropertyTypes.FILL__SHADECOLORS, false, 0);
|
EscherArrayProperty p = new EscherArrayProperty(EscherPropertyTypes.FILL__SHADECOLORS, false, 0);
|
||||||
assertEquals(0, p.getNumberOfElementsInArray());
|
assertEquals(0, p.getNumberOfElementsInArray());
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class TestEscherProperty {
|
||||||
* See Bugzilla 50401
|
* See Bugzilla 50401
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPropertyNames() throws Exception {
|
void testPropertyNames() throws Exception {
|
||||||
EscherProperty p1 = new EscherSimpleProperty( EscherPropertyTypes.GROUPSHAPE__SHAPENAME, 0);
|
EscherProperty p1 = new EscherSimpleProperty( EscherPropertyTypes.GROUPSHAPE__SHAPENAME, 0);
|
||||||
assertEquals("groupshape.shapename", p1.getName());
|
assertEquals("groupshape.shapename", p1.getName());
|
||||||
assertEquals(EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber, p1.getPropertyNumber());
|
assertEquals(EscherPropertyTypes.GROUPSHAPE__SHAPENAME.propNumber, p1.getPropertyNumber());
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TestEscherPropertyFactory {
|
public class TestEscherPropertyFactory {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateProperties() {
|
void testCreateProperties() {
|
||||||
String dataStr = "41 C1 " + // propid, complex ind
|
String dataStr = "41 C1 " + // propid, complex ind
|
||||||
"03 00 00 00 " + // size of complex property
|
"03 00 00 00 " + // size of complex property
|
||||||
"01 00 " + // propid, complex ind
|
"01 00 " + // propid, complex ind
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TestEscherSpRecord {
|
public class TestEscherSpRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherSpRecord r = createRecord();
|
EscherSpRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[16];
|
byte[] data = new byte[16];
|
||||||
|
@ -40,7 +40,7 @@ public class TestEscherSpRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "02 00 " +
|
String hexData = "02 00 " +
|
||||||
"0A F0 " +
|
"0A F0 " +
|
||||||
"08 00 00 00 " +
|
"08 00 00 00 " +
|
||||||
|
@ -56,7 +56,7 @@ public class TestEscherSpRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* SP */\n" +
|
"{ /* SP */\n" +
|
||||||
"\t \"recordId\": -4086 /* 0xf00a */\n" +
|
"\t \"recordId\": -4086 /* 0xf00a */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherSpgrRecord {
|
public final class TestEscherSpgrRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherSpgrRecord r = createRecord();
|
EscherSpgrRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[24];
|
byte[] data = new byte[24];
|
||||||
|
@ -42,7 +42,7 @@ public final class TestEscherSpgrRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "10 00 " +
|
String hexData = "10 00 " +
|
||||||
"09 F0 " +
|
"09 F0 " +
|
||||||
"10 00 00 00 " +
|
"10 00 00 00 " +
|
||||||
|
@ -62,7 +62,7 @@ public final class TestEscherSpgrRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* SPGR */\n" +
|
"{ /* SPGR */\n" +
|
||||||
"\t \"recordId\": -4087 /* 0xf009 */\n" +
|
"\t \"recordId\": -4087 /* 0xf009 */\n" +
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestEscherSplitMenuColorsRecord {
|
public final class TestEscherSplitMenuColorsRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
EscherSplitMenuColorsRecord r = createRecord();
|
EscherSplitMenuColorsRecord r = createRecord();
|
||||||
|
|
||||||
byte[] data = new byte[24];
|
byte[] data = new byte[24];
|
||||||
|
@ -42,7 +42,7 @@ public final class TestEscherSplitMenuColorsRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String hexData = "40 00 " +
|
String hexData = "40 00 " +
|
||||||
"1E F1 " +
|
"1E F1 " +
|
||||||
"10 00 00 00 " +
|
"10 00 00 00 " +
|
||||||
|
@ -62,7 +62,7 @@ public final class TestEscherSplitMenuColorsRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
String expected =
|
String expected =
|
||||||
"{ /* SPLIT_MENU_COLORS */\n" +
|
"{ /* SPLIT_MENU_COLORS */\n" +
|
||||||
"\t \"recordId\": -3810 /* 0xf11e */\n" +
|
"\t \"recordId\": -3810 /* 0xf11e */\n" +
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestUnknownEscherRecord {
|
public final class TestUnknownEscherRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testFillFields() {
|
void testFillFields() {
|
||||||
String testData =
|
String testData =
|
||||||
"0F 02 " + // options
|
"0F 02 " + // options
|
||||||
"11 F1 " + // record id
|
"11 F1 " + // record id
|
||||||
|
@ -123,7 +123,7 @@ public final class TestUnknownEscherRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
UnknownEscherRecord r = new UnknownEscherRecord();
|
UnknownEscherRecord r = new UnknownEscherRecord();
|
||||||
r.setOptions( (short) 0x1234 );
|
r.setOptions( (short) 0x1234 );
|
||||||
r.setRecordId( (short) 0xF112 );
|
r.setRecordId( (short) 0xF112 );
|
||||||
|
@ -144,7 +144,7 @@ public final class TestUnknownEscherRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testToString() {
|
void testToString() {
|
||||||
UnknownEscherRecord r = new UnknownEscherRecord();
|
UnknownEscherRecord r = new UnknownEscherRecord();
|
||||||
r.setOptions( (short) 0x1234 );
|
r.setOptions( (short) 0x1234 );
|
||||||
r.setRecordId( (short) 0xF112 );
|
r.setRecordId( (short) 0xF112 );
|
||||||
|
|
|
@ -34,7 +34,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public class TestVariantSupport {
|
public class TestVariantSupport {
|
||||||
@Test
|
@Test
|
||||||
public void test52337() throws Exception {
|
void test52337() throws Exception {
|
||||||
// document summary stream from test1-excel.doc attached to Bugzilla 52337
|
// document summary stream from test1-excel.doc attached to Bugzilla 52337
|
||||||
String documentSummaryEnc =
|
String documentSummaryEnc =
|
||||||
"H4sIAAAAAAAAAG2RsUvDQBjFXxsraiuNKDoI8ZwclIJOjhYCGpQitINbzXChgTQtyQ3+Hw52cHB0E"+
|
"H4sIAAAAAAAAAG2RsUvDQBjFXxsraiuNKDoI8ZwclIJOjhYCGpQitINbzXChgTQtyQ3+Hw52cHB0E"+
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
package org.apache.poi.hpsf.basic;
|
|
||||||
|
|
||||||
import org.apache.poi.POIDataSamples;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileFilter;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Processes a test method for all OLE2 files in the HPSF test data
|
|
||||||
* directory. Well, this class does not check whether a file is an OLE2 file but
|
|
||||||
* rather whether its name begins with "Test".</p>
|
|
||||||
*/
|
|
||||||
public class AllDataFilesTester {
|
|
||||||
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Interface specifying how to run a test on a single file.</p>
|
|
||||||
*/
|
|
||||||
public interface TestTask
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* <p>Executes a test on a single file.</p>
|
|
||||||
*
|
|
||||||
* @param file the file
|
|
||||||
* @throws Throwable if the method throws anything.
|
|
||||||
*/
|
|
||||||
void runTest(File file) throws Throwable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>Tests the simplified custom properties.</p>
|
|
||||||
*
|
|
||||||
* @param task the task to execute
|
|
||||||
* @throws Throwable
|
|
||||||
*/
|
|
||||||
public void runTests(final TestTask task) throws Throwable
|
|
||||||
{
|
|
||||||
POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
|
||||||
final File dataDir = _samples.getFile("");
|
|
||||||
final File[] docs = dataDir.listFiles(new FileFilter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean accept(final File file)
|
|
||||||
{
|
|
||||||
return file.isFile() && file.getName().startsWith("Test");
|
|
||||||
}});
|
|
||||||
for (final File doc : docs) {
|
|
||||||
final Logger logger = Logger.getLogger(getClass().getName());
|
|
||||||
logger.info("Processing file \" " + doc + "\".");
|
|
||||||
|
|
||||||
/* Execute the test task. */
|
|
||||||
task.runTest(doc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -87,7 +87,7 @@ public final class TestBasic {
|
||||||
* are expected to be in a certain order.</p>
|
* are expected to be in a certain order.</p>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadFiles() {
|
void testReadFiles() {
|
||||||
String[] expected = POI_FILES;
|
String[] expected = POI_FILES;
|
||||||
for (int i = 0; i < expected.length; i++) {
|
for (int i = 0; i < expected.length; i++) {
|
||||||
assertEquals(poiFiles.get(i).getName(), expected[i]);
|
assertEquals(poiFiles.get(i).getName(), expected[i]);
|
||||||
|
@ -109,7 +109,7 @@ public final class TestBasic {
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePropertySets()
|
void testCreatePropertySets()
|
||||||
throws UnsupportedEncodingException, IOException {
|
throws UnsupportedEncodingException, IOException {
|
||||||
Class<?>[] expected = {
|
Class<?>[] expected = {
|
||||||
SummaryInformation.class,
|
SummaryInformation.class,
|
||||||
|
@ -140,7 +140,7 @@ public final class TestBasic {
|
||||||
* @exception HPSFException if any HPSF exception occurs
|
* @exception HPSFException if any HPSF exception occurs
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPropertySetMethods() throws IOException, HPSFException {
|
void testPropertySetMethods() throws IOException, HPSFException {
|
||||||
/* Loop over the two property sets. */
|
/* Loop over the two property sets. */
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
byte[] b = poiFiles.get(i).getBytes();
|
byte[] b = poiFiles.get(i).getBytes();
|
||||||
|
@ -164,7 +164,7 @@ public final class TestBasic {
|
||||||
* @exception HPSFException if any HPSF exception occurs
|
* @exception HPSFException if any HPSF exception occurs
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSectionMethods() throws IOException, HPSFException {
|
void testSectionMethods() throws IOException, HPSFException {
|
||||||
InputStream is = new ByteArrayInputStream(poiFiles.get(0).getBytes());
|
InputStream is = new ByteArrayInputStream(poiFiles.get(0).getBytes());
|
||||||
final SummaryInformation si = (SummaryInformation)PropertySetFactory.create(is);
|
final SummaryInformation si = (SummaryInformation)PropertySetFactory.create(is);
|
||||||
final List<Section> sections = si.getSections();
|
final List<Section> sections = si.getSections();
|
||||||
|
|
|
@ -39,7 +39,7 @@ public final class TestClassID {
|
||||||
* Various tests of overridden .equals()
|
* Various tests of overridden .equals()
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
void testEquals() {
|
||||||
ClassID clsidTest1 = new ClassID(BUF16, 0);
|
ClassID clsidTest1 = new ClassID(BUF16, 0);
|
||||||
ClassID clsidTest2 = new ClassID(BUF16, 0);
|
ClassID clsidTest2 = new ClassID(BUF16, 0);
|
||||||
byte[] buf2 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17};
|
byte[] buf2 = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17};
|
||||||
|
@ -55,24 +55,24 @@ public final class TestClassID {
|
||||||
* throw an Exception
|
* throw an Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWriteArrayStoreException1() {
|
void testWriteArrayStoreException1() {
|
||||||
assertThrows(ArrayStoreException.class, () -> new ClassID(BUF16, 0).write(new byte[15], 0));
|
assertThrows(ArrayStoreException.class, () -> new ClassID(BUF16, 0).write(new byte[15], 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWriteArrayStoreException2() {
|
void testWriteArrayStoreException2() {
|
||||||
assertThrows(ArrayIndexOutOfBoundsException.class, () -> new ClassID(BUF16, 0).write(new byte[16], 1));
|
assertThrows(ArrayIndexOutOfBoundsException.class, () -> new ClassID(BUF16, 0).write(new byte[16], 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWriteArrayStoreException3() {
|
void testWriteArrayStoreException3() {
|
||||||
ClassID clsidTest = new ClassID(BUF16, 0);
|
ClassID clsidTest = new ClassID(BUF16, 0);
|
||||||
assertDoesNotThrow(() -> clsidTest.write(new byte[16], 0));
|
assertDoesNotThrow(() -> clsidTest.write(new byte[16], 0));
|
||||||
assertDoesNotThrow(() -> clsidTest.write(new byte[17], 1));
|
assertDoesNotThrow(() -> clsidTest.write(new byte[17], 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClassID() {
|
void testClassID() {
|
||||||
ClassID clsidTest = new ClassID(BUF16, 0);
|
ClassID clsidTest = new ClassID(BUF16, 0);
|
||||||
assertEquals("{04030201-0605-0807-090A-0B0C0D0E0F10}", clsidTest.toString());
|
assertEquals("{04030201-0605-0807-090A-0B0C0D0E0F10}", clsidTest.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public final class TestEmptyProperties {
|
||||||
* are expected to be in a certain order.
|
* are expected to be in a certain order.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadFiles() {
|
void testReadFiles() {
|
||||||
String[] expected = POI_FILES;
|
String[] expected = POI_FILES;
|
||||||
for (int i = 0; i < expected.length; i++)
|
for (int i = 0; i < expected.length; i++)
|
||||||
assertEquals(poiFiles.get(i).getName(), expected[i]);
|
assertEquals(poiFiles.get(i).getName(), expected[i]);
|
||||||
|
@ -101,7 +101,7 @@ public final class TestEmptyProperties {
|
||||||
* supported.
|
* supported.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreatePropertySets()
|
void testCreatePropertySets()
|
||||||
throws UnsupportedEncodingException, IOException {
|
throws UnsupportedEncodingException, IOException {
|
||||||
Class<?>[] expected = {
|
Class<?>[] expected = {
|
||||||
NoPropertySetStreamException.class,
|
NoPropertySetStreamException.class,
|
||||||
|
@ -130,7 +130,7 @@ public final class TestEmptyProperties {
|
||||||
* @exception HPSFException if an HPSF operation fails
|
* @exception HPSFException if an HPSF operation fails
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPropertySetMethods() throws IOException, HPSFException {
|
void testPropertySetMethods() throws IOException, HPSFException {
|
||||||
byte[] b = poiFiles.get(1).getBytes();
|
byte[] b = poiFiles.get(1).getBytes();
|
||||||
PropertySet ps = PropertySetFactory.create(new ByteArrayInputStream(b));
|
PropertySet ps = PropertySetFactory.create(new ByteArrayInputStream(b));
|
||||||
SummaryInformation s = (SummaryInformation) ps;
|
SummaryInformation s = (SummaryInformation) ps;
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class TestHPSFBugs {
|
||||||
* reload, and still access & change them.
|
* reload, and still access & change them.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test48832() throws IOException {
|
void test48832() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
|
|
||||||
// Starts empty
|
// Starts empty
|
||||||
|
@ -112,7 +112,7 @@ public final class TestHPSFBugs {
|
||||||
* reading junk
|
* reading junk
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test54233() throws IOException, NoPropertySetStreamException, MarkUnsupportedException {
|
void test54233() throws IOException, NoPropertySetStreamException, MarkUnsupportedException {
|
||||||
InputStream is = _samples.openResourceAsStream("TestNon4ByteBoundary.doc");
|
InputStream is = _samples.openResourceAsStream("TestNon4ByteBoundary.doc");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
is.close();
|
is.close();
|
||||||
|
@ -150,7 +150,7 @@ public final class TestHPSFBugs {
|
||||||
* CodePage Strings can be zero length
|
* CodePage Strings can be zero length
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test56138() throws IOException, NoPropertySetStreamException {
|
void test56138() throws IOException, NoPropertySetStreamException {
|
||||||
InputStream is = _samples.openResourceAsStream("TestZeroLengthCodePage.mpp");
|
InputStream is = _samples.openResourceAsStream("TestZeroLengthCodePage.mpp");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
is.close();
|
is.close();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public final class TestMetaDataIPI {
|
||||||
* Sets the most important information in DocumentSummaryInformation and Summary Information and rereads it
|
* Sets the most important information in DocumentSummaryInformation and Summary Information and rereads it
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testOne() throws Exception {
|
void testOne() throws Exception {
|
||||||
|
|
||||||
// DocumentSummaryInformation
|
// DocumentSummaryInformation
|
||||||
dsi.setCompany("xxxCompanyxxx");
|
dsi.setCompany("xxxCompanyxxx");
|
||||||
|
@ -154,7 +154,7 @@ public final class TestMetaDataIPI {
|
||||||
* Test very long input in each of the fields (approx 30-60KB each)
|
* Test very long input in each of the fields (approx 30-60KB each)
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTwo() throws Exception {
|
void testTwo() throws Exception {
|
||||||
|
|
||||||
String company = elongate("company");
|
String company = elongate("company");
|
||||||
String manager = elongate("manager");
|
String manager = elongate("manager");
|
||||||
|
@ -238,7 +238,7 @@ public final class TestMetaDataIPI {
|
||||||
* Tests with strange characters in keys and data (Umlaute etc.)
|
* Tests with strange characters in keys and data (Umlaute etc.)
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testThree() throws Exception {
|
void testThree() throws Exception {
|
||||||
|
|
||||||
String company = strangize("company");
|
String company = strangize("company");
|
||||||
String manager = strangize("manager");
|
String manager = strangize("manager");
|
||||||
|
@ -322,7 +322,7 @@ public final class TestMetaDataIPI {
|
||||||
* Iterative testing: writing, reading etc.
|
* Iterative testing: writing, reading etc.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFour() throws Exception {
|
void testFour() throws Exception {
|
||||||
for (int i = 1; i < 100; i++) {
|
for (int i = 1; i < 100; i++) {
|
||||||
testThree();
|
testThree();
|
||||||
closeAndReOpen();
|
closeAndReOpen();
|
||||||
|
@ -333,7 +333,7 @@ public final class TestMetaDataIPI {
|
||||||
* Unicode test
|
* Unicode test
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUnicode() throws Exception {
|
void testUnicode() throws Exception {
|
||||||
String company = strangizeU("company");
|
String company = strangizeU("company");
|
||||||
String manager = strangizeU("manager");
|
String manager = strangizeU("manager");
|
||||||
String category = strangizeU("category");
|
String category = strangizeU("category");
|
||||||
|
@ -414,7 +414,7 @@ public final class TestMetaDataIPI {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSix() throws Exception {
|
void testSix() throws Exception {
|
||||||
for (int i = 1; i < 100; i++) {
|
for (int i = 1; i < 100; i++) {
|
||||||
testUnicode();
|
testUnicode();
|
||||||
closeAndReOpen();
|
closeAndReOpen();
|
||||||
|
@ -426,7 +426,7 @@ public final class TestMetaDataIPI {
|
||||||
* Tests conversion in custom fields and errors
|
* Tests conversion in custom fields and errors
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testConvAndExistence() throws Exception {
|
void testConvAndExistence() throws Exception {
|
||||||
|
|
||||||
CustomProperties customProperties = dsi.getCustomProperties();
|
CustomProperties customProperties = dsi.getCustomProperties();
|
||||||
if (customProperties == null) {
|
if (customProperties == null) {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class TestUnicode {
|
||||||
* @exception HPSFException if an HPSF exception occurs
|
* @exception HPSFException if an HPSF exception occurs
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPropertySetMethods() throws IOException, HPSFException {
|
void testPropertySetMethods() throws IOException, HPSFException {
|
||||||
POIFile poiFile = Util.readPOIFiles(data, POI_FILES).get(0);
|
POIFile poiFile = Util.readPOIFiles(data, POI_FILES).get(0);
|
||||||
byte[] b = poiFile.getBytes();
|
byte[] b = poiFile.getBytes();
|
||||||
PropertySet ps = PropertySetFactory.create(new ByteArrayInputStream(b));
|
PropertySet ps = PropertySetFactory.create(new ByteArrayInputStream(b));
|
||||||
|
|
|
@ -170,7 +170,7 @@ public class TestWriteWellKnown {
|
||||||
* @throws IOException if some I/O error occurred.
|
* @throws IOException if some I/O error occurred.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWriteWellKnown() throws Exception {
|
void testWriteWellKnown() throws Exception {
|
||||||
POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
||||||
|
|
||||||
final File doc1 = TempFile.createTempFile("POI_HPSF_Test1.", ".tmp");
|
final File doc1 = TempFile.createTempFile("POI_HPSF_Test1.", ".tmp");
|
||||||
|
@ -509,7 +509,7 @@ public class TestWriteWellKnown {
|
||||||
* Tests basic custom property features.
|
* Tests basic custom property features.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCustomerProperties()
|
void testCustomerProperties()
|
||||||
{
|
{
|
||||||
final String KEY = "Schl\u00fcssel \u00e4";
|
final String KEY = "Schl\u00fcssel \u00e4";
|
||||||
final String VALUE_1 = "Wert 1";
|
final String VALUE_1 = "Wert 1";
|
||||||
|
@ -548,7 +548,7 @@ public class TestWriteWellKnown {
|
||||||
* custom properties which are not pure.
|
* custom properties which are not pure.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCustomerProperties()
|
void testGetCustomerProperties()
|
||||||
{
|
{
|
||||||
final int ID_1 = 2;
|
final int ID_1 = 2;
|
||||||
final int ID_2 = 3;
|
final int ID_2 = 3;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
private static final POIDataSamples _samples = POIDataSamples.getHPSFInstance();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalProperties() throws Exception {
|
void testNormalProperties() throws Exception {
|
||||||
try (InputStream is = _samples.openResourceAsStream("TestMickey.doc");
|
try (InputStream is = _samples.openResourceAsStream("TestMickey.doc");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
||||||
|
@ -59,7 +59,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNormalUnicodeProperties() throws Exception {
|
void testNormalUnicodeProperties() throws Exception {
|
||||||
|
|
||||||
try (InputStream is = _samples.openResourceAsStream("TestUnicode.xls");
|
try (InputStream is = _samples.openResourceAsStream("TestUnicode.xls");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
|
@ -83,7 +83,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCustomProperties() throws Exception {
|
void testCustomProperties() throws Exception {
|
||||||
try (InputStream is = _samples.openResourceAsStream("TestMickey.doc");
|
try (InputStream is = _samples.openResourceAsStream("TestMickey.doc");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
||||||
|
@ -100,7 +100,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstructors() throws IOException {
|
void testConstructors() throws IOException {
|
||||||
final String fsText;
|
final String fsText;
|
||||||
final String hwText;
|
final String hwText;
|
||||||
final String eeText;
|
final String eeText;
|
||||||
|
@ -136,7 +136,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test42726() throws IOException {
|
void test42726() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42726.xls");
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("42726.xls");
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(wb)) {
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(wb)) {
|
||||||
String txt = ext.getText();
|
String txt = ext.getText();
|
||||||
|
@ -148,7 +148,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testThumbnail() throws Exception {
|
void testThumbnail() throws Exception {
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestThumbnail.xls"));
|
POIFSFileSystem fs = new POIFSFileSystem(_samples.openResourceAsStream("TestThumbnail.xls"));
|
||||||
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
HSSFWorkbook wb = new HSSFWorkbook(fs);
|
||||||
Thumbnail thumbnail = new Thumbnail(wb.getSummaryInformation().getThumbnail());
|
Thumbnail thumbnail = new Thumbnail(wb.getSummaryInformation().getThumbnail());
|
||||||
|
@ -159,7 +159,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test52258() throws Exception {
|
void test52258() throws Exception {
|
||||||
try (InputStream is = _samples.openResourceAsStream("TestVisioWithCodepage.vsd");
|
try (InputStream is = _samples.openResourceAsStream("TestVisioWithCodepage.vsd");
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(is);
|
POIFSFileSystem fs = new POIFSFileSystem(is);
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(fs)) {
|
||||||
|
@ -172,7 +172,7 @@ public final class TestHPSFPropertiesExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test61300Extractor() throws IOException {
|
void test61300Extractor() throws IOException {
|
||||||
try (POIFSFileSystem poifs = new POIFSFileSystem(
|
try (POIFSFileSystem poifs = new POIFSFileSystem(
|
||||||
POIDataSamples.getPOIFSInstance().getFile("61300.bin"))) {
|
POIDataSamples.getPOIFSInstance().getFile("61300.bin"))) {
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(poifs);
|
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(poifs);
|
||||||
|
|
|
@ -63,7 +63,7 @@ public abstract class BaseTestIteratingXLS {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("files")
|
@MethodSource("files")
|
||||||
public void testMain(File file) throws Exception {
|
void testMain(File file) throws Exception {
|
||||||
String fileName = file.getName();
|
String fileName = file.getName();
|
||||||
|
|
||||||
Class<? extends Throwable> t = EXCLUDED.get(fileName);
|
Class<? extends Throwable> t = EXCLUDED.get(fileName);
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class TestBiffViewer extends BaseTestIteratingXLS {
|
||||||
// @Test
|
// @Test
|
||||||
// @Disabled("only used for manual tests")
|
// @Disabled("only used for manual tests")
|
||||||
// @SuppressWarnings("java:S2699")
|
// @SuppressWarnings("java:S2699")
|
||||||
// public void testOneFile() throws Exception {
|
// void testOneFile() throws Exception {
|
||||||
// POIDataSamples samples = POIDataSamples.getSpreadSheetInstance();
|
// POIDataSamples samples = POIDataSamples.getSpreadSheetInstance();
|
||||||
// runOneFile(samples.getFile("43493.xls"));
|
// runOneFile(samples.getFile("43493.xls"));
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class TestEFBiffViewer extends BaseTestIteratingXLS {
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testFile() throws IOException {
|
void testFile() throws IOException {
|
||||||
EFBiffViewer viewer = new EFBiffViewer();
|
EFBiffViewer viewer = new EFBiffViewer();
|
||||||
viewer.setFile(new File("test-data/spreadsheet/59074.xls").getAbsolutePath());
|
viewer.setFile(new File("test-data/spreadsheet/59074.xls").getAbsolutePath());
|
||||||
viewer.run();
|
viewer.run();
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class TestReSave extends BaseTestIteratingXLS {
|
||||||
|
|
||||||
@Disabled("Only used for local testing")
|
@Disabled("Only used for local testing")
|
||||||
@Test
|
@Test
|
||||||
public void testOneFile() throws Exception {
|
void testOneFile() throws Exception {
|
||||||
String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY);
|
String dataDirName = System.getProperty(POIDataSamples.TEST_PROPERTY);
|
||||||
if(dataDirName == null) {
|
if(dataDirName == null) {
|
||||||
dataDirName = "test-data";
|
dataDirName = "test-data";
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class TestRecordLister extends BaseTestIteratingXLS {
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Test
|
//@Test
|
||||||
public void testFile() throws IOException {
|
void testFile() throws IOException {
|
||||||
RecordLister viewer = new RecordLister();
|
RecordLister viewer = new RecordLister();
|
||||||
viewer.setFile(new File("test-data/spreadsheet/testEXCEL_95.xls").getAbsolutePath());
|
viewer.setFile(new File("test-data/spreadsheet/testEXCEL_95.xls").getAbsolutePath());
|
||||||
viewer.run();
|
viewer.run();
|
||||||
|
|
|
@ -45,7 +45,7 @@ public final class TestAbortableListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAbortingBasics() throws Exception {
|
void testAbortingBasics() throws Exception {
|
||||||
AbortableCountingListener l = new AbortableCountingListener(1000);
|
AbortableCountingListener l = new AbortableCountingListener(1000);
|
||||||
|
|
||||||
HSSFRequest req = new HSSFRequest();
|
HSSFRequest req = new HSSFRequest();
|
||||||
|
@ -65,7 +65,7 @@ public final class TestAbortableListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAbortStops() throws Exception {
|
void testAbortStops() throws Exception {
|
||||||
AbortableCountingListener l = new AbortableCountingListener(1);
|
AbortableCountingListener l = new AbortableCountingListener(1);
|
||||||
|
|
||||||
HSSFRequest req = new HSSFRequest();
|
HSSFRequest req = new HSSFRequest();
|
||||||
|
|
|
@ -60,7 +60,7 @@ public final class TestEventRecordFactory {
|
||||||
* tests that the records can be processed and properly return values.
|
* tests that the records can be processed and properly return values.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testProcessRecords() {
|
void testProcessRecords() {
|
||||||
final boolean[] wascalled = { false }; // hack to pass boolean by ref into inner class
|
final boolean[] wascalled = { false }; // hack to pass boolean by ref into inner class
|
||||||
|
|
||||||
ERFListener listener = rec -> {
|
ERFListener listener = rec -> {
|
||||||
|
@ -94,7 +94,7 @@ public final class TestEventRecordFactory {
|
||||||
* constructed record in the simple case.
|
* constructed record in the simple case.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateRecord() {
|
void testCreateRecord() {
|
||||||
BOFRecord bof = new BOFRecord();
|
BOFRecord bof = new BOFRecord();
|
||||||
bof.setBuild((short)0);
|
bof.setBuild((short)0);
|
||||||
bof.setBuildYear((short)1999);
|
bof.setBuildYear((short)1999);
|
||||||
|
@ -122,7 +122,7 @@ public final class TestEventRecordFactory {
|
||||||
// @NotImplemented
|
// @NotImplemented
|
||||||
// @Test
|
// @Test
|
||||||
// @Disabled
|
// @Disabled
|
||||||
// public void testCreateContinuedRecord() {
|
// void testCreateContinuedRecord() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public final class TestEventRecordFactory {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testContinuedUnknownRecord() throws IOException {
|
void testContinuedUnknownRecord() throws IOException {
|
||||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||||
for (byte[] b : CONTINUE_DATA) {
|
for (byte[] b : CONTINUE_DATA) {
|
||||||
bos.write(b);
|
bos.write(b);
|
||||||
|
|
|
@ -67,20 +67,20 @@ public final class TestEventWorkbookBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasics() {
|
void testBasics() {
|
||||||
assertNotNull(listener.getSSTRecord());
|
assertNotNull(listener.getSSTRecord());
|
||||||
assertNotNull(listener.getBoundSheetRecords());
|
assertNotNull(listener.getBoundSheetRecords());
|
||||||
assertNotNull(listener.getExternSheetRecords());
|
assertNotNull(listener.getExternSheetRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetStubWorkbooks() {
|
void testGetStubWorkbooks() {
|
||||||
assertNotNull(listener.getStubWorkbook());
|
assertNotNull(listener.getStubWorkbook());
|
||||||
assertNotNull(listener.getStubHSSFWorkbook());
|
assertNotNull(listener.getStubHSSFWorkbook());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContents() {
|
void testContents() {
|
||||||
assertEquals(2, listener.getSSTRecord().getNumStrings());
|
assertEquals(2, listener.getSSTRecord().getNumStrings());
|
||||||
assertEquals(3, listener.getBoundSheetRecords().length);
|
assertEquals(3, listener.getBoundSheetRecords().length);
|
||||||
assertEquals(1, listener.getExternSheetRecords().length);
|
assertEquals(1, listener.getExternSheetRecords().length);
|
||||||
|
@ -94,7 +94,7 @@ public final class TestEventWorkbookBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulas() {
|
void testFormulas() {
|
||||||
|
|
||||||
// Check our formula records
|
// Check our formula records
|
||||||
assertEquals(6, fRecs.size());
|
assertEquals(6, fRecs.size());
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class TestFormatTrackingHSSFListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormats() throws Exception {
|
void testFormats() throws Exception {
|
||||||
processFile("MissingBits.xls");
|
processFile("MissingBits.xls");
|
||||||
|
|
||||||
assertEquals("_(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_)", listener.getFormatString(41));
|
assertEquals("_(* #,##0_);_(* (#,##0);_(* \"-\"_);_(@_)", listener.getFormatString(41));
|
||||||
|
@ -69,7 +69,7 @@ public final class TestFormatTrackingHSSFListener {
|
||||||
* want to check the exact strings!
|
* want to check the exact strings!
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTurnToString() throws Exception {
|
void testTurnToString() throws Exception {
|
||||||
String[] files = new String[] {
|
String[] files = new String[] {
|
||||||
"45365.xls", "45365-2.xls", "MissingBits.xls"
|
"45365.xls", "45365-2.xls", "MissingBits.xls"
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ public final class TestHSSFEventFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithMissingRecords() throws Exception {
|
void testWithMissingRecords() throws Exception {
|
||||||
|
|
||||||
openSample("SimpleWithSkip.xls");
|
openSample("SimpleWithSkip.xls");
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public final class TestHSSFEventFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithCrazyContinueRecords() throws Exception {
|
void testWithCrazyContinueRecords() throws Exception {
|
||||||
// Some files have crazy ordering of their continue records
|
// Some files have crazy ordering of their continue records
|
||||||
// Check that we don't break on them (bug #42844)
|
// Check that we don't break on them (bug #42844)
|
||||||
|
|
||||||
|
@ -105,26 +105,26 @@ public final class TestHSSFEventFactory {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("java:S2699")
|
@SuppressWarnings("java:S2699")
|
||||||
public void testUnknownContinueRecords() throws Exception {
|
void testUnknownContinueRecords() throws Exception {
|
||||||
openSample("42844.xls");
|
openSample("42844.xls");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("java:S2699")
|
@SuppressWarnings("java:S2699")
|
||||||
public void testWithDifferentWorkbookName() throws Exception {
|
void testWithDifferentWorkbookName() throws Exception {
|
||||||
openSample("BOOK_in_capitals.xls");
|
openSample("BOOK_in_capitals.xls");
|
||||||
openSample("WORKBOOK_in_capitals.xls");
|
openSample("WORKBOOK_in_capitals.xls");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@SuppressWarnings("java:S2699")
|
@SuppressWarnings("java:S2699")
|
||||||
public void testWithPasswordProtectedWorkbooksNoPass() {
|
void testWithPasswordProtectedWorkbooksNoPass() {
|
||||||
// Without a password, can't be read
|
// Without a password, can't be read
|
||||||
assertThrows(EncryptedDocumentException.class, () -> openSample("xor-encryption-abc.xls"));
|
assertThrows(EncryptedDocumentException.class, () -> openSample("xor-encryption-abc.xls"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithPasswordProtectedWorkbooks() throws Exception {
|
void testWithPasswordProtectedWorkbooks() throws Exception {
|
||||||
// With the password, is properly processed
|
// With the password, is properly processed
|
||||||
Biff8EncryptionKey.setCurrentUserPassword("abc");
|
Biff8EncryptionKey.setCurrentUserPassword("abc");
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -64,7 +64,7 @@ public final class TestMissingRecordAwareHSSFListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingRowRecords() throws IOException {
|
void testMissingRowRecords() throws IOException {
|
||||||
readRecords("MissingBits.xls");
|
readRecords("MissingBits.xls");
|
||||||
|
|
||||||
// We have rows 0, 1, 2, 20 and 21
|
// We have rows 0, 1, 2, 20 and 21
|
||||||
|
@ -96,7 +96,7 @@ public final class TestMissingRecordAwareHSSFListener {
|
||||||
|
|
||||||
// Make sure we don't put in any extra new lines that aren't already there
|
// Make sure we don't put in any extra new lines that aren't already there
|
||||||
@Test
|
@Test
|
||||||
public void testNoExtraNewLines() throws IOException {
|
void testNoExtraNewLines() throws IOException {
|
||||||
// Load a different file
|
// Load a different file
|
||||||
// This file has has something in lines 1-33
|
// This file has has something in lines 1-33
|
||||||
readRecords("MRExtraLines.xls");
|
readRecords("MRExtraLines.xls");
|
||||||
|
@ -117,7 +117,7 @@ public final class TestMissingRecordAwareHSSFListener {
|
||||||
* Make sure that the presence of shared formulas does not cause extra end-of-row records.
|
* Make sure that the presence of shared formulas does not cause extra end-of-row records.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEndOfRow_bug45672() throws IOException {
|
void testEndOfRow_bug45672() throws IOException {
|
||||||
readRecords("ex45672.xls");
|
readRecords("ex45672.xls");
|
||||||
assertEquals(1, matches(r -> r instanceof SharedFormulaRecord));
|
assertEquals(1, matches(r -> r instanceof SharedFormulaRecord));
|
||||||
assertEquals(1, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
assertEquals(1, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
||||||
|
@ -128,7 +128,7 @@ public final class TestMissingRecordAwareHSSFListener {
|
||||||
* Check that we don't have any MulBlankRecords, but do have lots of BlankRecords
|
* Check that we don't have any MulBlankRecords, but do have lots of BlankRecords
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMulBlankHandling() throws IOException {
|
void testMulBlankHandling() throws IOException {
|
||||||
readRecords("45672.xls");
|
readRecords("45672.xls");
|
||||||
assertEquals(20, matches(r -> r instanceof BlankRecord));
|
assertEquals(20, matches(r -> r instanceof BlankRecord));
|
||||||
assertEquals(2, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
assertEquals(2, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
||||||
|
@ -136,14 +136,14 @@ public final class TestMissingRecordAwareHSSFListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringRecordHandling() throws IOException {
|
void testStringRecordHandling() throws IOException {
|
||||||
readRecords("53588.xls");
|
readRecords("53588.xls");
|
||||||
assertEquals(1, matches(r -> r instanceof MissingCellDummyRecord));
|
assertEquals(1, matches(r -> r instanceof MissingCellDummyRecord));
|
||||||
assertEquals(1, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
assertEquals(1, matches(r -> r instanceof LastCellOfRowDummyRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulasWithStringResultsHandling() throws IOException {
|
void testFormulasWithStringResultsHandling() throws IOException {
|
||||||
readRecords("53433.xls");
|
readRecords("53433.xls");
|
||||||
|
|
||||||
String exp =
|
String exp =
|
||||||
|
|
|
@ -47,7 +47,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimple() throws IOException {
|
void testSimple() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("Simple.xls")) {
|
try (ExcelExtractor extractor = createExtractor("Simple.xls")) {
|
||||||
assertEquals("Sheet1\nreplaceMe\nSheet2\nSheet3\n", extractor.getText());
|
assertEquals("Sheet1\nreplaceMe\nSheet2\nSheet3\n", extractor.getText());
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNumericFormula() throws IOException {
|
void testNumericFormula() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("sumifformula.xls")) {
|
try (ExcelExtractor extractor = createExtractor("sumifformula.xls")) {
|
||||||
assertEquals(
|
assertEquals(
|
||||||
"Sheet1\n" +
|
"Sheet1\n" +
|
||||||
|
@ -87,7 +87,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithContinueRecords() throws IOException {
|
void testWithContinueRecords() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("StringContinueRecords.xls")) {
|
try (ExcelExtractor extractor = createExtractor("StringContinueRecords.xls")) {
|
||||||
// Has masses of text
|
// Has masses of text
|
||||||
// Until we fixed bug #41064, this would've
|
// Until we fixed bug #41064, this would've
|
||||||
|
@ -97,7 +97,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringConcat() throws IOException {
|
void testStringConcat() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("SimpleWithFormula.xls")) {
|
try (ExcelExtractor extractor = createExtractor("SimpleWithFormula.xls")) {
|
||||||
// Comes out as NaN if treated as a number
|
// Comes out as NaN if treated as a number
|
||||||
// And as XYZ if treated as a string
|
// And as XYZ if treated as a string
|
||||||
|
@ -110,7 +110,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStringFormula() throws IOException {
|
void testStringFormula() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("StringFormulas.xls")) {
|
try (ExcelExtractor extractor = createExtractor("StringFormulas.xls")) {
|
||||||
// Comes out as NaN if treated as a number
|
// Comes out as NaN if treated as a number
|
||||||
// And as XYZ if treated as a string
|
// And as XYZ if treated as a string
|
||||||
|
@ -124,7 +124,7 @@ public final class TestExcelExtractor {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEventExtractor() throws Exception {
|
void testEventExtractor() throws Exception {
|
||||||
// First up, a simple file with string
|
// First up, a simple file with string
|
||||||
// based formulas in it
|
// based formulas in it
|
||||||
try (EventBasedExcelExtractor extractor1 = new EventBasedExcelExtractor(
|
try (EventBasedExcelExtractor extractor1 = new EventBasedExcelExtractor(
|
||||||
|
@ -167,7 +167,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithComments() throws IOException {
|
void testWithComments() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("SimpleWithComments.xls")) {
|
try (ExcelExtractor extractor = createExtractor("SimpleWithComments.xls")) {
|
||||||
extractor.setIncludeSheetNames(false);
|
extractor.setIncludeSheetNames(false);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithBlank() throws IOException {
|
void testWithBlank() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("MissingBits.xls")) {
|
try (ExcelExtractor extractor = createExtractor("MissingBits.xls")) {
|
||||||
String def = extractor.getText();
|
String def = extractor.getText();
|
||||||
extractor.setIncludeBlankCells(true);
|
extractor.setIncludeBlankCells(true);
|
||||||
|
@ -214,7 +214,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormatting() throws Exception {
|
void testFormatting() throws Exception {
|
||||||
Locale userLocale = LocaleUtil.getUserLocale();
|
Locale userLocale = LocaleUtil.getUserLocale();
|
||||||
LocaleUtil.setUserLocale(Locale.ROOT);
|
LocaleUtil.setUserLocale(Locale.ROOT);
|
||||||
try (ExcelExtractor extractor = createExtractor("Formatting.xls")) {
|
try (ExcelExtractor extractor = createExtractor("Formatting.xls")) {
|
||||||
|
@ -243,7 +243,7 @@ public final class TestExcelExtractor {
|
||||||
* Embeded in a non-excel file
|
* Embeded in a non-excel file
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWithEmbeded() throws Exception {
|
void testWithEmbeded() throws Exception {
|
||||||
POIFSFileSystem fs = null;
|
POIFSFileSystem fs = null;
|
||||||
|
|
||||||
HSSFWorkbook wbA = null, wbB = null;
|
HSSFWorkbook wbA = null, wbB = null;
|
||||||
|
@ -278,7 +278,7 @@ public final class TestExcelExtractor {
|
||||||
* Excel embeded in excel
|
* Excel embeded in excel
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testWithEmbededInOwn() throws Exception {
|
void testWithEmbededInOwn() throws Exception {
|
||||||
POIDataSamples ssSamples = POIDataSamples.getSpreadSheetInstance();
|
POIDataSamples ssSamples = POIDataSamples.getSpreadSheetInstance();
|
||||||
POIFSFileSystem fs = null;
|
POIFSFileSystem fs = null;
|
||||||
HSSFWorkbook wbA = null, wbB = null;
|
HSSFWorkbook wbA = null, wbB = null;
|
||||||
|
@ -319,7 +319,7 @@ public final class TestExcelExtractor {
|
||||||
* Test that we get text from headers and footers
|
* Test that we get text from headers and footers
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test45538() throws IOException {
|
void test45538() throws IOException {
|
||||||
String[] files = {
|
String[] files = {
|
||||||
"45538_classic_Footer.xls", "45538_form_Footer.xls",
|
"45538_classic_Footer.xls", "45538_form_Footer.xls",
|
||||||
"45538_classic_Header.xls", "45538_form_Header.xls"
|
"45538_classic_Header.xls", "45538_form_Header.xls"
|
||||||
|
@ -334,7 +334,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPassword() throws IOException {
|
void testPassword() throws IOException {
|
||||||
Biff8EncryptionKey.setCurrentUserPassword("password");
|
Biff8EncryptionKey.setCurrentUserPassword("password");
|
||||||
try (ExcelExtractor extractor = createExtractor("password.xls")) {
|
try (ExcelExtractor extractor = createExtractor("password.xls")) {
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
|
@ -346,7 +346,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullPointerException() throws IOException {
|
void testNullPointerException() throws IOException {
|
||||||
try (ExcelExtractor extractor = createExtractor("ar.org.apsme.www_Form%20Inscripcion%20Curso%20NO%20Socios.xls")) {
|
try (ExcelExtractor extractor = createExtractor("ar.org.apsme.www_Form%20Inscripcion%20Curso%20NO%20Socios.xls")) {
|
||||||
assertNotNull(extractor);
|
assertNotNull(extractor);
|
||||||
assertNotNull(extractor.getText());
|
assertNotNull(extractor.getText());
|
||||||
|
@ -354,7 +354,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test61045() throws IOException {
|
void test61045() throws IOException {
|
||||||
//bug 61045. File is govdocs1 626534
|
//bug 61045. File is govdocs1 626534
|
||||||
try (ExcelExtractor extractor = createExtractor("61045_govdocs1_626534.xls")) {
|
try (ExcelExtractor extractor = createExtractor("61045_govdocs1_626534.xls")) {
|
||||||
String txt = extractor.getText();
|
String txt = extractor.getText();
|
||||||
|
@ -363,7 +363,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test60405a() throws IOException {
|
void test60405a() throws IOException {
|
||||||
//bug 61045. File is govdocs1 626534
|
//bug 61045. File is govdocs1 626534
|
||||||
try (ExcelExtractor extractor = createExtractor("60405.xls")) {
|
try (ExcelExtractor extractor = createExtractor("60405.xls")) {
|
||||||
String txt = extractor.getText();
|
String txt = extractor.getText();
|
||||||
|
@ -373,7 +373,7 @@ public final class TestExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test60405b() throws IOException {
|
void test60405b() throws IOException {
|
||||||
//bug 61045. File is govdocs1 626534
|
//bug 61045. File is govdocs1 626534
|
||||||
try (ExcelExtractor extractor = createExtractor("60405.xls")) {
|
try (ExcelExtractor extractor = createExtractor("60405.xls")) {
|
||||||
extractor.setFormulasNotResults(true);
|
extractor.setFormulasNotResults(true);
|
||||||
|
|
|
@ -53,7 +53,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleExcel3() throws IOException {
|
void testSimpleExcel3() throws IOException {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
||||||
|
|
||||||
// Check we can call getText without error
|
// Check we can call getText without error
|
||||||
|
@ -79,14 +79,14 @@ public final class TestOldExcelExtractor {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleExcel3NoReading() throws IOException {
|
void testSimpleExcel3NoReading() throws IOException {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_3.xls")) {
|
||||||
assertNotNull(extractor);
|
assertNotNull(extractor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleExcel4() throws IOException {
|
void testSimpleExcel4() throws IOException {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||||
|
|
||||||
// Check we can call getText without error
|
// Check we can call getText without error
|
||||||
|
@ -108,7 +108,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleExcel5() throws IOException {
|
void testSimpleExcel5() throws IOException {
|
||||||
for (String ver : new String[] {"5", "95"}) {
|
for (String ver : new String[] {"5", "95"}) {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStrings() throws IOException {
|
void testStrings() throws IOException {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormattedNumbersExcel4() throws IOException {
|
void testFormattedNumbersExcel4() throws IOException {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_4.xls")) {
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormattedNumbersExcel5() throws IOException {
|
void testFormattedNumbersExcel5() throws IOException {
|
||||||
for (String ver : new String[] {"5", "95"}) {
|
for (String ver : new String[] {"5", "95"}) {
|
||||||
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
try (OldExcelExtractor extractor = createExtractor("testEXCEL_"+ver+".xls")) {
|
||||||
String text = extractor.getText();
|
String text = extractor.getText();
|
||||||
|
@ -201,7 +201,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFromFile() throws IOException {
|
void testFromFile() throws IOException {
|
||||||
for (String ver : new String[] {"4", "5", "95"}) {
|
for (String ver : new String[] {"4", "5", "95"}) {
|
||||||
String filename = "testEXCEL_"+ver+".xls";
|
String filename = "testEXCEL_"+ver+".xls";
|
||||||
File f = HSSFTestDataSamples.getSampleFile(filename);
|
File f = HSSFTestDataSamples.getSampleFile(filename);
|
||||||
|
@ -215,7 +215,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFromInputStream() throws IOException {
|
void testFromInputStream() throws IOException {
|
||||||
for (String ver : new String[] {"4", "5", "95"}) {
|
for (String ver : new String[] {"4", "5", "95"}) {
|
||||||
String filename = "testEXCEL_"+ver+".xls";
|
String filename = "testEXCEL_"+ver+".xls";
|
||||||
File f = HSSFTestDataSamples.getSampleFile(filename);
|
File f = HSSFTestDataSamples.getSampleFile(filename);
|
||||||
|
@ -230,7 +230,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOpenInvalidFile1() throws IOException {
|
void testOpenInvalidFile1() throws IOException {
|
||||||
// a file that exists, but is a different format
|
// a file that exists, but is a different format
|
||||||
assertThrows(OfficeXmlFileException.class, () -> createExtractor("WithVariousData.xlsx").close());
|
assertThrows(OfficeXmlFileException.class, () -> createExtractor("WithVariousData.xlsx").close());
|
||||||
|
|
||||||
|
@ -244,13 +244,13 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOpenNonExistingFile() {
|
void testOpenNonExistingFile() {
|
||||||
// a file that exists, but is a different format
|
// a file that exists, but is a different format
|
||||||
assertThrows(EmptyFileException.class, () -> new OldExcelExtractor(new File("notexistingfile.xls")).close());
|
assertThrows(EmptyFileException.class, () -> new OldExcelExtractor(new File("notexistingfile.xls")).close());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInputStream() throws IOException {
|
void testInputStream() throws IOException {
|
||||||
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
|
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
|
||||||
try (InputStream stream = new FileInputStream(file);
|
try (InputStream stream = new FileInputStream(file);
|
||||||
OldExcelExtractor extractor = new OldExcelExtractor(stream)) {
|
OldExcelExtractor extractor = new OldExcelExtractor(stream)) {
|
||||||
|
@ -260,7 +260,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInputStreamNPOIHeader() throws IOException {
|
void testInputStreamNPOIHeader() throws IOException {
|
||||||
//TODO: the worksheet names are currently mangled. They're treated
|
//TODO: the worksheet names are currently mangled. They're treated
|
||||||
//as if UTF-16, but they're just ascii. Need to fix this.
|
//as if UTF-16, but they're just ascii. Need to fix this.
|
||||||
//Is it possible that the leading 0 byte in the worksheet name is a signal
|
//Is it possible that the leading 0 byte in the worksheet name is a signal
|
||||||
|
@ -274,7 +274,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPOIFSFileSystem() throws IOException {
|
void testPOIFSFileSystem() throws IOException {
|
||||||
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
||||||
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
||||||
OldExcelExtractor extractor = new OldExcelExtractor(fs)){
|
OldExcelExtractor extractor = new OldExcelExtractor(fs)){
|
||||||
|
@ -284,7 +284,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDirectoryNode() throws IOException {
|
void testDirectoryNode() throws IOException {
|
||||||
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
File file = HSSFTestDataSamples.getSampleFile("FormulaRefs.xls");
|
||||||
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
try (POIFSFileSystem fs = new POIFSFileSystem(file);
|
||||||
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot())) {
|
OldExcelExtractor extractor = new OldExcelExtractor(fs.getRoot())) {
|
||||||
|
@ -294,7 +294,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDirectoryNodeInvalidFile() throws IOException {
|
void testDirectoryNodeInvalidFile() throws IOException {
|
||||||
File file = POIDataSamples.getDocumentInstance().getFile("test.doc");
|
File file = POIDataSamples.getDocumentInstance().getFile("test.doc");
|
||||||
try (POIFSFileSystem fs = new POIFSFileSystem(file)) {
|
try (POIFSFileSystem fs = new POIFSFileSystem(file)) {
|
||||||
assertThrows(FileNotFoundException.class, () -> new OldExcelExtractor(fs.getRoot()));
|
assertThrows(FileNotFoundException.class, () -> new OldExcelExtractor(fs.getRoot()));
|
||||||
|
@ -302,7 +302,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMainUsage() {
|
void testMainUsage() {
|
||||||
PrintStream save = System.err;
|
PrintStream save = System.err;
|
||||||
SecurityManager sm = System.getSecurityManager();
|
SecurityManager sm = System.getSecurityManager();
|
||||||
System.setSecurityManager(new NoExitSecurityManager());
|
System.setSecurityManager(new NoExitSecurityManager());
|
||||||
|
@ -317,7 +317,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMain() throws IOException {
|
void testMain() throws IOException {
|
||||||
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
|
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
|
||||||
PrintStream save = System.out;
|
PrintStream save = System.out;
|
||||||
try {
|
try {
|
||||||
|
@ -333,7 +333,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncryptionException() throws IOException {
|
void testEncryptionException() throws IOException {
|
||||||
//test file derives from Common Crawl
|
//test file derives from Common Crawl
|
||||||
File file = HSSFTestDataSamples.getSampleFile("60284.xls");
|
File file = HSSFTestDataSamples.getSampleFile("60284.xls");
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ public final class TestOldExcelExtractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSheetWithNoName() throws IOException {
|
void testSheetWithNoName() throws IOException {
|
||||||
File file = HSSFTestDataSamples.getSampleFile("64130.xls");
|
File file = HSSFTestDataSamples.getSampleFile("64130.xls");
|
||||||
|
|
||||||
try (OldExcelExtractor ex = new OldExcelExtractor(file)) {
|
try (OldExcelExtractor ex = new OldExcelExtractor(file)) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class TestDrawingAggregate {
|
||||||
*/
|
*/
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("samples")
|
@MethodSource("samples")
|
||||||
public void testAllTestSamples(File file) throws IOException {
|
void testAllTestSamples(File file) throws IOException {
|
||||||
boolean ignoreParse = true;
|
boolean ignoreParse = true;
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook(file.getName())) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook(file.getName())) {
|
||||||
ignoreParse = false;
|
ignoreParse = false;
|
||||||
|
@ -196,7 +196,7 @@ public class TestDrawingAggregate {
|
||||||
* when reading incomplete data ensure that the serialized bytes match the source
|
* when reading incomplete data ensure that the serialized bytes match the source
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIncompleteData() throws IOException {
|
void testIncompleteData() throws IOException {
|
||||||
//EscherDgContainer and EscherSpgrContainer length exceeds the actual length of the data
|
//EscherDgContainer and EscherSpgrContainer length exceeds the actual length of the data
|
||||||
String data =
|
String data =
|
||||||
"H4sIAAAAAAAAAGWOOw7CQAxE32YTsSRIWSgQJSUloqSm5g4ICURBg+iBK3APGi6wBWeh9xGYbEps2WON"+
|
"H4sIAAAAAAAAAGWOOw7CQAxE32YTsSRIWSgQJSUloqSm5g4ICURBg+iBK3APGi6wBWeh9xGYbEps2WON"+
|
||||||
|
@ -227,7 +227,7 @@ public class TestDrawingAggregate {
|
||||||
* TODO: figure out why it fails with "RecordFormatException: 0 bytes written but getRecordSize() reports 80"
|
* TODO: figure out why it fails with "RecordFormatException: 0 bytes written but getRecordSize() reports 80"
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFailing() throws IOException {
|
void testFailing() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("15573.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("15573.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
HSSFPatriarch dp = sh.getDrawingPatriarch();
|
HSSFPatriarch dp = sh.getDrawingPatriarch();
|
||||||
|
@ -255,7 +255,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSolverContainerMustBeSavedDuringSerialization() throws IOException{
|
void testSolverContainerMustBeSavedDuringSerialization() throws IOException{
|
||||||
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SolverContainerAfterSPGR.xls")) {
|
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("SolverContainerAfterSPGR.xls")) {
|
||||||
HSSFSheet sh = wb1.getSheetAt(0);
|
HSSFSheet sh = wb1.getSheetAt(0);
|
||||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||||
|
@ -289,7 +289,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFileWithTextbox() throws IOException{
|
void testFileWithTextbox() throws IOException{
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("text.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("text.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||||
|
@ -309,7 +309,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFileWithCharts() throws IOException {
|
void testFileWithCharts() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("49581.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||||
|
@ -337,7 +337,7 @@ public class TestDrawingAggregate {
|
||||||
* test reading drawing aggregate from a test file from Bugzilla 45129
|
* test reading drawing aggregate from a test file from Bugzilla 45129
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test45129() throws IOException {
|
void test45129() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45129.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("45129.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
|
|
||||||
|
@ -401,7 +401,7 @@ public class TestDrawingAggregate {
|
||||||
* ...
|
* ...
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSerializeDrawingBigger8k() throws IOException {
|
void testSerializeDrawingBigger8k() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
||||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
|
@ -458,7 +458,7 @@ public class TestDrawingAggregate {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerializeDrawingBigger8k_noAggregation() throws IOException {
|
void testSerializeDrawingBigger8k_noAggregation() throws IOException {
|
||||||
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("DrawingContinue.xls")) {
|
||||||
InternalSheet isheet = HSSFTestHelper.getSheetForTest(wb1.getSheetAt(0));
|
InternalSheet isheet = HSSFTestHelper.getSheetForTest(wb1.getSheetAt(0));
|
||||||
List<RecordBase> records = isheet.getRecords();
|
List<RecordBase> records = isheet.getRecords();
|
||||||
|
@ -483,7 +483,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerializeDrawingWithComments() throws IOException {
|
void testSerializeDrawingWithComments() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingAndComments.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("DrawingAndComments.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
InternalWorkbook iworkbook = HSSFTestHelper.getWorkbookForTest(wb);
|
||||||
|
@ -539,7 +539,7 @@ public class TestDrawingAggregate {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFileWithPictures() throws IOException {
|
void testFileWithPictures() throws IOException {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ContinueRecordProblem.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ContinueRecordProblem.xls")) {
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
|
|
||||||
|
@ -594,7 +594,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnhandledContinue() throws IOException {
|
void testUnhandledContinue() throws IOException {
|
||||||
String data =
|
String data =
|
||||||
"H4sIAAAAAAAAAO3adVRU2/4A8EPHAEOnlEooNaSUdCNIg4CUDCEtQ6gwlITSjYiSkoKA0ikg0i1IyCjS"+
|
"H4sIAAAAAAAAAO3adVRU2/4A8EPHAEOnlEooNaSUdCNIg4CUDCEtQ6gwlITSjYiSkoKA0ikg0i1IyCjS"+
|
||||||
"QwpSEr8B73v3PS6+9+67vz/eH+615pyz9tn71PqevT/rfGcJOIcLBtDXrNgAgBjAXcMFAAAb9SPDBAAw"+
|
"QwpSEr8B73v3PS6+9+67vz/eH+615pyz9tn71PqevT/rfGcJOIcLBtDXrNgAgBjAXcMFAAAb9SPDBAAw"+
|
||||||
|
@ -737,7 +737,7 @@ public class TestDrawingAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnhandledContinue2() throws IOException {
|
void testUnhandledContinue2() throws IOException {
|
||||||
String data =
|
String data =
|
||||||
"H4sIAAAAAAAAAO3bdVRUW9sA8AGGrqFHSlpAhSEcQAkJ6UYQyaFBmiEFpCVEOiREGikJSekGlRJQuiQl"+
|
"H4sIAAAAAAAAAO3bdVRUW9sA8AGGrqFHSlpAhSEcQAkJ6UYQyaFBmiEFpCVEOiREGikJSekGlRJQuiQl"+
|
||||||
"FQFB4ptBvxvIvd+97/fete4f7rWYc9aZc4aZw7P3/s3zbFYB/FiEANTNeD4AAATA2sQCAADIH0wgAEAI"+
|
"FQFB4ptBvxvIvd+97/fete4f7rWYc9aZc4aZw7P3/s3zbFYB/FiEANTNeD4AAATA2sQCAADIH0wgAEAI"+
|
||||||
|
|
|
@ -36,7 +36,7 @@ public final class TestDrawingManager2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDgRecord() {
|
void testCreateDgRecord() {
|
||||||
EscherDgRecord dgRecord1 = drawingManager2.createDgRecord();
|
EscherDgRecord dgRecord1 = drawingManager2.createDgRecord();
|
||||||
assertEquals( 1, dgRecord1.getDrawingGroupId() );
|
assertEquals( 1, dgRecord1.getDrawingGroupId() );
|
||||||
assertEquals( -1, dgRecord1.getLastMSOSPID() );
|
assertEquals( -1, dgRecord1.getLastMSOSPID() );
|
||||||
|
@ -52,7 +52,7 @@ public final class TestDrawingManager2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDgRecordOld() {
|
void testCreateDgRecordOld() {
|
||||||
// converted from TestDrawingManager(1)
|
// converted from TestDrawingManager(1)
|
||||||
EscherDggRecord dgg = new EscherDggRecord();
|
EscherDggRecord dgg = new EscherDggRecord();
|
||||||
dgg.setDrawingsSaved( 0 );
|
dgg.setDrawingsSaved( 0 );
|
||||||
|
@ -69,7 +69,7 @@ public final class TestDrawingManager2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllocateShapeId() {
|
void testAllocateShapeId() {
|
||||||
EscherDgRecord dgRecord1 = drawingManager2.createDgRecord();
|
EscherDgRecord dgRecord1 = drawingManager2.createDgRecord();
|
||||||
assertEquals( 1, dgg.getDrawingsSaved() );
|
assertEquals( 1, dgg.getDrawingsSaved() );
|
||||||
EscherDgRecord dgRecord2 = drawingManager2.createDgRecord();
|
EscherDgRecord dgRecord2 = drawingManager2.createDgRecord();
|
||||||
|
@ -105,7 +105,7 @@ public final class TestDrawingManager2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFindNewDrawingGroupId() {
|
void testFindNewDrawingGroupId() {
|
||||||
// converted from TestDrawingManager(1)
|
// converted from TestDrawingManager(1)
|
||||||
EscherDggRecord dgg = new EscherDggRecord();
|
EscherDggRecord dgg = new EscherDggRecord();
|
||||||
dgg.setDrawingsSaved( 1 );
|
dgg.setDrawingsSaved( 1 );
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class TestDrawingShapes {
|
||||||
* ----shape
|
* ----shape
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDrawingGroups() throws IOException {
|
void testDrawingGroups() throws IOException {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
||||||
HSSFSheet sheet = wb.getSheet("groups");
|
HSSFSheet sheet = wb.getSheet("groups");
|
||||||
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
|
||||||
|
@ -99,7 +99,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHSSFShapeCompatibility() {
|
void testHSSFShapeCompatibility() {
|
||||||
HSSFSimpleShape shape = new HSSFSimpleShape(null, new HSSFClientAnchor());
|
HSSFSimpleShape shape = new HSSFSimpleShape(null, new HSSFClientAnchor());
|
||||||
shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
|
shape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
|
||||||
assertEquals(0x08000040, shape.getLineStyleColor());
|
assertEquals(0x08000040, shape.getLineStyleColor());
|
||||||
|
@ -118,7 +118,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultPictureSettings() {
|
void testDefaultPictureSettings() {
|
||||||
HSSFPicture picture = new HSSFPicture(null, new HSSFClientAnchor());
|
HSSFPicture picture = new HSSFPicture(null, new HSSFClientAnchor());
|
||||||
assertEquals(picture.getLineWidth(), HSSFShape.LINEWIDTH_DEFAULT);
|
assertEquals(picture.getLineWidth(), HSSFShape.LINEWIDTH_DEFAULT);
|
||||||
assertEquals(picture.getFillColor(), HSSFShape.FILL__FILLCOLOR_DEFAULT);
|
assertEquals(picture.getFillColor(), HSSFShape.FILL__FILLCOLOR_DEFAULT);
|
||||||
|
@ -132,7 +132,7 @@ public class TestDrawingShapes {
|
||||||
* No NullPointerException should appear
|
* No NullPointerException should appear
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultSettingsWithEmptyContainer() {
|
void testDefaultSettingsWithEmptyContainer() {
|
||||||
EscherContainerRecord container = new EscherContainerRecord();
|
EscherContainerRecord container = new EscherContainerRecord();
|
||||||
EscherOptRecord opt = new EscherOptRecord();
|
EscherOptRecord opt = new EscherOptRecord();
|
||||||
opt.setRecordId(EscherOptRecord.RECORD_ID);
|
opt.setRecordId(EscherOptRecord.RECORD_ID);
|
||||||
|
@ -155,7 +155,7 @@ public class TestDrawingShapes {
|
||||||
* create a rectangle, save the workbook, read back and verify that all shape properties are there
|
* create a rectangle, save the workbook, read back and verify that all shape properties are there
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteRectangle() throws IOException {
|
void testReadWriteRectangle() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadExistingImage() throws IOException {
|
void testReadExistingImage() throws IOException {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
||||||
HSSFSheet sheet = wb.getSheet("pictures");
|
HSSFSheet sheet = wb.getSheet("pictures");
|
||||||
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
||||||
|
@ -274,7 +274,7 @@ public class TestDrawingShapes {
|
||||||
|
|
||||||
/* assert shape properties when reading shapes from a existing workbook */
|
/* assert shape properties when reading shapes from a existing workbook */
|
||||||
@Test
|
@Test
|
||||||
public void testReadExistingRectangle() throws IOException {
|
void testReadExistingRectangle() throws IOException {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
||||||
HSSFSheet sheet = wb.getSheet("rectangles");
|
HSSFSheet sheet = wb.getSheet("rectangles");
|
||||||
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
||||||
|
@ -292,7 +292,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShapeIds() throws IOException {
|
void testShapeIds() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet1 = wb1.createSheet();
|
HSSFSheet sheet1 = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch1 = sheet1.createDrawingPatriarch();
|
HSSFPatriarch patriarch1 = sheet1.createDrawingPatriarch();
|
||||||
|
@ -339,7 +339,7 @@ public class TestDrawingShapes {
|
||||||
* File already have for 1 shape on each sheet, because document must contain EscherDgRecord for each sheet
|
* File already have for 1 shape on each sheet, because document must contain EscherDgRecord for each sheet
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAllocateNewIds() throws IOException {
|
void testAllocateNewIds() throws IOException {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("empty.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("empty.xls");
|
||||||
HSSFSheet sheet = wb.getSheetAt(0);
|
HSSFSheet sheet = wb.getSheetAt(0);
|
||||||
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.getDrawingPatriarch();
|
||||||
|
@ -370,7 +370,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOpt() throws IOException {
|
void testOpt() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
// create a sheet with a text box
|
// create a sheet with a text box
|
||||||
|
@ -385,7 +385,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCorrectOrderInOptRecord() throws IOException{
|
void testCorrectOrderInOptRecord() throws IOException{
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
@ -411,7 +411,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDgRecordNumShapes() throws IOException {
|
void testDgRecordNumShapes() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -423,7 +423,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTextForSimpleShape() throws IOException {
|
void testTextForSimpleShape() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -468,7 +468,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveShapes() throws IOException {
|
void testRemoveShapes() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -618,7 +618,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShapeFlip() throws IOException {
|
void testShapeFlip() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -662,7 +662,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRotation() throws IOException {
|
void testRotation() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -691,7 +691,7 @@ public class TestDrawingShapes {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Test
|
@Test
|
||||||
public void testShapeContainerImplementsIterable() throws IOException {
|
void testShapeContainerImplementsIterable() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
@ -710,7 +710,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClearShapesForPatriarch() throws IOException {
|
void testClearShapesForPatriarch() throws IOException {
|
||||||
HSSFWorkbook wb1 = new HSSFWorkbook();
|
HSSFWorkbook wb1 = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb1.createSheet();
|
HSSFSheet sheet = wb1.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
@ -743,7 +743,7 @@ public class TestDrawingShapes {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug45312() throws Exception {
|
void testBug45312() throws Exception {
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
|
||||||
|
|
|
@ -56,7 +56,7 @@ public class TestEscherRecordFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDetectContainer() {
|
void testDetectContainer() {
|
||||||
Random rnd = new Random();
|
Random rnd = new Random();
|
||||||
assertTrue(isContainer((short) 0x0, EscherContainerRecord.DG_CONTAINER));
|
assertTrue(isContainer((short) 0x0, EscherContainerRecord.DG_CONTAINER));
|
||||||
assertTrue(isContainer((short) 0x0, EscherContainerRecord.SOLVER_CONTAINER));
|
assertTrue(isContainer((short) 0x0, EscherContainerRecord.SOLVER_CONTAINER));
|
||||||
|
@ -81,7 +81,7 @@ public class TestEscherRecordFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDgContainerMustBeRootOfHSSFSheetEscherRecords() {
|
void testDgContainerMustBeRootOfHSSFSheetEscherRecords() {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("47251.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("47251.xls");
|
||||||
HSSFSheet sh = wb.getSheetAt(0);
|
HSSFSheet sh = wb.getSheetAt(0);
|
||||||
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
|
||||||
|
|
|
@ -72,35 +72,35 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleFormula() {
|
void testSimpleFormula() {
|
||||||
confirmTokenClasses("2+2",IntPtg.class, IntPtg.class, AddPtg.class);
|
confirmTokenClasses("2+2",IntPtg.class, IntPtg.class, AddPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaWithSpace1() {
|
void testFormulaWithSpace1() {
|
||||||
confirmTokenClasses(" 2 + 2 ",IntPtg.class, IntPtg.class, AddPtg.class);
|
confirmTokenClasses(" 2 + 2 ",IntPtg.class, IntPtg.class, AddPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaWithSpace2() {
|
void testFormulaWithSpace2() {
|
||||||
Ptg[] ptgs = parseFormula("2+ sum( 3 , 4) ");
|
Ptg[] ptgs = parseFormula("2+ sum( 3 , 4) ");
|
||||||
assertEquals(5, ptgs.length);
|
assertEquals(5, ptgs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaWithSpaceNRef() {
|
void testFormulaWithSpaceNRef() {
|
||||||
Ptg[] ptgs = parseFormula("sum( A2:A3 )");
|
Ptg[] ptgs = parseFormula("sum( A2:A3 )");
|
||||||
assertEquals(2, ptgs.length);
|
assertEquals(2, ptgs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaWithString() {
|
void testFormulaWithString() {
|
||||||
Ptg[] ptgs = parseFormula("\"hello\" & \"world\" ");
|
Ptg[] ptgs = parseFormula("\"hello\" & \"world\" ");
|
||||||
assertEquals(3, ptgs.length);
|
assertEquals(3, ptgs.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTRUE() {
|
void testTRUE() {
|
||||||
Ptg[] ptgs = parseFormula("TRUE");
|
Ptg[] ptgs = parseFormula("TRUE");
|
||||||
assertEquals(1, ptgs.length);
|
assertEquals(1, ptgs.length);
|
||||||
BoolPtg flag = (BoolPtg) ptgs[0];
|
BoolPtg flag = (BoolPtg) ptgs[0];
|
||||||
|
@ -108,7 +108,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSumIf() {
|
void testSumIf() {
|
||||||
Ptg[] ptgs = parseFormula("SUMIF(A1:A5,\">4000\",B1:B5)");
|
Ptg[] ptgs = parseFormula("SUMIF(A1:A5,\">4000\",B1:B5)");
|
||||||
assertEquals(4, ptgs.length);
|
assertEquals(4, ptgs.length);
|
||||||
}
|
}
|
||||||
|
@ -119,14 +119,14 @@ public final class TestFormulaParser {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNonAlphaFormula() {
|
void testNonAlphaFormula() {
|
||||||
Ptg[] ptgs = parseFormula("\"TOTAL[\"&F3&\"]\"");
|
Ptg[] ptgs = parseFormula("\"TOTAL[\"&F3&\"]\"");
|
||||||
confirmTokenClasses(ptgs, StringPtg.class, RefPtg.class, ConcatPtg.class, StringPtg.class, ConcatPtg.class);
|
confirmTokenClasses(ptgs, StringPtg.class, RefPtg.class, ConcatPtg.class, StringPtg.class, ConcatPtg.class);
|
||||||
assertEquals("TOTAL[", ((StringPtg)ptgs[0]).getValue());
|
assertEquals("TOTAL[", ((StringPtg)ptgs[0]).getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMacroFunction() throws IOException {
|
void testMacroFunction() throws IOException {
|
||||||
// testNames.xls contains a VB function called 'myFunc'
|
// testNames.xls contains a VB function called 'myFunc'
|
||||||
final String testFile = "testNames.xls";
|
final String testFile = "testNames.xls";
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook(testFile)) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook(testFile)) {
|
||||||
|
@ -191,19 +191,19 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmbeddedSlash() {
|
void testEmbeddedSlash() {
|
||||||
confirmTokenClasses("HYPERLINK(\"http://www.jakarta.org\",\"Jakarta\")",
|
confirmTokenClasses("HYPERLINK(\"http://www.jakarta.org\",\"Jakarta\")",
|
||||||
StringPtg.class, StringPtg.class, FuncVarPtg.class);
|
StringPtg.class, StringPtg.class, FuncVarPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConcatenate() {
|
void testConcatenate() {
|
||||||
confirmTokenClasses("CONCATENATE(\"first\",\"second\")",
|
confirmTokenClasses("CONCATENATE(\"first\",\"second\")",
|
||||||
StringPtg.class, StringPtg.class, FuncVarPtg.class);
|
StringPtg.class, StringPtg.class, FuncVarPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorksheetReferences() throws IOException {
|
void testWorksheetReferences() throws IOException {
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
|
|
||||||
HSSFSheet sheet1 = wb.createSheet("NoQuotesNeeded");
|
HSSFSheet sheet1 = wb.createSheet("NoQuotesNeeded");
|
||||||
|
@ -231,12 +231,12 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnaryMinus() {
|
void testUnaryMinus() {
|
||||||
confirmTokenClasses("-A1", RefPtg.class, UnaryMinusPtg.class);
|
confirmTokenClasses("-A1", RefPtg.class, UnaryMinusPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnaryPlus() {
|
void testUnaryPlus() {
|
||||||
confirmTokenClasses("+A1", RefPtg.class, UnaryPlusPtg.class);
|
confirmTokenClasses("+A1", RefPtg.class, UnaryPlusPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ public final class TestFormulaParser {
|
||||||
* check that POI follows the same encoding rules as Excel.
|
* check that POI follows the same encoding rules as Excel.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testExactEncodingOfUnaryPlusAndMinus() {
|
void testExactEncodingOfUnaryPlusAndMinus() {
|
||||||
// as tested in Excel:
|
// as tested in Excel:
|
||||||
confirmUnary("-3", -3, NumberPtg.class);
|
confirmUnary("-3", -3, NumberPtg.class);
|
||||||
confirmUnary("--4", -4, NumberPtg.class, UnaryMinusPtg.class);
|
confirmUnary("--4", -4, NumberPtg.class, UnaryMinusPtg.class);
|
||||||
|
@ -278,7 +278,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLeadingSpaceInString() {
|
void testLeadingSpaceInString() {
|
||||||
String value = " hi ";
|
String value = " hi ";
|
||||||
Ptg[] ptgs = parseFormula("\"" + value + "\"");
|
Ptg[] ptgs = parseFormula("\"" + value + "\"");
|
||||||
confirmTokenClasses(ptgs, StringPtg.class);
|
confirmTokenClasses(ptgs, StringPtg.class);
|
||||||
|
@ -286,7 +286,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLookupAndMatchFunctionArgs() {
|
void testLookupAndMatchFunctionArgs() {
|
||||||
Ptg[] ptgs = parseFormula("lookup(A1, A3:A52, B3:B52)");
|
Ptg[] ptgs = parseFormula("lookup(A1, A3:A52, B3:B52)");
|
||||||
confirmTokenClasses(ptgs, RefPtg.class, AreaPtg.class, AreaPtg.class, FuncVarPtg.class);
|
confirmTokenClasses(ptgs, RefPtg.class, AreaPtg.class, AreaPtg.class, FuncVarPtg.class);
|
||||||
assertEquals(ptgs[0].getPtgClass(), Ptg.CLASS_VALUE, "ptg0 has Value class");
|
assertEquals(ptgs[0].getPtgClass(), Ptg.CLASS_VALUE, "ptg0 has Value class");
|
||||||
|
@ -298,20 +298,20 @@ public final class TestFormulaParser {
|
||||||
|
|
||||||
/** bug 33160*/
|
/** bug 33160*/
|
||||||
@Test
|
@Test
|
||||||
public void testLargeInt() {
|
void testLargeInt() {
|
||||||
confirmTokenClasses("40", IntPtg.class);
|
confirmTokenClasses("40", IntPtg.class);
|
||||||
confirmTokenClasses("40000", IntPtg.class);
|
confirmTokenClasses("40000", IntPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** bug 33160 */
|
/** bug 33160 */
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleLongFormula() {
|
void testSimpleLongFormula() {
|
||||||
confirmTokenClasses("40000/2", IntPtg.class, IntPtg.class, DividePtg.class);
|
confirmTokenClasses("40000/2", IntPtg.class, IntPtg.class, DividePtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** bug 35027, underscore in sheet name */
|
/** bug 35027, underscore in sheet name */
|
||||||
@Test
|
@Test
|
||||||
public void testUnderscore() throws IOException {
|
void testUnderscore() throws IOException {
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet1 = wb.createSheet("Cash_Flow");
|
HSSFSheet sheet1 = wb.createSheet("Cash_Flow");
|
||||||
sheet1.createRow(0).createCell(0).setCellValue("Cash_Flow");
|
sheet1.createRow(0).createCell(0).setCellValue("Cash_Flow");
|
||||||
|
@ -331,7 +331,7 @@ public final class TestFormulaParser {
|
||||||
|
|
||||||
/** bug 49725, defined names with underscore */
|
/** bug 49725, defined names with underscore */
|
||||||
@Test
|
@Test
|
||||||
public void testNamesWithUnderscore() throws IOException {
|
void testNamesWithUnderscore() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook(); //or new XSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook(); //or new XSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet("NamesWithUnderscore");
|
HSSFSheet sheet = wb.createSheet("NamesWithUnderscore");
|
||||||
|
|
||||||
|
@ -378,14 +378,14 @@ public final class TestFormulaParser {
|
||||||
|
|
||||||
// bug 38396 : Formula with exponential numbers not parsed correctly.
|
// bug 38396 : Formula with exponential numbers not parsed correctly.
|
||||||
@Test
|
@Test
|
||||||
public void testExponentialParsing() {
|
void testExponentialParsing() {
|
||||||
confirmTokenClasses("1.3E21/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
confirmTokenClasses("1.3E21/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
||||||
confirmTokenClasses("1322E21/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
confirmTokenClasses("1322E21/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
||||||
confirmTokenClasses("1.3E1/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
confirmTokenClasses("1.3E1/2", NumberPtg.class, IntPtg.class, DividePtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExponentialInSheet() throws IOException {
|
void testExponentialInSheet() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
wb.createSheet("Cash_Flow");
|
wb.createSheet("Cash_Flow");
|
||||||
|
@ -459,7 +459,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNumbers() throws IOException {
|
void testNumbers() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
wb.createSheet("Cash_Flow");
|
wb.createSheet("Cash_Flow");
|
||||||
|
@ -501,7 +501,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRanges() throws IOException {
|
void testRanges() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
wb.createSheet("Cash_Flow");
|
wb.createSheet("Cash_Flow");
|
||||||
|
@ -527,7 +527,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultiSheetReference() throws IOException {
|
void testMultiSheetReference() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
wb.createSheet("Cash_Flow");
|
wb.createSheet("Cash_Flow");
|
||||||
|
@ -582,7 +582,7 @@ public final class TestFormulaParser {
|
||||||
* a formula consisting of a single no-arg function got rendered without the function braces
|
* a formula consisting of a single no-arg function got rendered without the function braces
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToFormulaStringZeroArgFunction() throws IOException {
|
void testToFormulaStringZeroArgFunction() throws IOException {
|
||||||
HSSFWorkbook book = new HSSFWorkbook();
|
HSSFWorkbook book = new HSSFWorkbook();
|
||||||
|
|
||||||
Ptg[] ptgs = {
|
Ptg[] ptgs = {
|
||||||
|
@ -594,7 +594,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPercent() {
|
void testPercent() {
|
||||||
|
|
||||||
confirmTokenClasses("5%", IntPtg.class, PercentPtg.class);
|
confirmTokenClasses("5%", IntPtg.class, PercentPtg.class);
|
||||||
// spaces OK
|
// spaces OK
|
||||||
|
@ -621,7 +621,7 @@ public final class TestFormulaParser {
|
||||||
* Tests combinations of various operators in the absence of brackets
|
* Tests combinations of various operators in the absence of brackets
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPrecedenceAndAssociativity() {
|
void testPrecedenceAndAssociativity() {
|
||||||
|
|
||||||
// TRUE=TRUE=2=2 evaluates to FALSE
|
// TRUE=TRUE=2=2 evaluates to FALSE
|
||||||
confirmTokenClasses("TRUE=TRUE=2=2", BoolPtg.class, BoolPtg.class, EqualPtg.class,
|
confirmTokenClasses("TRUE=TRUE=2=2", BoolPtg.class, BoolPtg.class, EqualPtg.class,
|
||||||
|
@ -664,7 +664,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPower() {
|
void testPower() {
|
||||||
confirmTokenClasses("2^5", IntPtg.class, IntPtg.class, PowerPtg.class);
|
confirmTokenClasses("2^5", IntPtg.class, IntPtg.class, PowerPtg.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseNumber() {
|
void testParseNumber() {
|
||||||
IntPtg ip;
|
IntPtg ip;
|
||||||
|
|
||||||
// bug 33160
|
// bug 33160
|
||||||
|
@ -697,7 +697,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMissingArgs() {
|
void testMissingArgs() {
|
||||||
confirmTokenClasses("if(A1, ,C1)",
|
confirmTokenClasses("if(A1, ,C1)",
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
AttrPtg.class, // tAttrIf
|
AttrPtg.class, // tAttrIf
|
||||||
|
@ -713,7 +713,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseErrorLiterals() {
|
void testParseErrorLiterals() {
|
||||||
|
|
||||||
confirmParseErrorLiteral(ErrPtg.NULL_INTERSECTION, "#NULL!");
|
confirmParseErrorLiteral(ErrPtg.NULL_INTERSECTION, "#NULL!");
|
||||||
confirmParseErrorLiteral(ErrPtg.DIV_ZERO, "#DIV/0!");
|
confirmParseErrorLiteral(ErrPtg.DIV_ZERO, "#DIV/0!");
|
||||||
|
@ -744,7 +744,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseStringLiterals_bug28754() throws IOException {
|
void testParseStringLiterals_bug28754() throws IOException {
|
||||||
|
|
||||||
StringPtg sp;
|
StringPtg sp;
|
||||||
try {
|
try {
|
||||||
|
@ -771,7 +771,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseStringLiterals() {
|
void testParseStringLiterals() {
|
||||||
confirmStringParse("goto considered harmful");
|
confirmStringParse("goto considered harmful");
|
||||||
|
|
||||||
confirmStringParse("goto 'considered' harmful");
|
confirmStringParse("goto 'considered' harmful");
|
||||||
|
@ -784,7 +784,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseSumIfSum() {
|
void testParseSumIfSum() {
|
||||||
String formulaString;
|
String formulaString;
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
ptgs = parseFormula("sum(5, 2, if(3>2, sum(A1:A2), 6))");
|
ptgs = parseFormula("sum(5, 2, if(3>2, sum(A1:A2), 6))");
|
||||||
|
@ -797,7 +797,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParserErrors() {
|
void testParserErrors() {
|
||||||
parseExpectedException(" 12 . 345 ");
|
parseExpectedException(" 12 . 345 ");
|
||||||
parseExpectedException("1 .23 ");
|
parseExpectedException("1 .23 ");
|
||||||
|
|
||||||
|
@ -824,7 +824,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetFormulaWithRowBeyond32768_Bug44539() throws IOException {
|
void testSetFormulaWithRowBeyond32768_Bug44539() throws IOException {
|
||||||
|
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
@ -840,7 +840,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSpaceAtStartOfFormula() {
|
void testSpaceAtStartOfFormula() {
|
||||||
// Simulating cell formula of "= 4" (note space)
|
// Simulating cell formula of "= 4" (note space)
|
||||||
// The same Ptg array can be observed if an excel file is saved with that exact formula
|
// The same Ptg array can be observed if an excel file is saved with that exact formula
|
||||||
|
|
||||||
|
@ -868,7 +868,7 @@ public final class TestFormulaParser {
|
||||||
* Checks some internal error detecting logic ('stack underflow error' in toFormulaString)
|
* Checks some internal error detecting logic ('stack underflow error' in toFormulaString)
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testTooFewOperandArgs() {
|
void testTooFewOperandArgs() {
|
||||||
// Simulating badly encoded cell formula of "=/1"
|
// Simulating badly encoded cell formula of "=/1"
|
||||||
// Not sure if Excel could ever produce this
|
// Not sure if Excel could ever produce this
|
||||||
Ptg[] ptgs = {
|
Ptg[] ptgs = {
|
||||||
|
@ -889,7 +889,7 @@ public final class TestFormulaParser {
|
||||||
* (e.g. COUNTIF) Excel fails to evaluate the formula, giving '#VALUE!' instead.
|
* (e.g. COUNTIF) Excel fails to evaluate the formula, giving '#VALUE!' instead.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFuncPtgSelection() {
|
void testFuncPtgSelection() {
|
||||||
|
|
||||||
Ptg[] ptgs = parseFormula("countif(A1:A2, 1)");
|
Ptg[] ptgs = parseFormula("countif(A1:A2, 1)");
|
||||||
assertEquals(3, ptgs.length);
|
assertEquals(3, ptgs.length);
|
||||||
|
@ -900,7 +900,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrongNumberOfFunctionArgs() throws IOException {
|
void testWrongNumberOfFunctionArgs() throws IOException {
|
||||||
confirmArgCountMsg("sin()", "Too few arguments to function 'SIN'. Expected 1 but got 0.");
|
confirmArgCountMsg("sin()", "Too few arguments to function 'SIN'. Expected 1 but got 0.");
|
||||||
confirmArgCountMsg("countif(1, 2, 3, 4)", "Too many arguments to function 'COUNTIF'. Expected 2 but got 4.");
|
confirmArgCountMsg("countif(1, 2, 3, 4)", "Too many arguments to function 'COUNTIF'. Expected 2 but got 4.");
|
||||||
confirmArgCountMsg("index(1, 2, 3, 4, 5, 6)", "Too many arguments to function 'INDEX'. At most 4 were expected but got 6.");
|
confirmArgCountMsg("index(1, 2, 3, 4, 5, 6)", "Too many arguments to function 'INDEX'. At most 4 were expected but got 6.");
|
||||||
|
@ -915,7 +915,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseErrorExpectedMsg() {
|
void testParseErrorExpectedMsg() {
|
||||||
FormulaParseException e;
|
FormulaParseException e;
|
||||||
e = assertThrows(FormulaParseException.class, () -> parseFormula("round(3.14;2)"));
|
e = assertThrows(FormulaParseException.class, () -> parseFormula("round(3.14;2)"));
|
||||||
confirmParseException(e, "Parse error near char 10 ';' in specified formula 'round(3.14;2)'. Expected ',' or ')'");
|
confirmParseException(e, "Parse error near char 10 ';' in specified formula 'round(3.14;2)'. Expected ',' or ')'");
|
||||||
|
@ -928,7 +928,7 @@ public final class TestFormulaParser {
|
||||||
* this function name has a dot in it.
|
* this function name has a dot in it.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testParseErrorTypeFunction() {
|
void testParseErrorTypeFunction() {
|
||||||
|
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
try {
|
try {
|
||||||
|
@ -944,7 +944,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNamedRangeThatLooksLikeCell() throws IOException {
|
void testNamedRangeThatLooksLikeCell() throws IOException {
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = wb.createSheet("Sheet1");
|
HSSFSheet sheet = wb.createSheet("Sheet1");
|
||||||
HSSFName name = wb.createName();
|
HSSFName name = wb.createName();
|
||||||
|
@ -972,7 +972,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseAreaRefHighRow_bug45358() throws IOException {
|
void testParseAreaRefHighRow_bug45358() throws IOException {
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
AreaI aptg;
|
AreaI aptg;
|
||||||
|
|
||||||
|
@ -997,7 +997,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseArray() {
|
void testParseArray() {
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
ptgs = parseFormula("mode({1,2,2,#REF!;FALSE,3,3,2})");
|
ptgs = parseFormula("mode({1,2,2,#REF!;FALSE,3,3,2})");
|
||||||
confirmTokenClasses(ptgs, ArrayPtg.class, FuncVarPtg.class);
|
confirmTokenClasses(ptgs, ArrayPtg.class, FuncVarPtg.class);
|
||||||
|
@ -1010,7 +1010,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseStringElementInArray() {
|
void testParseStringElementInArray() {
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
ptgs = parseFormula("MAX({\"5\"},3)");
|
ptgs = parseFormula("MAX({\"5\"},3)");
|
||||||
confirmTokenClasses(ptgs, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
|
confirmTokenClasses(ptgs, ArrayPtg.class, IntPtg.class, FuncVarPtg.class);
|
||||||
|
@ -1037,7 +1037,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseArrayNegativeElement() {
|
void testParseArrayNegativeElement() {
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
try {
|
try {
|
||||||
ptgs = parseFormula("{-42}");
|
ptgs = parseFormula("{-42}");
|
||||||
|
@ -1060,7 +1060,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRangeOperator() throws IOException {
|
void testRangeOperator() throws IOException {
|
||||||
|
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
@ -1085,7 +1085,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBooleanNamedSheet() throws IOException {
|
void testBooleanNamedSheet() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet("true");
|
HSSFSheet sheet = wb.createSheet("true");
|
||||||
HSSFCell cell = sheet.createRow(0).createCell(0);
|
HSSFCell cell = sheet.createRow(0).createCell(0);
|
||||||
|
@ -1097,7 +1097,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseExternalWorkbookReference() throws IOException {
|
void testParseExternalWorkbookReference() throws IOException {
|
||||||
HSSFWorkbook wbA = HSSFTestDataSamples.openSampleWorkbook("multibookFormulaA.xls");
|
HSSFWorkbook wbA = HSSFTestDataSamples.openSampleWorkbook("multibookFormulaA.xls");
|
||||||
HSSFCell cell = wbA.getSheetAt(0).getRow(0).getCell(0);
|
HSSFCell cell = wbA.getSheetAt(0).getRow(0).getCell(0);
|
||||||
|
|
||||||
|
@ -1129,7 +1129,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnion() throws IOException {
|
void testUnion() throws IOException {
|
||||||
String formula = "Sheet1!$B$2:$C$3,OFFSET(Sheet1!$E$2:$E$4,1,Sheet1!$A$1),Sheet1!$D$6";
|
String formula = "Sheet1!$B$2:$C$3,OFFSET(Sheet1!$E$2:$E$4,1,Sheet1!$A$1),Sheet1!$D$6";
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
|
@ -1157,7 +1157,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntersection() throws IOException {
|
void testIntersection() throws IOException {
|
||||||
String formula = "Sheet1!$B$2:$C$3 OFFSET(Sheet1!$E$2:$E$4, 1,Sheet1!$A$1) Sheet1!$D$6";
|
String formula = "Sheet1!$B$2:$C$3 OFFSET(Sheet1!$E$2:$E$4, 1,Sheet1!$A$1) Sheet1!$D$6";
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
|
@ -1185,7 +1185,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComparisonInParen() {
|
void testComparisonInParen() {
|
||||||
confirmTokenClasses("(A1 > B2)",
|
confirmTokenClasses("(A1 > B2)",
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
|
@ -1195,7 +1195,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnionInParen() {
|
void testUnionInParen() {
|
||||||
confirmTokenClasses("(A1:B2,B2:C3)",
|
confirmTokenClasses("(A1:B2,B2:C3)",
|
||||||
MemAreaPtg.class,
|
MemAreaPtg.class,
|
||||||
AreaPtg.class,
|
AreaPtg.class,
|
||||||
|
@ -1206,7 +1206,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntersectionInParen() {
|
void testIntersectionInParen() {
|
||||||
confirmTokenClasses("(A1:B2 B2:C3)",
|
confirmTokenClasses("(A1:B2 B2:C3)",
|
||||||
MemAreaPtg.class,
|
MemAreaPtg.class,
|
||||||
AreaPtg.class,
|
AreaPtg.class,
|
||||||
|
@ -1218,7 +1218,7 @@ public final class TestFormulaParser {
|
||||||
|
|
||||||
// https://bz.apache.org/bugzilla/show_bug.cgi?id=60980
|
// https://bz.apache.org/bugzilla/show_bug.cgi?id=60980
|
||||||
@Test
|
@Test
|
||||||
public void testIntersectionInFunctionArgs() {
|
void testIntersectionInFunctionArgs() {
|
||||||
confirmTokenClasses("SUM(A1:B2 B2:C3)",
|
confirmTokenClasses("SUM(A1:B2 B2:C3)",
|
||||||
MemAreaPtg.class,
|
MemAreaPtg.class,
|
||||||
AreaPtg.class,
|
AreaPtg.class,
|
||||||
|
@ -1229,7 +1229,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIntersectionNamesInFunctionArgs() {
|
void testIntersectionNamesInFunctionArgs() {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
HSSFName name1 = wb.createName();
|
HSSFName name1 = wb.createName();
|
||||||
|
@ -1252,7 +1252,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRange_bug46643() throws IOException {
|
void testRange_bug46643() throws IOException {
|
||||||
String formula = "Sheet1!A1:Sheet1!B3";
|
String formula = "Sheet1!A1:Sheet1!B3";
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
|
@ -1276,7 +1276,7 @@ public final class TestFormulaParser {
|
||||||
|
|
||||||
/** Named ranges with backslashes, e.g. 'POI\\2009' */
|
/** Named ranges with backslashes, e.g. 'POI\\2009' */
|
||||||
@Test
|
@Test
|
||||||
public void testBackSlashInNames() throws IOException {
|
void testBackSlashInNames() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
|
||||||
HSSFName name = wb.createName();
|
HSSFName name = wb.createName();
|
||||||
|
@ -1301,7 +1301,7 @@ public final class TestFormulaParser {
|
||||||
* See the related/similar test: {@link BaseTestBugzillaIssues#bug42448()}
|
* See the related/similar test: {@link BaseTestBugzillaIssues#bug42448()}
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testParseAbnormalSheetNamesAndRanges_bug42448() throws IOException {
|
void testParseAbnormalSheetNamesAndRanges_bug42448() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("A");
|
wb.createSheet("A");
|
||||||
try {
|
try {
|
||||||
|
@ -1316,7 +1316,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRangeFuncOperand_bug46951() throws IOException {
|
void testRangeFuncOperand_bug46951() throws IOException {
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
try {
|
try {
|
||||||
|
@ -1341,7 +1341,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnionOfFullCollFullRowRef() throws IOException {
|
void testUnionOfFullCollFullRowRef() throws IOException {
|
||||||
parseFormula("3:4");
|
parseFormula("3:4");
|
||||||
Ptg[] ptgs = parseFormula("$Z:$AC");
|
Ptg[] ptgs = parseFormula("$Z:$AC");
|
||||||
confirmTokenClasses(ptgs, AreaPtg.class);
|
confirmTokenClasses(ptgs, AreaPtg.class);
|
||||||
|
@ -1378,7 +1378,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExplicitRangeWithTwoSheetNames() throws IOException {
|
void testExplicitRangeWithTwoSheetNames() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
Ptg[] ptgs = HSSFFormulaParser.parse("Sheet1!F1:Sheet1!G2", wb);
|
Ptg[] ptgs = HSSFFormulaParser.parse("Sheet1!F1:Sheet1!G2", wb);
|
||||||
|
@ -1399,7 +1399,7 @@ public final class TestFormulaParser {
|
||||||
* and that the {@link MemFuncPtg} / {@link MemAreaPtg} is added correctly
|
* and that the {@link MemFuncPtg} / {@link MemAreaPtg} is added correctly
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testComplexExplicitRangeEncodings() {
|
void testComplexExplicitRangeEncodings() {
|
||||||
|
|
||||||
Ptg[] ptgs;
|
Ptg[] ptgs;
|
||||||
ptgs = parseFormula("SUM(OFFSET(A1,0,0):B2:C3:D4:E5:OFFSET(F6,1,1):G7)");
|
ptgs = parseFormula("SUM(OFFSET(A1,0,0):B2:C3:D4:E5:OFFSET(F6,1,1):G7)");
|
||||||
|
@ -1448,7 +1448,7 @@ public final class TestFormulaParser {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEdgeCaseParserErrors() throws IOException {
|
void testEdgeCaseParserErrors() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
wb.createSheet("Sheet1");
|
wb.createSheet("Sheet1");
|
||||||
|
|
||||||
|
@ -1478,7 +1478,7 @@ public final class TestFormulaParser {
|
||||||
* POI should also be able to parse such defined names.
|
* POI should also be able to parse such defined names.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testParseComplexName() throws IOException {
|
void testParseComplexName() throws IOException {
|
||||||
|
|
||||||
// Mock up a spreadsheet to match the critical details of the sample
|
// Mock up a spreadsheet to match the critical details of the sample
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
|
@ -1512,7 +1512,7 @@ public final class TestFormulaParser {
|
||||||
* references during parsing.
|
* references during parsing.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testZeroRowRefs() throws IOException {
|
void testZeroRowRefs() throws IOException {
|
||||||
String badCellRef = "B0"; // bad because zero is not a valid row number
|
String badCellRef = "B0"; // bad because zero is not a valid row number
|
||||||
String leadingZeroCellRef = "B000001"; // this should get parsed as "B1"
|
String leadingZeroCellRef = "B000001"; // this should get parsed as "B1"
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
|
@ -1546,7 +1546,7 @@ public final class TestFormulaParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test57196_Formula() throws IOException {
|
void test57196_Formula() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
Ptg[] ptgs = HSSFFormulaParser.parse("DEC2HEX(HEX2DEC(O8)-O2+D2)", wb, FormulaType.CELL, -1);
|
Ptg[] ptgs = HSSFFormulaParser.parse("DEC2HEX(HEX2DEC(O8)-O2+D2)", wb, FormulaType.CELL, -1);
|
||||||
assertNotNull(ptgs, "Ptg array should not be null");
|
assertNotNull(ptgs, "Ptg array should not be null");
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestFormulaParserEval {
|
public final class TestFormulaParserEval {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithNamedRange() {
|
void testWithNamedRange() {
|
||||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
|
|
||||||
HSSFSheet s = workbook.createSheet("Foo");
|
HSSFSheet s = workbook.createSheet("Foo");
|
||||||
|
@ -76,7 +76,7 @@ public final class TestFormulaParserEval {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEvaluateFormulaWithRowBeyond32768_Bug44539() {
|
void testEvaluateFormulaWithRowBeyond32768_Bug44539() {
|
||||||
|
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleIf() {
|
void testSimpleIf() {
|
||||||
|
|
||||||
Class<?>[] expClss = {
|
Class<?>[] expClss = {
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
|
@ -75,7 +75,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleIfNoFalseParam() {
|
void testSimpleIfNoFalseParam() {
|
||||||
|
|
||||||
Class<?>[] expClss = {
|
Class<?>[] expClss = {
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
|
@ -92,7 +92,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfWithLargeParams() {
|
void testIfWithLargeParams() {
|
||||||
|
|
||||||
Class<?>[] expClss = {
|
Class<?>[] expClss = {
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
|
@ -123,7 +123,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedIf() {
|
void testNestedIf() {
|
||||||
|
|
||||||
Class<?>[] expClss = {
|
Class<?>[] expClss = {
|
||||||
RefPtg.class,
|
RefPtg.class,
|
||||||
|
@ -160,7 +160,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmbeddedIf() {
|
void testEmbeddedIf() {
|
||||||
Ptg[] ptgs = parseFormula("IF(3>=1,\"*\",IF(4<>1,\"first\",\"second\"))");
|
Ptg[] ptgs = parseFormula("IF(3>=1,\"*\",IF(4<>1,\"first\",\"second\"))");
|
||||||
assertEquals(17, ptgs.length);
|
assertEquals(17, ptgs.length);
|
||||||
|
|
||||||
|
@ -170,14 +170,14 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleLogical() {
|
void testSimpleLogical() {
|
||||||
Ptg[] ptgs = parseFormula("IF(A1<A2,B1,B2)");
|
Ptg[] ptgs = parseFormula("IF(A1<A2,B1,B2)");
|
||||||
assertEquals(9, ptgs.length);
|
assertEquals(9, ptgs.length);
|
||||||
assertEquals(LessThanPtg.class, ptgs[2].getClass(), "3rd Ptg is less than");
|
assertEquals(LessThanPtg.class, ptgs[2].getClass(), "3rd Ptg is less than");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParenIf() {
|
void testParenIf() {
|
||||||
Ptg[] ptgs = parseFormula("IF((A1+A2)<=3,\"yes\",\"no\")");
|
Ptg[] ptgs = parseFormula("IF((A1+A2)<=3,\"yes\",\"no\")");
|
||||||
assertEquals(12, ptgs.length);
|
assertEquals(12, ptgs.length);
|
||||||
assertEquals(LessEqualPtg.class, ptgs[5].getClass(), "6th Ptg is less than equal");
|
assertEquals(LessEqualPtg.class, ptgs[5].getClass(), "6th Ptg is less than equal");
|
||||||
|
@ -185,7 +185,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testYN() {
|
void testYN() {
|
||||||
Ptg[] ptgs = parseFormula("IF(TRUE,\"Y\",\"N\")");
|
Ptg[] ptgs = parseFormula("IF(TRUE,\"Y\",\"N\")");
|
||||||
assertEquals(7, ptgs.length);
|
assertEquals(7, ptgs.length);
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ public final class TestFormulaParserIf {
|
||||||
* Make sure the ptgs are generated properly with two functions embedded
|
* Make sure the ptgs are generated properly with two functions embedded
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testNestedFunctionIf() {
|
void testNestedFunctionIf() {
|
||||||
Ptg[] ptgs = parseFormula("IF(A1=B1,AVERAGE(A1:B1),AVERAGE(A2:B2))");
|
Ptg[] ptgs = parseFormula("IF(A1=B1,AVERAGE(A1:B1),AVERAGE(A2:B2))");
|
||||||
assertEquals(11, ptgs.length);
|
assertEquals(11, ptgs.length);
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ public final class TestFormulaParserIf {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIfSingleCondition(){
|
void testIfSingleCondition(){
|
||||||
Ptg[] ptgs = parseFormula("IF(1=1,10)");
|
Ptg[] ptgs = parseFormula("IF(1=1,10)");
|
||||||
assertEquals(7, ptgs.length);
|
assertEquals(7, ptgs.length);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public class TestHSSFAnchor {
|
public class TestHSSFAnchor {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultValues(){
|
void testDefaultValues(){
|
||||||
HSSFClientAnchor clientAnchor = new HSSFClientAnchor();
|
HSSFClientAnchor clientAnchor = new HSSFClientAnchor();
|
||||||
assertEquals(clientAnchor.getAnchorType(), AnchorType.MOVE_AND_RESIZE);
|
assertEquals(clientAnchor.getAnchorType(), AnchorType.MOVE_AND_RESIZE);
|
||||||
assertEquals(clientAnchor.getCol1(), 0);
|
assertEquals(clientAnchor.getCol1(), 0);
|
||||||
|
@ -81,7 +81,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCorrectOrderInSpContainer(){
|
void testCorrectOrderInSpContainer(){
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("drawings.xls");
|
||||||
HSSFSheet sheet = wb.getSheet("pictures");
|
HSSFSheet sheet = wb.getSheet("pictures");
|
||||||
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
HSSFPatriarch drawing = sheet.getDrawingPatriarch();
|
||||||
|
@ -102,7 +102,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateClientAnchorFromContainer(){
|
void testCreateClientAnchorFromContainer(){
|
||||||
EscherContainerRecord container = new EscherContainerRecord();
|
EscherContainerRecord container = new EscherContainerRecord();
|
||||||
EscherClientAnchorRecord escher = new EscherClientAnchorRecord();
|
EscherClientAnchorRecord escher = new EscherClientAnchorRecord();
|
||||||
escher.setFlag((short) 3);
|
escher.setFlag((short) 3);
|
||||||
|
@ -137,7 +137,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateChildAnchorFromContainer(){
|
void testCreateChildAnchorFromContainer(){
|
||||||
EscherContainerRecord container = new EscherContainerRecord();
|
EscherContainerRecord container = new EscherContainerRecord();
|
||||||
EscherChildAnchorRecord escher = new EscherChildAnchorRecord();
|
EscherChildAnchorRecord escher = new EscherChildAnchorRecord();
|
||||||
escher.setDx1((short) 15);
|
escher.setDx1((short) 15);
|
||||||
|
@ -159,7 +159,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testShapeEscherMustHaveAnchorRecord(){
|
void testShapeEscherMustHaveAnchorRecord(){
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = wb.createSheet();
|
HSSFSheet sheet = wb.createSheet();
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClientAnchorFromEscher(){
|
void testClientAnchorFromEscher(){
|
||||||
EscherClientAnchorRecord escher = new EscherClientAnchorRecord();
|
EscherClientAnchorRecord escher = new EscherClientAnchorRecord();
|
||||||
escher.setCol1((short)11);
|
escher.setCol1((short)11);
|
||||||
escher.setCol2((short)12);
|
escher.setCol2((short)12);
|
||||||
|
@ -209,7 +209,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClientAnchorFromScratch(){
|
void testClientAnchorFromScratch(){
|
||||||
HSSFClientAnchor anchor = new HSSFClientAnchor();
|
HSSFClientAnchor anchor = new HSSFClientAnchor();
|
||||||
EscherClientAnchorRecord escher = (EscherClientAnchorRecord) HSSFTestHelper.getEscherAnchor(anchor);
|
EscherClientAnchorRecord escher = (EscherClientAnchorRecord) HSSFTestHelper.getEscherAnchor(anchor);
|
||||||
anchor.setAnchor((short)11, 12, 13, 14, (short)15, 16, 17, 18);
|
anchor.setAnchor((short)11, 12, 13, 14, (short)15, 16, 17, 18);
|
||||||
|
@ -258,7 +258,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChildAnchorFromEscher(){
|
void testChildAnchorFromEscher(){
|
||||||
EscherChildAnchorRecord escher = new EscherChildAnchorRecord();
|
EscherChildAnchorRecord escher = new EscherChildAnchorRecord();
|
||||||
escher.setDx1((short) 15);
|
escher.setDx1((short) 15);
|
||||||
escher.setDx2((short) 16);
|
escher.setDx2((short) 16);
|
||||||
|
@ -277,7 +277,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChildAnchorFromScratch(){
|
void testChildAnchorFromScratch(){
|
||||||
HSSFChildAnchor anchor = new HSSFChildAnchor();
|
HSSFChildAnchor anchor = new HSSFChildAnchor();
|
||||||
EscherChildAnchorRecord escher = (EscherChildAnchorRecord) HSSFTestHelper.getEscherAnchor(anchor);
|
EscherChildAnchorRecord escher = (EscherChildAnchorRecord) HSSFTestHelper.getEscherAnchor(anchor);
|
||||||
anchor.setAnchor(11, 12, 13, 14);
|
anchor.setAnchor(11, 12, 13, 14);
|
||||||
|
@ -306,7 +306,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsToSelf(){
|
void testEqualsToSelf(){
|
||||||
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
assertEquals(clientAnchor, clientAnchor);
|
assertEquals(clientAnchor, clientAnchor);
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPassIncompatibleTypeIsFalse(){
|
void testPassIncompatibleTypeIsFalse(){
|
||||||
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
assertNotSame(clientAnchor, "wrongType");
|
assertNotSame(clientAnchor, "wrongType");
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNullReferenceIsFalse() {
|
void testNullReferenceIsFalse() {
|
||||||
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
assertNotNull(clientAnchor, "Passing null to equals should return false");
|
assertNotNull(clientAnchor, "Passing null to equals should return false");
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsIsReflexiveIsSymmetric() {
|
void testEqualsIsReflexiveIsSymmetric() {
|
||||||
HSSFClientAnchor clientAnchor1 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor1 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
HSSFClientAnchor clientAnchor2 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor2 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
|
|
||||||
|
@ -348,7 +348,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEqualsValues(){
|
void testEqualsValues(){
|
||||||
HSSFClientAnchor clientAnchor1 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor1 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
HSSFClientAnchor clientAnchor2 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
HSSFClientAnchor clientAnchor2 = new HSSFClientAnchor(0, 1, 2, 3, (short)4, 5, (short)6, 7);
|
||||||
assertEquals(clientAnchor1, clientAnchor2);
|
assertEquals(clientAnchor1, clientAnchor2);
|
||||||
|
@ -423,7 +423,7 @@ public class TestHSSFAnchor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFlipped(){
|
void testFlipped(){
|
||||||
HSSFChildAnchor child = new HSSFChildAnchor(2,2,1,1);
|
HSSFChildAnchor child = new HSSFChildAnchor(2,2,1,1);
|
||||||
assertTrue(child.isHorizontallyFlipped());
|
assertTrue(child.isHorizontallyFlipped());
|
||||||
assertTrue(child.isVerticallyFlipped());
|
assertTrue(child.isVerticallyFlipped());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public final class TestLinkTable {
|
||||||
* It's not clear what exact steps need to be taken in Excel to create such a workbook
|
* It's not clear what exact steps need to be taken in Excel to create such a workbook
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLinkTableWithoutExternalBookRecord_bug45046() {
|
void testLinkTableWithoutExternalBookRecord_bug45046() {
|
||||||
// Bug 45046 b: DEFINEDNAME is part of LinkTable
|
// Bug 45046 b: DEFINEDNAME is part of LinkTable
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45046-21984.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45046-21984.xls");
|
||||||
// some other sanity checks
|
// some other sanity checks
|
||||||
|
@ -74,7 +74,7 @@ public final class TestLinkTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMultipleExternSheetRecords_bug45698() {
|
void testMultipleExternSheetRecords_bug45698() {
|
||||||
// Bug: Extern sheet is part of LinkTable
|
// Bug: Extern sheet is part of LinkTable
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45698-22488.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45698-22488.xls");
|
||||||
// some other sanity checks
|
// some other sanity checks
|
||||||
|
@ -82,7 +82,7 @@ public final class TestLinkTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExtraSheetRefs_bug45978() {
|
void testExtraSheetRefs_bug45978() {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45978-extraLinkTableSheets.xls");
|
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45978-extraLinkTableSheets.xls");
|
||||||
/*
|
/*
|
||||||
ex45978-extraLinkTableSheets.xls is a cut-down version of attachment 22561.
|
ex45978-extraLinkTableSheets.xls is a cut-down version of attachment 22561.
|
||||||
|
@ -121,7 +121,7 @@ public final class TestLinkTable {
|
||||||
* when reading the workbook of attachment 23468 from bugzilla 47001
|
* when reading the workbook of attachment 23468 from bugzilla 47001
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMissingExternSheetRecord_bug47001b() {
|
void testMissingExternSheetRecord_bug47001b() {
|
||||||
|
|
||||||
Record[] recs = {
|
Record[] recs = {
|
||||||
SupBookRecord.createAddInFunctions(),
|
SupBookRecord.createAddInFunctions(),
|
||||||
|
@ -136,7 +136,7 @@ public final class TestLinkTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNameCommentRecordBetweenNameRecords() {
|
void testNameCommentRecordBetweenNameRecords() {
|
||||||
|
|
||||||
final Record[] recs = {
|
final Record[] recs = {
|
||||||
new NameRecord(),
|
new NameRecord(),
|
||||||
|
@ -160,7 +160,7 @@ public final class TestLinkTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddNameX(){
|
void testAddNameX(){
|
||||||
WorkbookRecordList wrl = new WorkbookRecordList();
|
WorkbookRecordList wrl = new WorkbookRecordList();
|
||||||
wrl.add(0, new BOFRecord());
|
wrl.add(0, new BOFRecord());
|
||||||
wrl.add(1, new CountryRecord());
|
wrl.add(1, new CountryRecord());
|
||||||
|
|
|
@ -46,7 +46,7 @@ public final class TestOperandClassTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMdeterm() {
|
void testMdeterm() {
|
||||||
String formula = "MDETERM(ABS(A1))";
|
String formula = "MDETERM(ABS(A1))";
|
||||||
Ptg[] ptgs = parseFormula(formula);
|
Ptg[] ptgs = parseFormula(formula);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public final class TestOperandClassTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMdetermReturnsValueInvalidOnABlankCell() {
|
void testMdetermReturnsValueInvalidOnABlankCell() {
|
||||||
ValueEval matrixRef = EvalFactory.createAreaEval("A1:B2",
|
ValueEval matrixRef = EvalFactory.createAreaEval("A1:B2",
|
||||||
new ValueEval[]{
|
new ValueEval[]{
|
||||||
BlankEval.instance,
|
BlankEval.instance,
|
||||||
|
@ -80,7 +80,7 @@ public final class TestOperandClassTransformer {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@Disabled
|
@Disabled
|
||||||
public void testIndexPi1() {
|
void testIndexPi1() {
|
||||||
String formula = "INDEX(PI(),1)";
|
String formula = "INDEX(PI(),1)";
|
||||||
Ptg[] ptgs = parseFormula(formula);
|
Ptg[] ptgs = parseFormula(formula);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public final class TestOperandClassTransformer {
|
||||||
* value operator it must get type V
|
* value operator it must get type V
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDirectOperandOfValueOperator() {
|
void testDirectOperandOfValueOperator() {
|
||||||
String formula = "COUNT(A1*1)";
|
String formula = "COUNT(A1*1)";
|
||||||
Ptg[] ptgs = parseFormula(formula);
|
Ptg[] ptgs = parseFormula(formula);
|
||||||
assertNotEquals(Ptg.CLASS_REF, ptgs[0].getPtgClass());
|
assertNotEquals(Ptg.CLASS_REF, ptgs[0].getPtgClass());
|
||||||
|
@ -105,7 +105,7 @@ public final class TestOperandClassTransformer {
|
||||||
* A cell ref passed to a function expecting type V should be converted to type V
|
* A cell ref passed to a function expecting type V should be converted to type V
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRtoV() {
|
void testRtoV() {
|
||||||
|
|
||||||
String formula = "lookup(A1, A3:A52, B3:B52)";
|
String formula = "lookup(A1, A3:A52, B3:B52)";
|
||||||
Ptg[] ptgs = parseFormula(formula);
|
Ptg[] ptgs = parseFormula(formula);
|
||||||
|
@ -113,7 +113,7 @@ public final class TestOperandClassTransformer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testComplexIRR_bug45041() {
|
void testComplexIRR_bug45041() {
|
||||||
String formula = "(1+IRR(SUMIF(A:A,ROW(INDIRECT(MIN(A:A)&\":\"&MAX(A:A))),B:B),0))^365-1";
|
String formula = "(1+IRR(SUMIF(A:A,ROW(INDIRECT(MIN(A:A)&\":\"&MAX(A:A))),B:B),0))^365-1";
|
||||||
Ptg[] ptgs = parseFormula(formula);
|
Ptg[] ptgs = parseFormula(formula);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestRowBlocksReader {
|
public final class TestRowBlocksReader {
|
||||||
@Test
|
@Test
|
||||||
public void testAbnormalPivotTableRecords_bug46280() {
|
void testAbnormalPivotTableRecords_bug46280() {
|
||||||
int SXVIEW_SID = ViewDefinitionRecord.sid;
|
int SXVIEW_SID = ViewDefinitionRecord.sid;
|
||||||
Record[] inRecs = {
|
Record[] inRecs = {
|
||||||
new RowRecord(0),
|
new RowRecord(0),
|
||||||
|
|
|
@ -56,7 +56,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateSheet() {
|
void testCreateSheet() {
|
||||||
// Check we're adding row and cell aggregates
|
// Check we're adding row and cell aggregates
|
||||||
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
||||||
records.add(BOFRecord.createSheetBOF());
|
records.add(BOFRecord.createSheetBOF());
|
||||||
|
@ -105,7 +105,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddMergedRegion() {
|
void testAddMergedRegion() {
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
final int regionsToAdd = 4096;
|
final int regionsToAdd = 4096;
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRemoveMergedRegion() {
|
void testRemoveMergedRegion() {
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
int regionsToAdd = 4096;
|
int regionsToAdd = 4096;
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public final class TestSheet {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMovingMergedRegion() {
|
void testMovingMergedRegion() {
|
||||||
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
||||||
|
|
||||||
CellRangeAddress[] cras = {
|
CellRangeAddress[] cras = {
|
||||||
|
@ -197,12 +197,12 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
// public void testGetMergedRegionAt() {
|
// void testGetMergedRegionAt() {
|
||||||
// TODO
|
// TODO
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// @Test
|
// @Test
|
||||||
// public void testGetNumMergedRegions() {
|
// void testGetNumMergedRegions() {
|
||||||
// TODO
|
// TODO
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ public final class TestSheet {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRowAggregation() {
|
void testRowAggregation() {
|
||||||
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
||||||
|
|
||||||
records.add(InternalSheet.createBOF());
|
records.add(InternalSheet.createBOF());
|
||||||
|
@ -235,7 +235,7 @@ public final class TestSheet {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRowPageBreaks() {
|
void testRowPageBreaks() {
|
||||||
short colFrom = 0;
|
short colFrom = 0;
|
||||||
short colTo = 255;
|
short colTo = 255;
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ public final class TestSheet {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testColPageBreaks() {
|
void testColPageBreaks() {
|
||||||
short rowFrom = 0;
|
short rowFrom = 0;
|
||||||
short rowTo = (short)65535;
|
short rowTo = (short)65535;
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ public final class TestSheet {
|
||||||
* works as designed.
|
* works as designed.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testXFIndexForColumn() {
|
void testXFIndexForColumn() {
|
||||||
final short TEST_IDX = 10;
|
final short TEST_IDX = 10;
|
||||||
final short DEFAULT_IDX = 0xF; // 15
|
final short DEFAULT_IDX = 0xF; // 15
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
|
@ -422,7 +422,7 @@ public final class TestSheet {
|
||||||
* when an <tt>UncalcedRecord</tt> was present.<p>
|
* when an <tt>UncalcedRecord</tt> was present.<p>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUncalcSize_bug45066() {
|
void testUncalcSize_bug45066() {
|
||||||
|
|
||||||
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
List<org.apache.poi.hssf.record.Record> records = new ArrayList<>();
|
||||||
records.add(BOFRecord.createSheetBOF());
|
records.add(BOFRecord.createSheetBOF());
|
||||||
|
@ -455,7 +455,7 @@ public final class TestSheet {
|
||||||
* The code here represents a normal POI use case where a spreadsheet is created from scratch.
|
* The code here represents a normal POI use case where a spreadsheet is created from scratch.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRowValueAggregatesOrder_bug45145() {
|
void testRowValueAggregatesOrder_bug45145() {
|
||||||
|
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ public final class TestSheet {
|
||||||
* which in turn got the dimensions record out of alignment
|
* which in turn got the dimensions record out of alignment
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGutsRecord_bug45640() {
|
void testGutsRecord_bug45640() {
|
||||||
|
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
sheet.addRow(new RowRecord(0));
|
sheet.addRow(new RowRecord(0));
|
||||||
|
@ -533,7 +533,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMisplacedMergedCellsRecords_bug45699() throws Exception {
|
void testMisplacedMergedCellsRecords_bug45699() throws Exception {
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45698-22488.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex45698-22488.xls")) {
|
||||||
HSSFSheet sheet = wb.getSheetAt(0);
|
HSSFSheet sheet = wb.getSheetAt(0);
|
||||||
HSSFRow row = sheet.getRow(3);
|
HSSFRow row = sheet.getRow(3);
|
||||||
|
@ -546,7 +546,7 @@ public final class TestSheet {
|
||||||
* In 3.1, setting margins between creating first row and first cell caused an exception.
|
* In 3.1, setting margins between creating first row and first cell caused an exception.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSetMargins_bug45717() throws Exception {
|
void testSetMargins_bug45717() throws Exception {
|
||||||
HSSFWorkbook workbook = new HSSFWorkbook();
|
HSSFWorkbook workbook = new HSSFWorkbook();
|
||||||
HSSFSheet sheet = workbook.createSheet("Vorschauliste");
|
HSSFSheet sheet = workbook.createSheet("Vorschauliste");
|
||||||
HSSFRow row = sheet.createRow(0);
|
HSSFRow row = sheet.createRow(0);
|
||||||
|
@ -569,7 +569,7 @@ public final class TestSheet {
|
||||||
* Excel(2007) tolerates this, so POI should too.
|
* Excel(2007) tolerates this, so POI should too.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMissingDims() {
|
void testMissingDims() {
|
||||||
|
|
||||||
int rowIx = 5;
|
int rowIx = 5;
|
||||||
int colIx = 6;
|
int colIx = 6;
|
||||||
|
@ -604,7 +604,7 @@ public final class TestSheet {
|
||||||
* and since there is a slight performance hit the fix was made to avoid it.
|
* and since there is a slight performance hit the fix was made to avoid it.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testShiftFormulasAddCondFormat_bug46547() {
|
void testShiftFormulasAddCondFormat_bug46547() {
|
||||||
// Create a sheet with data validity (similar to bugzilla attachment id=23131).
|
// Create a sheet with data validity (similar to bugzilla attachment id=23131).
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ public final class TestSheet {
|
||||||
* which already had data validity constraints.
|
* which already had data validity constraints.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAddCondFormatAfterDataValidation_bug46547() {
|
void testAddCondFormatAfterDataValidation_bug46547() {
|
||||||
// Create a sheet with data validity (similar to bugzilla attachment id=23131).
|
// Create a sheet with data validity (similar to bugzilla attachment id=23131).
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
sheet.getOrCreateDataValidityTable();
|
sheet.getOrCreateDataValidityTable();
|
||||||
|
@ -632,7 +632,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCloneMulBlank_bug46776() {
|
void testCloneMulBlank_bug46776() {
|
||||||
org.apache.poi.hssf.record.Record[] recs = {
|
org.apache.poi.hssf.record.Record[] recs = {
|
||||||
InternalSheet.createBOF(),
|
InternalSheet.createBOF(),
|
||||||
new DimensionsRecord(),
|
new DimensionsRecord(),
|
||||||
|
@ -654,7 +654,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAggregate() {
|
void testCreateAggregate() {
|
||||||
String msoDrawingRecord1 =
|
String msoDrawingRecord1 =
|
||||||
"0F 00 02 F0 20 01 00 00 10 00 08 F0 08 00 00 00 \n" +
|
"0F 00 02 F0 20 01 00 00 10 00 08 F0 08 00 00 00 \n" +
|
||||||
"03 00 00 00 02 04 00 00 0F 00 03 F0 08 01 00 00 \n" +
|
"03 00 00 00 02 04 00 00 0F 00 03 F0 08 01 00 00 \n" +
|
||||||
|
@ -742,7 +742,7 @@ public final class TestSheet {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSheetDimensions() {
|
void testSheetDimensions() {
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
DimensionsRecord dimensions = (DimensionsRecord)sheet.findFirstRecordBySid(DimensionsRecord.sid);
|
DimensionsRecord dimensions = (DimensionsRecord)sheet.findFirstRecordBySid(DimensionsRecord.sid);
|
||||||
assertNotNull(dimensions);
|
assertNotNull(dimensions);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestSheetAdditional {
|
public final class TestSheetAdditional {
|
||||||
@Test
|
@Test
|
||||||
public void testGetCellWidth() {
|
void testGetCellWidth() {
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
ColumnInfoRecord nci = new ColumnInfoRecord();
|
ColumnInfoRecord nci = new ColumnInfoRecord();
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public final class TestSheetAdditional {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMaxColumnWidth() {
|
void testMaxColumnWidth() {
|
||||||
InternalSheet sheet = InternalSheet.createSheet();
|
InternalSheet sheet = InternalSheet.createSheet();
|
||||||
// the limit
|
// the limit
|
||||||
sheet.setColumnWidth(0, 255*256);
|
sheet.setColumnWidth(0, 255*256);
|
||||||
|
|
|
@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestWorkbook {
|
public final class TestWorkbook {
|
||||||
@Test
|
@Test
|
||||||
public void testFontStuff() throws IOException {
|
void testFontStuff() throws IOException {
|
||||||
HSSFWorkbook hwb = new HSSFWorkbook();
|
HSSFWorkbook hwb = new HSSFWorkbook();
|
||||||
InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb);
|
InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb);
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ public final class TestWorkbook {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAddNameX() throws IOException {
|
void testAddNameX() throws IOException {
|
||||||
HSSFWorkbook hwb = new HSSFWorkbook();
|
HSSFWorkbook hwb = new HSSFWorkbook();
|
||||||
InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb);
|
InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(hwb);
|
||||||
assertNotNull(wb.getNameXPtg("ISODD", AggregatingUDFFinder.DEFAULT));
|
assertNotNull(wb.getNameXPtg("ISODD", AggregatingUDFFinder.DEFAULT));
|
||||||
|
@ -128,7 +128,7 @@ public final class TestWorkbook {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRecalcId() throws IOException {
|
void testRecalcId() throws IOException {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
assertFalse(wb.getForceFormulaRecalculation());
|
assertFalse(wb.getForceFormulaRecalculation());
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ public final class TestWorkbook {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWriteAccess() {
|
void testWriteAccess() {
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
InternalWorkbook iwb = TestHSSFWorkbook.getInternalWorkbook(wb);
|
InternalWorkbook iwb = TestHSSFWorkbook.getInternalWorkbook(wb);
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestArrayRecord {
|
public final class TestArrayRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
String hex =
|
String hex =
|
||||||
"21 02 25 00 01 00 01 00 01 01 00 00 00 00 00 00 " +
|
"21 02 25 00 01 00 01 00 01 01 00 00 00 00 00 00 " +
|
||||||
"17 00 65 00 00 01 00 02 C0 02 C0 65 00 00 01 00 " +
|
"17 00 65 00 00 01 00 02 C0 02 C0 65 00 00 01 00 " +
|
||||||
|
@ -62,7 +62,7 @@ public final class TestArrayRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug57231() {
|
void testBug57231() {
|
||||||
HSSFWorkbook wb = HSSFTestDataSamples
|
HSSFWorkbook wb = HSSFTestDataSamples
|
||||||
.openSampleWorkbook("57231_MixedGasReport.xls");
|
.openSampleWorkbook("57231_MixedGasReport.xls");
|
||||||
HSSFSheet sheet = wb.getSheet("master");
|
HSSFSheet sheet = wb.getSheet("master");
|
||||||
|
|
|
@ -31,7 +31,7 @@ public final class TestAutoFilterInfoRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
|
|
||||||
AutoFilterInfoRecord record = new AutoFilterInfoRecord(TestcaseRecordInputStream.create(AutoFilterInfoRecord.sid, data));
|
AutoFilterInfoRecord record = new AutoFilterInfoRecord(TestcaseRecordInputStream.create(AutoFilterInfoRecord.sid, data));
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public final class TestAutoFilterInfoRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrite() {
|
void testWrite() {
|
||||||
AutoFilterInfoRecord record = new AutoFilterInfoRecord();
|
AutoFilterInfoRecord record = new AutoFilterInfoRecord();
|
||||||
record.setNumEntries((short)3);
|
record.setNumEntries((short)3);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public final class TestAutoFilterInfoRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClone()
|
void testClone()
|
||||||
{
|
{
|
||||||
AutoFilterInfoRecord record = new AutoFilterInfoRecord();
|
AutoFilterInfoRecord record = new AutoFilterInfoRecord();
|
||||||
record.setNumEntries((short)3);
|
record.setNumEntries((short)3);
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestBOFRecord {
|
public final class TestBOFRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testBOFRecord() throws IOException {
|
void testBOFRecord() throws IOException {
|
||||||
// This used to throw an error before - #42794
|
// This used to throw an error before - #42794
|
||||||
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("bug_42794.xls")) {
|
try (HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("bug_42794.xls")) {
|
||||||
Sheet sh = wb.getSheetAt(0);
|
Sheet sh = wb.getSheetAt(0);
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestBoolErrRecord {
|
public final class TestBoolErrRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testError() {
|
void testError() {
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"00 00 00 00 0F 00 " + // row, col, xfIndex
|
"00 00 00 00 0F 00 " + // row, col, xfIndex
|
||||||
"07 01 " // #DIV/0!, isError
|
"07 01 " // #DIV/0!, isError
|
||||||
|
@ -54,7 +54,7 @@ public final class TestBoolErrRecord {
|
||||||
* work by the same coincidence).
|
* work by the same coincidence).
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testOooBadFormat_bug47479() {
|
void testOooBadFormat_bug47479() {
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"05 02 09 00 " + // sid, size
|
"05 02 09 00 " + // sid, size
|
||||||
"00 00 00 00 0F 00 " + // row, col, xfIndex
|
"00 00 00 00 0F 00 " + // row, col, xfIndex
|
||||||
|
|
|
@ -35,25 +35,25 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestBoundSheetRecord {
|
public final class TestBoundSheetRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRecordLength() {
|
void testRecordLength() {
|
||||||
BoundSheetRecord record = new BoundSheetRecord("Sheet1");
|
BoundSheetRecord record = new BoundSheetRecord("Sheet1");
|
||||||
assertEquals(18, record.getRecordSize());
|
assertEquals(18, record.getRecordSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWideRecordLength() {
|
void testWideRecordLength() {
|
||||||
BoundSheetRecord record = new BoundSheetRecord("Sheet\u20ac");
|
BoundSheetRecord record = new BoundSheetRecord("Sheet\u20ac");
|
||||||
assertEquals(24, record.getRecordSize());
|
assertEquals(24, record.getRecordSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testName() {
|
void testName() {
|
||||||
BoundSheetRecord record = new BoundSheetRecord("1234567890223456789032345678904");
|
BoundSheetRecord record = new BoundSheetRecord("1234567890223456789032345678904");
|
||||||
assertThrows(IllegalArgumentException.class, () -> record.setSheetname("s//*s"));
|
assertThrows(IllegalArgumentException.class, () -> record.setSheetname("s//*s"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDeserializeUnicode() {
|
void testDeserializeUnicode() {
|
||||||
|
|
||||||
byte[] data = HexRead.readFromString(""
|
byte[] data = HexRead.readFromString(""
|
||||||
+ "85 00 1A 00" // sid, length
|
+ "85 00 1A 00" // sid, length
|
||||||
|
@ -76,7 +76,7 @@ public final class TestBoundSheetRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testOrdering() {
|
void testOrdering() {
|
||||||
BoundSheetRecord bs1 = new BoundSheetRecord("SheetB");
|
BoundSheetRecord bs1 = new BoundSheetRecord("SheetB");
|
||||||
BoundSheetRecord bs2 = new BoundSheetRecord("SheetC");
|
BoundSheetRecord bs2 = new BoundSheetRecord("SheetC");
|
||||||
BoundSheetRecord bs3 = new BoundSheetRecord("SheetA");
|
BoundSheetRecord bs3 = new BoundSheetRecord("SheetA");
|
||||||
|
@ -97,7 +97,7 @@ public final class TestBoundSheetRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testValidNames() {
|
void testValidNames() {
|
||||||
assertTrue(isValid("Sheet1"));
|
assertTrue(isValid("Sheet1"));
|
||||||
assertTrue(isValid("O'Brien's sales"));
|
assertTrue(isValid("O'Brien's sales"));
|
||||||
assertTrue(isValid(" data # "));
|
assertTrue(isValid(" data # "));
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestCFHeaderRecord {
|
public final class TestCFHeaderRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCFHeaderRecord () {
|
void testCreateCFHeaderRecord () {
|
||||||
CFHeaderRecord record = new CFHeaderRecord();
|
CFHeaderRecord record = new CFHeaderRecord();
|
||||||
CellRangeAddress[] ranges = {
|
CellRangeAddress[] ranges = {
|
||||||
new CellRangeAddress(0,0xFFFF,5,5),
|
new CellRangeAddress(0,0xFFFF,5,5),
|
||||||
|
@ -64,7 +64,7 @@ public final class TestCFHeaderRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCFHeader12Record () {
|
void testCreateCFHeader12Record () {
|
||||||
CFHeader12Record record = new CFHeader12Record();
|
CFHeader12Record record = new CFHeader12Record();
|
||||||
CellRangeAddress[] ranges = {
|
CellRangeAddress[] ranges = {
|
||||||
new CellRangeAddress(0,0xFFFF,5,5),
|
new CellRangeAddress(0,0xFFFF,5,5),
|
||||||
|
@ -97,7 +97,7 @@ public final class TestCFHeaderRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialization() {
|
void testSerialization() {
|
||||||
byte[] recordData =
|
byte[] recordData =
|
||||||
{
|
{
|
||||||
(byte)0x03, (byte)0x00,
|
(byte)0x03, (byte)0x00,
|
||||||
|
@ -149,7 +149,7 @@ public final class TestCFHeaderRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExtremeRows() {
|
void testExtremeRows() {
|
||||||
byte[] recordData = {
|
byte[] recordData = {
|
||||||
(byte)0x13, (byte)0x00, // nFormats
|
(byte)0x13, (byte)0x00, // nFormats
|
||||||
(byte)0x00, (byte)0x00,
|
(byte)0x00, (byte)0x00,
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestCFRuleRecord {
|
public final class TestCFRuleRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testConstructors () throws IOException {
|
void testConstructors () throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public final class TestCFRuleRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCFRuleRecord() throws IOException {
|
void testCreateCFRuleRecord() throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
CFRuleRecord record = CFRuleRecord.create(sheet, "7");
|
CFRuleRecord record = CFRuleRecord.create(sheet, "7");
|
||||||
|
@ -99,7 +99,7 @@ public final class TestCFRuleRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testCreateCFRule12Record() throws IOException {
|
void testCreateCFRule12Record() throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
CFRule12Record record = CFRule12Record.create(sheet, "7");
|
CFRule12Record record = CFRule12Record.create(sheet, "7");
|
||||||
|
@ -121,7 +121,7 @@ public final class TestCFRuleRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateIconCFRule12Record() throws IOException {
|
void testCreateIconCFRule12Record() throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
CFRule12Record record = CFRule12Record.create(sheet, IconSet.GREY_5_ARROWS);
|
CFRule12Record record = CFRule12Record.create(sheet, IconSet.GREY_5_ARROWS);
|
||||||
|
@ -372,7 +372,7 @@ public final class TestCFRuleRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrite() throws IOException {
|
void testWrite() throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
CFRuleRecord rr = CFRuleRecord.create(sheet, ComparisonOperator.BETWEEN, "5", "10");
|
CFRuleRecord rr = CFRuleRecord.create(sheet, ComparisonOperator.BETWEEN, "5", "10");
|
||||||
|
@ -410,7 +410,7 @@ public final class TestCFRuleRecord {
|
||||||
* tRefN and tAreaN tokens must be preserved when re-serializing conditional format formulas
|
* tRefN and tAreaN tokens must be preserved when re-serializing conditional format formulas
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReserializeRefNTokens() {
|
void testReserializeRefNTokens() {
|
||||||
|
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(CFRuleRecord.sid, DATA_REFN);
|
RecordInputStream is = TestcaseRecordInputStream.create(CFRuleRecord.sid, DATA_REFN);
|
||||||
CFRuleRecord rr = new CFRuleRecord(is);
|
CFRuleRecord rr = new CFRuleRecord(is);
|
||||||
|
@ -427,7 +427,7 @@ public final class TestCFRuleRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug53691() throws IOException {
|
void testBug53691() throws IOException {
|
||||||
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
try (HSSFWorkbook workbook = new HSSFWorkbook()) {
|
||||||
HSSFSheet sheet = workbook.createSheet();
|
HSSFSheet sheet = workbook.createSheet();
|
||||||
|
|
||||||
|
@ -442,7 +442,7 @@ public final class TestCFRuleRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug57231_rewrite() throws IOException {
|
void testBug57231_rewrite() throws IOException {
|
||||||
try (HSSFWorkbook wb1 = HSSFITestDataProvider.instance.openSampleWorkbook("57231_MixedGasReport.xls")) {
|
try (HSSFWorkbook wb1 = HSSFITestDataProvider.instance.openSampleWorkbook("57231_MixedGasReport.xls")) {
|
||||||
assertEquals(7, wb1.getNumberOfSheets());
|
assertEquals(7, wb1.getNumberOfSheets());
|
||||||
try (HSSFWorkbook wb2 = HSSFITestDataProvider.instance.writeOutAndReadBack(wb1)) {
|
try (HSSFWorkbook wb2 = HSSFITestDataProvider.instance.writeOutAndReadBack(wb1)) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestColumnInfoRecord {
|
public final class TestColumnInfoRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasic() {
|
void testBasic() {
|
||||||
byte[] data = HexRead.readFromString("7D 00 0C 00 14 00 9B 00 C7 19 0F 00 01 13 00 00");
|
byte[] data = HexRead.readFromString("7D 00 0C 00 14 00 9B 00 C7 19 0F 00 01 13 00 00");
|
||||||
|
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(data);
|
RecordInputStream in = TestcaseRecordInputStream.create(data);
|
||||||
|
@ -53,7 +53,7 @@ public final class TestColumnInfoRecord {
|
||||||
* Excel reads that file OK and assumes zero for the value of the reserved field.
|
* Excel reads that file OK and assumes zero for the value of the reserved field.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testZeroResevedBytes_bug48332() {
|
void testZeroResevedBytes_bug48332() {
|
||||||
// Taken from bugzilla attachment 24661 (offset 0x1E73)
|
// Taken from bugzilla attachment 24661 (offset 0x1E73)
|
||||||
byte[] inpData = HexRead.readFromString("7D 00 0A 00 00 00 00 00 D5 19 0F 00 02 00");
|
byte[] inpData = HexRead.readFromString("7D 00 0A 00 00 00 00 00 D5 19 0F 00 02 00");
|
||||||
byte[] outData = HexRead.readFromString("7D 00 0C 00 00 00 00 00 D5 19 0F 00 02 00 00 00");
|
byte[] outData = HexRead.readFromString("7D 00 0C 00 00 00 00 00 D5 19 0F 00 02 00 00 00");
|
||||||
|
@ -71,7 +71,7 @@ public final class TestColumnInfoRecord {
|
||||||
* but this seems to cause no problem to Excel
|
* but this seems to cause no problem to Excel
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testOneReservedByte() {
|
void testOneReservedByte() {
|
||||||
byte[] inpData = HexRead.readFromString("7D 00 0B 00 00 00 00 00 24 02 0F 00 00 00 01");
|
byte[] inpData = HexRead.readFromString("7D 00 0B 00 00 00 00 00 24 02 0F 00 00 00 01");
|
||||||
byte[] outData = HexRead.readFromString("7D 00 0C 00 00 00 00 00 24 02 0F 00 00 00 01 00");
|
byte[] outData = HexRead.readFromString("7D 00 0C 00 00 00 00 00 24 02 0F 00 00 00 01 00");
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(inpData);
|
RecordInputStream in = TestcaseRecordInputStream.create(inpData);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public final class TestCommonObjectDataSubRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
CommonObjectDataSubRecord record = new CommonObjectDataSubRecord(TestcaseRecordInputStream.createLittleEndian(data), data.length);
|
CommonObjectDataSubRecord record = new CommonObjectDataSubRecord(TestcaseRecordInputStream.createLittleEndian(data), data.length);
|
||||||
|
|
||||||
assertEquals( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX, record.getObjectType());
|
assertEquals( CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX, record.getObjectType());
|
||||||
|
@ -58,7 +58,7 @@ public final class TestCommonObjectDataSubRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
CommonObjectDataSubRecord record = new CommonObjectDataSubRecord();
|
CommonObjectDataSubRecord record = new CommonObjectDataSubRecord();
|
||||||
|
|
||||||
record.setObjectType(CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX);
|
record.setObjectType(CommonObjectDataSubRecord.OBJECT_TYPE_LIST_BOX);
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class TestDConRefRecord {
|
||||||
* various flavours. This uses the RecordInputStream constructor.
|
* various flavours. This uses the RecordInputStream constructor.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteSBExtRef() throws IOException {
|
void testReadWriteSBExtRef() throws IOException {
|
||||||
testReadWrite(data1, "read-write single-byte external reference, volume type path");
|
testReadWrite(data1, "read-write single-byte external reference, volume type path");
|
||||||
testReadWrite(volumeString,
|
testReadWrite(volumeString,
|
||||||
"read-write properly formed single-byte external reference, volume type path");
|
"read-write properly formed single-byte external reference, volume type path");
|
||||||
|
@ -202,7 +202,7 @@ public class TestDConRefRecord {
|
||||||
* string
|
* string
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteDBExtRefUncVol() throws IOException {
|
void testReadWriteDBExtRefUncVol() throws IOException {
|
||||||
testReadWrite(data4, "read-write double-byte external reference, UNC volume type path");
|
testReadWrite(data4, "read-write double-byte external reference, UNC volume type path");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ public class TestDConRefRecord {
|
||||||
* test read-constructor-then-serialize for a double-byte self-reference style string
|
* test read-constructor-then-serialize for a double-byte self-reference style string
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteDBSelfRef() throws IOException {
|
void testReadWriteDBSelfRef() throws IOException {
|
||||||
testReadWrite(data2, "read-write double-byte self reference");
|
testReadWrite(data2, "read-write double-byte self reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ public class TestDConRefRecord {
|
||||||
* test read-constructor-then-serialize for a single-byte self-reference style string
|
* test read-constructor-then-serialize for a single-byte self-reference style string
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteSBSelfRef() throws IOException {
|
void testReadWriteSBSelfRef() throws IOException {
|
||||||
testReadWrite(data3, "read-write single byte self reference");
|
testReadWrite(data3, "read-write single byte self reference");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ public class TestDConRefRecord {
|
||||||
* Test of getDataSize method, of class DConRefRecord.
|
* Test of getDataSize method, of class DConRefRecord.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetDataSize() {
|
void testGetDataSize() {
|
||||||
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
||||||
int expResult = data1.length;
|
int expResult = data1.length;
|
||||||
int result = instance.getDataSize();
|
int result = instance.getDataSize();
|
||||||
|
@ -255,7 +255,7 @@ public class TestDConRefRecord {
|
||||||
* Test of getSid method, of class DConRefRecord.
|
* Test of getSid method, of class DConRefRecord.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSid() {
|
void testGetSid() {
|
||||||
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
||||||
short expResult = 81;
|
short expResult = 81;
|
||||||
short result = instance.getSid();
|
short result = instance.getSid();
|
||||||
|
@ -266,7 +266,7 @@ public class TestDConRefRecord {
|
||||||
* Test of getPath method, of class DConRefRecord.
|
* Test of getPath method, of class DConRefRecord.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetPath() {
|
void testGetPath() {
|
||||||
// TODO: different types of paths.
|
// TODO: different types of paths.
|
||||||
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
||||||
byte[] expResult = Arrays.copyOfRange(data1, 9, data1.length);
|
byte[] expResult = Arrays.copyOfRange(data1, 9, data1.length);
|
||||||
|
@ -278,7 +278,7 @@ public class TestDConRefRecord {
|
||||||
* Test of isExternalRef method, of class DConRefRecord.
|
* Test of isExternalRef method, of class DConRefRecord.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIsExternalRef() {
|
void testIsExternalRef() {
|
||||||
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
DConRefRecord instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data1));
|
||||||
assertTrue(instance.isExternalRef(), "external reference");
|
assertTrue(instance.isExternalRef(), "external reference");
|
||||||
instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data2));
|
instance = new DConRefRecord(TestcaseRecordInputStream.create(81, data2));
|
||||||
|
|
|
@ -27,7 +27,7 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
public final class TestDVALRecord {
|
public final class TestDVALRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
byte[] data = new byte[22];
|
byte[] data = new byte[22];
|
||||||
LittleEndian.putShort(data, 0, DVALRecord.sid);
|
LittleEndian.putShort(data, 0, DVALRecord.sid);
|
||||||
LittleEndian.putShort(data, 2, (short)18);
|
LittleEndian.putShort(data, 2, (short)18);
|
||||||
|
|
|
@ -30,7 +30,7 @@ public final class TestDrawingGroupRecord {
|
||||||
private static final int MAX_DATA_SIZE = MAX_RECORD_SIZE - 4;
|
private static final int MAX_DATA_SIZE = MAX_RECORD_SIZE - 4;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetRecordSize() {
|
void testGetRecordSize() {
|
||||||
DrawingGroupRecord r = new DrawingGroupRecord();
|
DrawingGroupRecord r = new DrawingGroupRecord();
|
||||||
assertEquals(4, r.getRecordSize());
|
assertEquals(4, r.getRecordSize());
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public final class TestDrawingGroupRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
// Check under max record size
|
// Check under max record size
|
||||||
DrawingGroupRecord r = new DrawingGroupRecord();
|
DrawingGroupRecord r = new DrawingGroupRecord();
|
||||||
byte[] rawData = new byte[100];
|
byte[] rawData = new byte[100];
|
||||||
|
@ -118,7 +118,7 @@ public final class TestDrawingGroupRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGrossSizeFromDataSize() {
|
void testGrossSizeFromDataSize() {
|
||||||
assertEquals( 4, DrawingGroupRecord.grossSizeFromDataSize( 0 ) );
|
assertEquals( 4, DrawingGroupRecord.grossSizeFromDataSize( 0 ) );
|
||||||
assertEquals( 5, DrawingGroupRecord.grossSizeFromDataSize( 1 ) );
|
assertEquals( 5, DrawingGroupRecord.grossSizeFromDataSize( 1 ) );
|
||||||
assertEquals( MAX_RECORD_SIZE, DrawingGroupRecord.grossSizeFromDataSize( MAX_DATA_SIZE ) );
|
assertEquals( MAX_RECORD_SIZE, DrawingGroupRecord.grossSizeFromDataSize( MAX_DATA_SIZE ) );
|
||||||
|
|
|
@ -36,7 +36,7 @@ public final class TestDrawingRecord {
|
||||||
* See Bugzilla #47548
|
* See Bugzilla #47548
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testReadContinued() throws IOException {
|
void testReadContinued() throws IOException {
|
||||||
|
|
||||||
//simulate a continues drawing record
|
//simulate a continues drawing record
|
||||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||||
|
|
|
@ -33,7 +33,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||||
private static final short EORSR_SID = EmbeddedObjectRefSubRecord.sid;
|
private static final short EORSR_SID = EmbeddedObjectRefSubRecord.sid;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
String data1
|
String data1
|
||||||
= "20 00 05 00 FC 10 76 01 02 24 14 DF 00 03 10 00 "
|
= "20 00 05 00 FC 10 76 01 02 24 14 DF 00 03 10 00 "
|
||||||
+ "00 46 6F 72 6D 73 2E 43 68 65 63 6B 42 6F 78 2E "
|
+ "00 46 6F 72 6D 73 2E 43 68 65 63 6B 42 6F 78 2E "
|
||||||
|
@ -58,7 +58,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() {
|
void testCreate() {
|
||||||
EmbeddedObjectRefSubRecord record1 = new EmbeddedObjectRefSubRecord();
|
EmbeddedObjectRefSubRecord record1 = new EmbeddedObjectRefSubRecord();
|
||||||
|
|
||||||
byte[] ser = record1.serialize();
|
byte[] ser = record1.serialize();
|
||||||
|
@ -74,7 +74,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testCameraTool_bug45912() {
|
void testCameraTool_bug45912() {
|
||||||
/*
|
/*
|
||||||
* taken from ftPictFmla sub-record in attachment 22645 (offset 0x40AB).
|
* taken from ftPictFmla sub-record in attachment 22645 (offset 0x40AB).
|
||||||
*/
|
*/
|
||||||
|
@ -98,7 +98,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testVarious() {
|
void testVarious() {
|
||||||
String[] rawData = {
|
String[] rawData = {
|
||||||
"12 00 0B 00 70 95 0B 05 3B 01 00 36 00 40 00 18 00 19 00 18",
|
"12 00 0B 00 70 95 0B 05 3B 01 00 36 00 40 00 18 00 19 00 18",
|
||||||
"12 00 0B 00 B0 4D 3E 03 3B 00 00 00 00 01 00 00 80 01 C0 00",
|
"12 00 0B 00 B0 4D 3E 03 3B 00 00 00 00 01 00 00 80 01 C0 00",
|
||||||
|
@ -132,7 +132,7 @@ public final class TestEmbeddedObjectRefSubRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testVisioDrawing_bug46199() {
|
void testVisioDrawing_bug46199() {
|
||||||
/*
|
/*
|
||||||
* taken from ftPictFmla sub-record in attachment 22860 (stream offset 0x768F).<br>
|
* taken from ftPictFmla sub-record in attachment 22860 (stream offset 0x768F).<br>
|
||||||
* Note that the since the string length is zero, there is no unicode flag byte
|
* Note that the since the string length is zero, there is no unicode flag byte
|
||||||
|
|
|
@ -30,13 +30,13 @@ public final class TestEndSubRecord {
|
||||||
private static final byte[] data = { };
|
private static final byte[] data = { };
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
EndSubRecord record = new EndSubRecord(TestcaseRecordInputStream.create(0x00, data), 0);
|
EndSubRecord record = new EndSubRecord(TestcaseRecordInputStream.create(0x00, data), 0);
|
||||||
assertEquals(0, record.getDataSize());
|
assertEquals(0, record.getDataSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
EndSubRecord record = new EndSubRecord();
|
EndSubRecord record = new EndSubRecord();
|
||||||
byte [] recordBytes = record.serialize();
|
byte [] recordBytes = record.serialize();
|
||||||
assertEquals(0, recordBytes.length - 4);
|
assertEquals(0, recordBytes.length - 4);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class TestEscherAggregate {
|
||||||
* Tests that the create aggregate method correctly rejoins escher records together.
|
* Tests that the create aggregate method correctly rejoins escher records together.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateAggregate() {
|
void testCreateAggregate() {
|
||||||
String msoDrawingRecord1 =
|
String msoDrawingRecord1 =
|
||||||
"0F 00 02 F0 20 01 00 00 10 00 08 F0 08 00 00 00 \n" +
|
"0F 00 02 F0 20 01 00 00 10 00 08 F0 08 00 00 00 \n" +
|
||||||
"03 00 00 00 02 04 00 00 0F 00 03 F0 08 01 00 00 \n" +
|
"03 00 00 00 02 04 00 00 0F 00 03 F0 08 01 00 00 \n" +
|
||||||
|
@ -85,7 +85,7 @@ public final class TestEscherAggregate {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize() {
|
void testSerialize() {
|
||||||
|
|
||||||
EscherContainerRecord container1 = new EscherContainerRecord();
|
EscherContainerRecord container1 = new EscherContainerRecord();
|
||||||
EscherContainerRecord spContainer1 = new EscherContainerRecord();
|
EscherContainerRecord spContainer1 = new EscherContainerRecord();
|
||||||
|
|
|
@ -32,7 +32,7 @@ public final class TestExtSSTRecord {
|
||||||
* ExtSSTRecord can be continued. Ensure we properly read the continue remainder.
|
* ExtSSTRecord can be continued. Ensure we properly read the continue remainder.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test50967() throws IOException {
|
void test50967() throws IOException {
|
||||||
// hex dump from ISBN_UPD_PL_20100104_1525.xls attached to Bugzilla 50867
|
// hex dump from ISBN_UPD_PL_20100104_1525.xls attached to Bugzilla 50867
|
||||||
byte[] bytes = RawDataUtil.decompress("H4sIAAAAAAAAACWaBbAVxxZF9/jgrkFDcAvu7hrc3d3dLbhrgBDcXR8OwV2CEz" +
|
byte[] bytes = RawDataUtil.decompress("H4sIAAAAAAAAACWaBbAVxxZF9/jgrkFDcAvu7hrc3d3dLbhrgBDcXR8OwV2CEz" +
|
||||||
"RIIFhw+4G/Zqiiqrn3zkyvvc/p7tM976sSp/CVOJIUVVJH2sa022lX0e6OLK0zpE9RpKemdCQav9lSlhhSCldqEEuq7EsbYkuLuGdJHG" +
|
"RIIFhw+4G/Zqiiqrn3zkyvvc/p7tM976sSp/CVOJIUVVJH2sa022lX0e6OLK0zpE9RpKemdCQav9lSlhhSCldqEEuq7EsbYkuLuGdJHG" +
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class TestExtendedFormatRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
ExtendedFormatRecord record = createEFR();
|
ExtendedFormatRecord record = createEFR();
|
||||||
assertEquals(0, record.getFontIndex());
|
assertEquals(0, record.getFontIndex());
|
||||||
assertEquals(0, record.getFormatIndex());
|
assertEquals(0, record.getFormatIndex());
|
||||||
|
@ -59,7 +59,7 @@ public final class TestExtendedFormatRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
// .fontindex = 0
|
// .fontindex = 0
|
||||||
// .formatindex = 0
|
// .formatindex = 0
|
||||||
// .celloptions = fffffff5
|
// .celloptions = fffffff5
|
||||||
|
@ -125,7 +125,7 @@ public final class TestExtendedFormatRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testCloneOnto() {
|
void testCloneOnto() {
|
||||||
ExtendedFormatRecord base = createEFR();
|
ExtendedFormatRecord base = createEFR();
|
||||||
|
|
||||||
ExtendedFormatRecord other = new ExtendedFormatRecord();
|
ExtendedFormatRecord other = new ExtendedFormatRecord();
|
||||||
|
@ -136,7 +136,7 @@ public final class TestExtendedFormatRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRotation() {
|
void testRotation() {
|
||||||
ExtendedFormatRecord record = createEFR();
|
ExtendedFormatRecord record = createEFR();
|
||||||
assertEquals(0, record.getRotation());
|
assertEquals(0, record.getRotation());
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicDeserializeReserialize() {
|
void testBasicDeserializeReserialize() {
|
||||||
|
|
||||||
ExternalNameRecord enr = createSimpleENR(dataFDS);
|
ExternalNameRecord enr = createSimpleENR(dataFDS);
|
||||||
assertEquals("FDS", enr.getText());
|
assertEquals("FDS", enr.getText());
|
||||||
|
@ -62,7 +62,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBasicSize() {
|
void testBasicSize() {
|
||||||
ExternalNameRecord enr = createSimpleENR(dataFDS);
|
ExternalNameRecord enr = createSimpleENR(dataFDS);
|
||||||
assertNotEquals(13, enr.getRecordSize(), "Identified bug 44695");
|
assertNotEquals(13, enr.getRecordSize(), "Identified bug 44695");
|
||||||
assertEquals(17, enr.getRecordSize());
|
assertEquals(17, enr.getRecordSize());
|
||||||
|
@ -71,7 +71,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAutoStdDocName() {
|
void testAutoStdDocName() {
|
||||||
|
|
||||||
ExternalNameRecord enr = createSimpleENR(dataAutoDocName);
|
ExternalNameRecord enr = createSimpleENR(dataAutoDocName);
|
||||||
assertEquals("'191219AW4 Corp,[WORKOUT_PX]'", enr.getText());
|
assertEquals("'191219AW4 Corp,[WORKOUT_PX]'", enr.getText());
|
||||||
|
@ -86,7 +86,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPlainName() {
|
void testPlainName() {
|
||||||
|
|
||||||
ExternalNameRecord enr = createSimpleENR(dataPlainName);
|
ExternalNameRecord enr = createSimpleENR(dataPlainName);
|
||||||
assertEquals("Rate_Date", enr.getText());
|
assertEquals("Rate_Date", enr.getText());
|
||||||
|
@ -101,7 +101,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDDELink_bug47229() {
|
void testDDELink_bug47229() {
|
||||||
/*
|
/*
|
||||||
* Hex dump read directly from text of bugzilla 47229
|
* Hex dump read directly from text of bugzilla 47229
|
||||||
*/
|
*/
|
||||||
|
@ -126,7 +126,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnicodeName_bug47384() {
|
void testUnicodeName_bug47384() {
|
||||||
// data taken from bugzilla 47384 att 23830 at offset 0x13A0
|
// data taken from bugzilla 47384 att 23830 at offset 0x13A0
|
||||||
byte[] dataUN = HexRead.readFromString(
|
byte[] dataUN = HexRead.readFromString(
|
||||||
"23 00 22 00" +
|
"23 00 22 00" +
|
||||||
|
@ -143,7 +143,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test48339() {
|
void test48339() {
|
||||||
// data taken from bugzilla 48339
|
// data taken from bugzilla 48339
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"23 00 09 00" +
|
"23 00 09 00" +
|
||||||
|
@ -156,7 +156,7 @@ public final class TestExternalNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNPEWithFileFrom49219() {
|
void testNPEWithFileFrom49219() {
|
||||||
// the file at test-data/spreadsheet/49219.xls has ExternalNameRecords without actual data,
|
// the file at test-data/spreadsheet/49219.xls has ExternalNameRecords without actual data,
|
||||||
// we did handle this during reading, but failed during serializing this out, ensure it works now
|
// we did handle this during reading, but failed during serializing this out, ensure it works now
|
||||||
byte[] data = new byte[] {
|
byte[] data = new byte[] {
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestFeatRecord {
|
public final class TestFeatRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testWithoutFeatRecord() throws Exception {
|
void testWithoutFeatRecord() throws Exception {
|
||||||
HSSFWorkbook hssf =
|
HSSFWorkbook hssf =
|
||||||
HSSFTestDataSamples.openSampleWorkbook("46136-WithWarnings.xls");
|
HSSFTestDataSamples.openSampleWorkbook("46136-WithWarnings.xls");
|
||||||
InternalWorkbook wb = HSSFTestHelper.getWorkbookForTest(hssf);
|
InternalWorkbook wb = HSSFTestHelper.getWorkbookForTest(hssf);
|
||||||
|
@ -91,7 +91,7 @@ public final class TestFeatRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadFeatRecord() {
|
void testReadFeatRecord() {
|
||||||
HSSFWorkbook hssf =
|
HSSFWorkbook hssf =
|
||||||
HSSFTestDataSamples.openSampleWorkbook("46136-NoWarnings.xls");
|
HSSFTestDataSamples.openSampleWorkbook("46136-NoWarnings.xls");
|
||||||
InternalWorkbook wb = HSSFTestHelper.getWorkbookForTest(hssf);
|
InternalWorkbook wb = HSSFTestHelper.getWorkbookForTest(hssf);
|
||||||
|
@ -183,7 +183,7 @@ public final class TestFeatRecord {
|
||||||
* cloning sheets with feat records
|
* cloning sheets with feat records
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCloneSheetWithFeatRecord() throws IOException {
|
void testCloneSheetWithFeatRecord() throws IOException {
|
||||||
try (HSSFWorkbook wb =
|
try (HSSFWorkbook wb =
|
||||||
HSSFTestDataSamples.openSampleWorkbook("46136-WithWarnings.xls")) {
|
HSSFTestDataSamples.openSampleWorkbook("46136-WithWarnings.xls")) {
|
||||||
HSSFSheet src = wb.getSheetAt(0);
|
HSSFSheet src = wb.getSheetAt(0);
|
||||||
|
|
|
@ -48,7 +48,7 @@ public final class TestFontRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
|
|
||||||
FontRecord record = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
FontRecord record = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
||||||
assertEquals(0xc8, record.getFontHeight());
|
assertEquals(0xc8, record.getFontHeight());
|
||||||
|
@ -70,7 +70,7 @@ public final class TestFontRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
// .fontheight = c8
|
// .fontheight = c8
|
||||||
// .attributes = 0
|
// .attributes = 0
|
||||||
// .italic = false
|
// .italic = false
|
||||||
|
@ -102,7 +102,7 @@ public final class TestFontRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCloneOnto() {
|
void testCloneOnto() {
|
||||||
FontRecord base = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
FontRecord base = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
||||||
|
|
||||||
FontRecord other = new FontRecord();
|
FontRecord other = new FontRecord();
|
||||||
|
@ -115,7 +115,7 @@ public final class TestFontRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSameProperties() {
|
void testSameProperties() {
|
||||||
FontRecord f1 = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
FontRecord f1 = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
||||||
FontRecord f2 = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
FontRecord f2 = new FontRecord(TestcaseRecordInputStream.create(0x31, data));
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public final class TestFontRecord {
|
||||||
* samples to say otherwise.
|
* samples to say otherwise.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyName_bug47250() {
|
void testEmptyName_bug47250() {
|
||||||
byte[] emptyNameData = HexRead.readFromString(
|
byte[] emptyNameData = HexRead.readFromString(
|
||||||
"C8 00 00 00 FF 7F 90 01 00 00 00 00 00 00 "
|
"C8 00 00 00 FF 7F 90 01 00 00 00 00 00 00 "
|
||||||
+ "00" // zero length
|
+ "00" // zero length
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestFormulaRecord {
|
public final class TestFormulaRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFormulaRecord () {
|
void testCreateFormulaRecord () {
|
||||||
FormulaRecord record = new FormulaRecord();
|
FormulaRecord record = new FormulaRecord();
|
||||||
record.setColumn((short)0);
|
record.setColumn((short)0);
|
||||||
record.setRow(1);
|
record.setRow(1);
|
||||||
|
@ -52,7 +52,7 @@ public final class TestFormulaRecord {
|
||||||
* This formula record is a representation of =1/0 at row 0, column 0
|
* This formula record is a representation of =1/0 at row 0, column 0
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCheckNanPreserve() {
|
void testCheckNanPreserve() {
|
||||||
byte[] formulaByte = {
|
byte[] formulaByte = {
|
||||||
0, 0, 0, 0,
|
0, 0, 0, 0,
|
||||||
0x0F, 0x00,
|
0x0F, 0x00,
|
||||||
|
@ -102,7 +102,7 @@ public final class TestFormulaRecord {
|
||||||
* Tests to see if the shared formula cells properly reserialize the expPtg
|
* Tests to see if the shared formula cells properly reserialize the expPtg
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testExpFormula() {
|
void testExpFormula() {
|
||||||
byte[] formulaByte = new byte[27];
|
byte[] formulaByte = new byte[27];
|
||||||
|
|
||||||
formulaByte[4] =(byte)0x0F;
|
formulaByte[4] =(byte)0x0F;
|
||||||
|
@ -121,7 +121,7 @@ public final class TestFormulaRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWithConcat() {
|
void testWithConcat() {
|
||||||
// =CHOOSE(2,A2,A3,A4)
|
// =CHOOSE(2,A2,A3,A4)
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
1, 0, 1, 0, 15, 0, 0, 0, 0, 0, 0, 0, 57,
|
1, 0, 1, 0, 15, 0, 0, 0, 0, 0, 0, 0, 57,
|
||||||
|
@ -159,7 +159,7 @@ public final class TestFormulaRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReserialize() {
|
void testReserialize() {
|
||||||
FormulaRecord formulaRecord = new FormulaRecord();
|
FormulaRecord formulaRecord = new FormulaRecord();
|
||||||
formulaRecord.setRow(1);
|
formulaRecord.setRow(1);
|
||||||
formulaRecord.setColumn((short) 1);
|
formulaRecord.setColumn((short) 1);
|
||||||
|
@ -182,7 +182,7 @@ public final class TestFormulaRecord {
|
||||||
* inside {@link FormulaRecord}
|
* inside {@link FormulaRecord}
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCachedValue_bug46479() {
|
void testCachedValue_bug46479() {
|
||||||
FormulaRecord fr0 = new FormulaRecord();
|
FormulaRecord fr0 = new FormulaRecord();
|
||||||
FormulaRecord fr1 = new FormulaRecord();
|
FormulaRecord fr1 = new FormulaRecord();
|
||||||
// test some other cached value types
|
// test some other cached value types
|
||||||
|
|
|
@ -34,7 +34,7 @@ public final class TestFtCblsSubRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
FtCblsSubRecord record = new FtCblsSubRecord(TestcaseRecordInputStream.create(FtCblsSubRecord.sid, data), data.length);
|
FtCblsSubRecord record = new FtCblsSubRecord(TestcaseRecordInputStream.create(FtCblsSubRecord.sid, data), data.length);
|
||||||
|
|
||||||
assertEquals(FtCblsSubRecord.sid, record.getSid());
|
assertEquals(FtCblsSubRecord.sid, record.getSid());
|
||||||
|
@ -42,7 +42,7 @@ public final class TestFtCblsSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrite() {
|
void testWrite() {
|
||||||
FtCblsSubRecord record = new FtCblsSubRecord();
|
FtCblsSubRecord record = new FtCblsSubRecord();
|
||||||
assertEquals(FtCblsSubRecord.sid, record.getSid());
|
assertEquals(FtCblsSubRecord.sid, record.getSid());
|
||||||
assertEquals(data.length, record.getDataSize());
|
assertEquals(data.length, record.getDataSize());
|
||||||
|
@ -52,7 +52,7 @@ public final class TestFtCblsSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClone() {
|
void testClone() {
|
||||||
FtCblsSubRecord record = new FtCblsSubRecord();
|
FtCblsSubRecord record = new FtCblsSubRecord();
|
||||||
byte[] src = record.serialize();
|
byte[] src = record.serialize();
|
||||||
|
|
||||||
|
|
|
@ -283,7 +283,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadURLLink(){
|
void testReadURLLink(){
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data1);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data1);
|
||||||
HyperlinkRecord link = new HyperlinkRecord(is);
|
HyperlinkRecord link = new HyperlinkRecord(is);
|
||||||
assertEquals(2, link.getFirstRow());
|
assertEquals(2, link.getFirstRow());
|
||||||
|
@ -303,7 +303,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadFileLink(){
|
void testReadFileLink(){
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data2);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data2);
|
||||||
HyperlinkRecord link = new HyperlinkRecord(is);
|
HyperlinkRecord link = new HyperlinkRecord(is);
|
||||||
assertEquals(0, link.getFirstRow());
|
assertEquals(0, link.getFirstRow());
|
||||||
|
@ -323,7 +323,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadEmailLink(){
|
void testReadEmailLink(){
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data3);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data3);
|
||||||
HyperlinkRecord link = new HyperlinkRecord(is);
|
HyperlinkRecord link = new HyperlinkRecord(is);
|
||||||
assertEquals(1, link.getFirstRow());
|
assertEquals(1, link.getFirstRow());
|
||||||
|
@ -342,7 +342,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadDocumentLink(){
|
void testReadDocumentLink(){
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data4);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data4);
|
||||||
HyperlinkRecord link = new HyperlinkRecord(is);
|
HyperlinkRecord link = new HyperlinkRecord(is);
|
||||||
assertEquals(3, link.getFirstRow());
|
assertEquals(3, link.getFirstRow());
|
||||||
|
@ -372,7 +372,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSerialize(){
|
void testSerialize(){
|
||||||
serialize(data1);
|
serialize(data1);
|
||||||
serialize(data2);
|
serialize(data2);
|
||||||
serialize(data3);
|
serialize(data3);
|
||||||
|
@ -380,7 +380,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateURLRecord() {
|
void testCreateURLRecord() {
|
||||||
HyperlinkRecord link = new HyperlinkRecord();
|
HyperlinkRecord link = new HyperlinkRecord();
|
||||||
link.newUrlLink();
|
link.newUrlLink();
|
||||||
link.setFirstRow((short)2);
|
link.setFirstRow((short)2);
|
||||||
|
@ -395,7 +395,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFileRecord() {
|
void testCreateFileRecord() {
|
||||||
HyperlinkRecord link = new HyperlinkRecord();
|
HyperlinkRecord link = new HyperlinkRecord();
|
||||||
link.newFileLink();
|
link.newFileLink();
|
||||||
link.setFirstRow((short)0);
|
link.setFirstRow((short)0);
|
||||||
|
@ -410,7 +410,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDocumentRecord() {
|
void testCreateDocumentRecord() {
|
||||||
HyperlinkRecord link = new HyperlinkRecord();
|
HyperlinkRecord link = new HyperlinkRecord();
|
||||||
link.newDocumentLink();
|
link.newDocumentLink();
|
||||||
link.setFirstRow((short)3);
|
link.setFirstRow((short)3);
|
||||||
|
@ -425,7 +425,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateEmailtRecord() {
|
void testCreateEmailtRecord() {
|
||||||
HyperlinkRecord link = new HyperlinkRecord();
|
HyperlinkRecord link = new HyperlinkRecord();
|
||||||
link.newUrlLink();
|
link.newUrlLink();
|
||||||
link.setFirstRow((short)1);
|
link.setFirstRow((short)1);
|
||||||
|
@ -440,7 +440,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClone() {
|
void testClone() {
|
||||||
byte[][] data = {data1, data2, data3, data4};
|
byte[][] data = {data1, data2, data3, data4};
|
||||||
for (final byte[] d : data) {
|
for (final byte[] d : data) {
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, d);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, d);
|
||||||
|
@ -453,7 +453,7 @@ public final class TestHyperlinkRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testReserializeTargetFrame() {
|
void testReserializeTargetFrame() {
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataTargetFrame);
|
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataTargetFrame);
|
||||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||||
byte[] ser = hr.serialize();
|
byte[] ser = hr.serialize();
|
||||||
|
@ -461,7 +461,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReserializeLinkToWorkbook() {
|
void testReserializeLinkToWorkbook() {
|
||||||
|
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataLinkToWorkbook);
|
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataLinkToWorkbook);
|
||||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||||
|
@ -472,7 +472,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReserializeUNC() {
|
void testReserializeUNC() {
|
||||||
|
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataUNC);
|
RecordInputStream in = TestcaseRecordInputStream.create(HyperlinkRecord.sid, dataUNC);
|
||||||
HyperlinkRecord hr = new HyperlinkRecord(in);
|
HyperlinkRecord hr = new HyperlinkRecord(in);
|
||||||
|
@ -482,7 +482,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGUID() throws IOException {
|
void testGUID() throws IOException {
|
||||||
ClassID g;
|
ClassID g;
|
||||||
g = new ClassID("3F2504E0-4F89-11D3-9A0C-0305E82C3301");
|
g = new ClassID("3F2504E0-4F89-11D3-9A0C-0305E82C3301");
|
||||||
confirmGUID(g, 0x3F2504E0, 0x4F89, 0x11D3, 0x9A0C0305E82C3301L);
|
confirmGUID(g, 0x3F2504E0, 0x4F89, 0x11D3, 0x9A0C0305E82C3301L);
|
||||||
|
@ -522,7 +522,7 @@ public final class TestHyperlinkRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test47498(){
|
void test47498(){
|
||||||
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data_47498);
|
RecordInputStream is = TestcaseRecordInputStream.create(HyperlinkRecord.sid, data_47498);
|
||||||
HyperlinkRecord link = new HyperlinkRecord(is);
|
HyperlinkRecord link = new HyperlinkRecord(is);
|
||||||
assertEquals(2, link.getFirstRow());
|
assertEquals(2, link.getFirstRow());
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestInterfaceEndRecord {
|
public final class TestInterfaceEndRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreate() {
|
void testCreate() {
|
||||||
InterfaceEndRecord record = InterfaceEndRecord.instance;
|
InterfaceEndRecord record = InterfaceEndRecord.instance;
|
||||||
assertEquals(0, record.getDataSize());
|
assertEquals(0, record.getDataSize());
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public final class TestInterfaceEndRecord {
|
||||||
* data to an {@link InterfaceHdrRecord}.
|
* data to an {@link InterfaceHdrRecord}.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUnexpectedBytes_bug47251(){
|
void testUnexpectedBytes_bug47251(){
|
||||||
String hex = "" +
|
String hex = "" +
|
||||||
"09 08 10 00 00 06 05 00 EC 15 CD 07 C1 C0 00 00 06 03 00 00 " + //BOF
|
"09 08 10 00 00 06 05 00 EC 15 CD 07 C1 C0 00 00 06 03 00 00 " + //BOF
|
||||||
"E2 00 02 00 B0 04 " + //INTERFACEEND with extra two bytes
|
"E2 00 02 00 B0 04 " + //INTERFACEEND with extra two bytes
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
|
||||||
public final class TestLabelRecord {
|
public final class TestLabelRecord {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEmptyString() throws IOException {
|
void testEmptyString() throws IOException {
|
||||||
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("ex42570-20305.xls");
|
try (HSSFWorkbook wb1 = HSSFTestDataSamples.openSampleWorkbook("ex42570-20305.xls");
|
||||||
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1)) {
|
HSSFWorkbook wb2 = HSSFTestDataSamples.writeOutAndReadBack(wb1)) {
|
||||||
HSSFSheet s1 = wb1.getSheetAt(0);
|
HSSFSheet s1 = wb1.getSheetAt(0);
|
||||||
|
|
|
@ -45,7 +45,7 @@ public final class TestLbsDataSubRecord {
|
||||||
* test data was taken from 47701.xls
|
* test data was taken from 47701.xls
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test_47701(){
|
void test_47701(){
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"15, 00, 12, 00, 12, 00, 02, 00, 11, 20, " +
|
"15, 00, 12, 00, 12, 00, 02, 00, 11, 20, " +
|
||||||
"00, 00, 00, 00, 80, 3D, 03, 05, 00, 00, " +
|
"00, 00, 00, 00, 80, 3D, 03, 05, 00, 00, " +
|
||||||
|
@ -79,7 +79,7 @@ public final class TestLbsDataSubRecord {
|
||||||
* test data was taken from the file attached to Bugzilla 45778
|
* test data was taken from the file attached to Bugzilla 45778
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test_45778(){
|
void test_45778(){
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"15, 00, 12, 00, 14, 00, 01, 00, 01, 00, " +
|
"15, 00, 12, 00, 14, 00, 01, 00, 01, 00, " +
|
||||||
"01, 21, 00, 00, 3C, 13, F4, 03, 00, 00, " +
|
"01, 21, 00, 00, 3C, 13, F4, 03, 00, 00, " +
|
||||||
|
@ -119,7 +119,7 @@ public final class TestLbsDataSubRecord {
|
||||||
* There are 5 padding bytes that are removed by POI
|
* There are 5 padding bytes that are removed by POI
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test_remove_padding(){
|
void test_remove_padding(){
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"5D, 00, 4C, 00, " +
|
"5D, 00, 4C, 00, " +
|
||||||
"15, 00, 12, 00, 12, 00, 01, 00, 11, 00, " +
|
"15, 00, 12, 00, 12, 00, 01, 00, 11, 00, " +
|
||||||
|
@ -153,7 +153,7 @@ public final class TestLbsDataSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_LbsDropData() throws IOException{
|
void test_LbsDropData() throws IOException{
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
//LbsDropData
|
//LbsDropData
|
||||||
"0A, 00, " + //flags
|
"0A, 00, " + //flags
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class TestMergeCellsRecord {
|
||||||
* Make sure when a clone is called, we actually clone it.
|
* Make sure when a clone is called, we actually clone it.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCloneReferences() {
|
void testCloneReferences() {
|
||||||
CellRangeAddress[] cras = { new CellRangeAddress(0, 1, 0, 2), };
|
CellRangeAddress[] cras = { new CellRangeAddress(0, 1, 0, 2), };
|
||||||
MergeCellsRecord merge = new MergeCellsRecord(cras, 0, cras.length);
|
MergeCellsRecord merge = new MergeCellsRecord(cras, 0, cras.length);
|
||||||
MergeCellsRecord clone = merge.copy();
|
MergeCellsRecord clone = merge.copy();
|
||||||
|
@ -60,7 +60,7 @@ public final class TestMergeCellsRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testMCTable_bug46009() {
|
void testMCTable_bug46009() {
|
||||||
MergedCellsTable mct = new MergedCellsTable();
|
MergedCellsTable mct = new MergedCellsTable();
|
||||||
CellRangeAddress[] cras = { new CellRangeAddress(0, 0, 0, 3) };
|
CellRangeAddress[] cras = { new CellRangeAddress(0, 0, 0, 3) };
|
||||||
MergeCellsRecord mcr1 = new MergeCellsRecord(cras, 0, 1);
|
MergeCellsRecord mcr1 = new MergeCellsRecord(cras, 0, 1);
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
||||||
*/
|
*/
|
||||||
public final class TestNameCommentRecord {
|
public final class TestNameCommentRecord {
|
||||||
@Test
|
@Test
|
||||||
public void testReserialize() {
|
void testReserialize() {
|
||||||
final byte[] data = HexRead
|
final byte[] data = HexRead
|
||||||
.readFromString(""
|
.readFromString(""
|
||||||
+ "94 08 00 00 00 00 00 00 00 00 00 00 04 00 07 00 00 6E 61 6D 65 00 63 6F 6D 6D 65 6E 74]");
|
+ "94 08 00 00 00 00 00 00 00 00 00 00 04 00 07 00 00 6E 61 6D 65 00 63 6F 6D 6D 65 6E 74]");
|
||||||
|
|
|
@ -45,7 +45,7 @@ public final class TestNameRecord {
|
||||||
* Makes sure that additional name information is parsed properly such as menu/description
|
* Makes sure that additional name information is parsed properly such as menu/description
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFillExtras() {
|
void testFillExtras() {
|
||||||
|
|
||||||
byte[] examples = HexRead.readFromString(""
|
byte[] examples = HexRead.readFromString(""
|
||||||
+ "88 03 67 06 07 00 00 00 00 00 00 23 00 00 00 4D "
|
+ "88 03 67 06 07 00 00 00 00 00 00 23 00 00 00 4D "
|
||||||
|
@ -60,7 +60,7 @@ public final class TestNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReserialize() {
|
void testReserialize() {
|
||||||
byte[] data = HexRead
|
byte[] data = HexRead
|
||||||
.readFromString(""
|
.readFromString(""
|
||||||
+ "20 00 00 01 0B 00 00 00 01 00 00 00 00 00 00 06 3B 00 00 00 00 02 00 00 00 09 00]");
|
+ "20 00 00 01 0B 00 00 00 01 00 00 00 00 00 00 06 3B 00 00 00 00 02 00 00 00 09 00]");
|
||||||
|
@ -72,7 +72,7 @@ public final class TestNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaRelAbs_bug46174() throws IOException {
|
void testFormulaRelAbs_bug46174() throws IOException {
|
||||||
// perhaps this testcase belongs on TestHSSFName
|
// perhaps this testcase belongs on TestHSSFName
|
||||||
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
try (HSSFWorkbook wb = new HSSFWorkbook()) {
|
||||||
HSSFName name = wb.createName();
|
HSSFName name = wb.createName();
|
||||||
|
@ -85,7 +85,7 @@ public final class TestNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFormulaGeneral() throws IOException {
|
void testFormulaGeneral() throws IOException {
|
||||||
// perhaps this testcase belongs on TestHSSFName
|
// perhaps this testcase belongs on TestHSSFName
|
||||||
HSSFWorkbook wb = new HSSFWorkbook();
|
HSSFWorkbook wb = new HSSFWorkbook();
|
||||||
HSSFName name = wb.createName();
|
HSSFName name = wb.createName();
|
||||||
|
@ -103,7 +103,7 @@ public final class TestNameRecord {
|
||||||
* A NameRecord followed by a ContinueRecord. See Bugzilla 50244
|
* A NameRecord followed by a ContinueRecord. See Bugzilla 50244
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void test50244() throws IOException {
|
void test50244() throws IOException {
|
||||||
byte[] data1 = RawDataUtil.decompress(
|
byte[] data1 = RawDataUtil.decompress(
|
||||||
"H4sIAAAAAAAAAI3Zu2qWQRAA0I8EQcHGzkrwBcLO7B0sBR9AwdYIKdKFoPhovp7xLyQWyX+m2OWw7TIX5u3x/t1xHG9ePhyXxyl+" +
|
"H4sIAAAAAAAAAI3Zu2qWQRAA0I8EQcHGzkrwBcLO7B0sBR9AwdYIKdKFoPhovp7xLyQWyX+m2OWw7TIX5u3x/t1xHG9ePhyXxyl+" +
|
||||||
"fbz+cf3p/ufd3c3nm/vbm6tvx++L18fXy4fr4tVxxNWXLFelhCENlRCIZuiERAzDJFTEMmxCM/RiCMJApKESJqIZOmEhhmESNmIZ" +
|
"fbz+cf3p/ufd3c3nm/vbm6tvx++L18fXy4fr4tVxxNWXLFelhCENlRCIZuiERAzDJFTEMmxCM/RiCMJApKESJqIZOmEhhmESNmIZ" +
|
||||||
|
@ -139,7 +139,7 @@ public final class TestNameRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBug57923() {
|
void testBug57923() {
|
||||||
NameRecord record = new NameRecord();
|
NameRecord record = new NameRecord();
|
||||||
assertEquals(0, record.getExternSheetNumber());
|
assertEquals(0, record.getExternSheetNumber());
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ public final class TestNoteRecord {
|
||||||
);
|
);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
|
|
||||||
NoteRecord record = new NoteRecord(TestcaseRecordInputStream.create(NoteRecord.sid, testData));
|
NoteRecord record = new NoteRecord(TestcaseRecordInputStream.create(NoteRecord.sid, testData));
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public final class TestNoteRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrite() {
|
void testWrite() {
|
||||||
NoteRecord record = new NoteRecord();
|
NoteRecord record = new NoteRecord();
|
||||||
assertEquals(NoteRecord.sid, record.getSid());
|
assertEquals(NoteRecord.sid, record.getSid());
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public final class TestNoteRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClone() {
|
void testClone() {
|
||||||
NoteRecord record = new NoteRecord();
|
NoteRecord record = new NoteRecord();
|
||||||
|
|
||||||
record.setRow((short)1);
|
record.setRow((short)1);
|
||||||
|
@ -92,7 +92,7 @@ public final class TestNoteRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUnicodeAuthor() {
|
void testUnicodeAuthor() {
|
||||||
// This sample data was created by setting the 'user name' field in the 'Personalize'
|
// This sample data was created by setting the 'user name' field in the 'Personalize'
|
||||||
// section of Excel's options to \u30A2\u30D1\u30C3\u30C1\u65CF, and then
|
// section of Excel's options to \u30A2\u30D1\u30C3\u30C1\u65CF, and then
|
||||||
// creating a cell comment.
|
// creating a cell comment.
|
||||||
|
|
|
@ -36,7 +36,7 @@ public final class TestNoteStructureSubRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRead() {
|
void testRead() {
|
||||||
NoteStructureSubRecord record = new NoteStructureSubRecord(TestcaseRecordInputStream.create(NoteStructureSubRecord.sid, data), data.length);
|
NoteStructureSubRecord record = new NoteStructureSubRecord(TestcaseRecordInputStream.create(NoteStructureSubRecord.sid, data), data.length);
|
||||||
|
|
||||||
assertEquals(NoteStructureSubRecord.sid, record.getSid());
|
assertEquals(NoteStructureSubRecord.sid, record.getSid());
|
||||||
|
@ -44,7 +44,7 @@ public final class TestNoteStructureSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWrite() {
|
void testWrite() {
|
||||||
NoteStructureSubRecord record = new NoteStructureSubRecord();
|
NoteStructureSubRecord record = new NoteStructureSubRecord();
|
||||||
assertEquals(NoteStructureSubRecord.sid, record.getSid());
|
assertEquals(NoteStructureSubRecord.sid, record.getSid());
|
||||||
assertEquals(data.length, record.getDataSize());
|
assertEquals(data.length, record.getDataSize());
|
||||||
|
@ -54,7 +54,7 @@ public final class TestNoteStructureSubRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testClone() {
|
void testClone() {
|
||||||
NoteStructureSubRecord record = new NoteStructureSubRecord();
|
NoteStructureSubRecord record = new NoteStructureSubRecord();
|
||||||
byte[] src = record.serialize();
|
byte[] src = record.serialize();
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public final class TestObjRecord {
|
||||||
);
|
);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
|
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
|
||||||
|
|
||||||
assertEquals(26, record.getRecordSize() - 4);
|
assertEquals(26, record.getRecordSize() - 4);
|
||||||
|
@ -73,7 +73,7 @@ public final class TestObjRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
|
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
|
||||||
|
|
||||||
byte [] recordBytes = record.serialize();
|
byte [] recordBytes = record.serialize();
|
||||||
|
@ -83,7 +83,7 @@ public final class TestObjRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testConstruct() {
|
void testConstruct() {
|
||||||
ObjRecord record = new ObjRecord();
|
ObjRecord record = new ObjRecord();
|
||||||
CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
|
CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
|
||||||
ftCmo.setObjectType( CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT);
|
ftCmo.setObjectType( CommonObjectDataSubRecord.OBJECT_TYPE_COMMENT);
|
||||||
|
@ -109,7 +109,7 @@ public final class TestObjRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadWriteWithPadding_bug45133() {
|
void testReadWriteWithPadding_bug45133() {
|
||||||
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(recdataNeedingPadding));
|
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(recdataNeedingPadding));
|
||||||
assertNotEquals(34, record.getRecordSize(), "Identified bug 45133");
|
assertNotEquals(34, record.getRecordSize(), "Identified bug 45133");
|
||||||
assertEquals(36, record.getRecordSize());
|
assertEquals(36, record.getRecordSize());
|
||||||
|
@ -127,7 +127,7 @@ public final class TestObjRecord {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void test4BytePadding() {
|
void test4BytePadding() {
|
||||||
// actual data from file saved by Excel 2007
|
// actual data from file saved by Excel 2007
|
||||||
byte[] data = HexRead.readFromString(""
|
byte[] data = HexRead.readFromString(""
|
||||||
+ "15 00 12 00 1E 00 01 00 11 60 B4 6D 3C 01 C4 06 "
|
+ "15 00 12 00 1E 00 01 00 11 60 B4 6D 3C 01 C4 06 "
|
||||||
|
|
|
@ -42,7 +42,7 @@ public final class TestPLVRecord {
|
||||||
private final static String SHEET_NAME = "S2";
|
private final static String SHEET_NAME = "S2";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testPLVRecord() throws Exception {
|
void testPLVRecord() throws Exception {
|
||||||
try (InputStream is = HSSFTestDataSamples.openSampleFileStream(XLS_FILENAME);
|
try (InputStream is = HSSFTestDataSamples.openSampleFileStream(XLS_FILENAME);
|
||||||
HSSFWorkbook workbook = new HSSFWorkbook(is)) {
|
HSSFWorkbook workbook = new HSSFWorkbook(is)) {
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ public final class TestPaletteRecord {
|
||||||
* Tests that the default palette matches the constants of HSSFColor
|
* Tests that the default palette matches the constants of HSSFColor
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultPalette() {
|
void testDefaultPalette() {
|
||||||
PaletteRecord palette = new PaletteRecord();
|
PaletteRecord palette = new PaletteRecord();
|
||||||
|
|
||||||
//make sure all the HSSFColor constants match
|
//make sure all the HSSFColor constants match
|
||||||
|
|
|
@ -38,7 +38,7 @@ public final class TestPaneRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
PaneRecord record = new PaneRecord(TestcaseRecordInputStream.create(0x41, data));
|
PaneRecord record = new PaneRecord(TestcaseRecordInputStream.create(0x41, data));
|
||||||
|
|
||||||
assertEquals( (short)1, record.getX());
|
assertEquals( (short)1, record.getX());
|
||||||
|
@ -52,7 +52,7 @@ public final class TestPaneRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
PaneRecord record = new PaneRecord();
|
PaneRecord record = new PaneRecord();
|
||||||
|
|
||||||
record.setX( (short) 1);
|
record.setX( (short) 1);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public final class TestRecalcIdRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testBasicDeserializeReserialize() {
|
void testBasicDeserializeReserialize() {
|
||||||
|
|
||||||
byte[] data = HexRead.readFromString(
|
byte[] data = HexRead.readFromString(
|
||||||
"C1 01" + // rt
|
"C1 01" + // rt
|
||||||
|
@ -47,7 +47,7 @@ public final class TestRecalcIdRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBadFirstField_bug48096() {
|
void testBadFirstField_bug48096() {
|
||||||
/*
|
/*
|
||||||
* Data taken from the sample file referenced in Bugzilla 48096, file offset 0x0D45.
|
* Data taken from the sample file referenced in Bugzilla 48096, file offset 0x0D45.
|
||||||
* The apparent problem is that the first data short field has been written with the
|
* The apparent problem is that the first data short field has been written with the
|
||||||
|
|
|
@ -44,7 +44,7 @@ public final class TestRecordFactory {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBasicRecordConstruction() {
|
void testBasicRecordConstruction() {
|
||||||
short recType = BOFRecord.sid;
|
short recType = BOFRecord.sid;
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
0, 6, 5, 0, -2, 28, -51, 7, -55, 64, 0, 0, 6, 1, 0, 0
|
0, 6, 5, 0, -2, 28, -51, 7, -55, 64, 0, 0, 6, 1, 0, 0
|
||||||
|
@ -87,7 +87,7 @@ public final class TestRecordFactory {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSpecial() {
|
void testSpecial() {
|
||||||
short recType = RKRecord.sid;
|
short recType = RKRecord.sid;
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
0, 0, 0, 0, 21, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 21, 0, 0, 0, 0, 0
|
||||||
|
@ -114,7 +114,7 @@ public final class TestRecordFactory {
|
||||||
* FAILURE: The wrong records are created or contain the wrong values <P>
|
* FAILURE: The wrong records are created or contain the wrong values <P>
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testContinuedUnknownRecord() {
|
void testContinuedUnknownRecord() {
|
||||||
byte[] data = {
|
byte[] data = {
|
||||||
0, -1, 0, 0, // an unknown record with 0 length
|
0, -1, 0, 0, // an unknown record with 0 length
|
||||||
0x3C , 0, 3, 0, 1, 2, 3, // a continuation record with 3 bytes of data
|
0x3C , 0, 3, 0, 1, 2, 3, // a continuation record with 3 bytes of data
|
||||||
|
@ -144,7 +144,7 @@ public final class TestRecordFactory {
|
||||||
* Record factory must preserve this structure when reading records.
|
* Record factory must preserve this structure when reading records.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMixedContinue() throws IOException {
|
void testMixedContinue() throws IOException {
|
||||||
// Adapted from a real test sample file 39512.xls (Offset 0x4854).
|
// Adapted from a real test sample file 39512.xls (Offset 0x4854).
|
||||||
// See Bug 39512 for details.
|
// See Bug 39512 for details.
|
||||||
String dump =
|
String dump =
|
||||||
|
@ -194,7 +194,7 @@ public final class TestRecordFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNonZeroPadding_bug46987() throws IOException {
|
void testNonZeroPadding_bug46987() throws IOException {
|
||||||
Record[] recs = {
|
Record[] recs = {
|
||||||
new BOFRecord(),
|
new BOFRecord(),
|
||||||
new WriteAccessRecord(), // need *something* between BOF and EOF
|
new WriteAccessRecord(), // need *something* between BOF and EOF
|
||||||
|
|
|
@ -55,7 +55,7 @@ public final class TestRecordInputStream {
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChangeOfCompressionFlag_bug25866() {
|
void testChangeOfCompressionFlag_bug25866() {
|
||||||
byte[] changingFlagSimpleData = HexRead.readFromString(""
|
byte[] changingFlagSimpleData = HexRead.readFromString(""
|
||||||
+ "AA AA " // fake SID
|
+ "AA AA " // fake SID
|
||||||
+ "06 00 " // first rec len 6
|
+ "06 00 " // first rec len 6
|
||||||
|
@ -69,7 +69,7 @@ public final class TestRecordInputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testChangeFromUnCompressedToCompressed() {
|
void testChangeFromUnCompressedToCompressed() {
|
||||||
byte[] changingFlagSimpleData = HexRead.readFromString(""
|
byte[] changingFlagSimpleData = HexRead.readFromString(""
|
||||||
+ "AA AA " // fake SID
|
+ "AA AA " // fake SID
|
||||||
+ "0F 00 " // first rec len 15
|
+ "0F 00 " // first rec len 15
|
||||||
|
@ -81,7 +81,7 @@ public final class TestRecordInputStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testReadString() {
|
void testReadString() {
|
||||||
byte[] changingFlagFullData = HexRead.readFromString(""
|
byte[] changingFlagFullData = HexRead.readFromString(""
|
||||||
+ "AA AA " // fake SID
|
+ "AA AA " // fake SID
|
||||||
+ "12 00 " // first rec len 18 (15 + next 3 bytes)
|
+ "12 00 " // first rec len 18 (15 + next 3 bytes)
|
||||||
|
@ -96,7 +96,7 @@ public final class TestRecordInputStream {
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@CsvSource({"1, 200", "0, 200", "999999999, 200", HeaderRecord.sid+", 200"})
|
@CsvSource({"1, 200", "0, 200", "999999999, 200", HeaderRecord.sid+", 200"})
|
||||||
public void testLeftoverDataException(int sid, int remainingByteCount) {
|
void testLeftoverDataException(int sid, int remainingByteCount) {
|
||||||
// just ensure that the exception is created correctly, even with unknown sids
|
// just ensure that the exception is created correctly, even with unknown sids
|
||||||
assertDoesNotThrow(() -> new RecordInputStream.LeftoverDataException(sid, remainingByteCount));
|
assertDoesNotThrow(() -> new RecordInputStream.LeftoverDataException(sid, remainingByteCount));
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public final class TestSCLRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
void testLoad() {
|
||||||
SCLRecord record = new SCLRecord(TestcaseRecordInputStream.create(0xa0, data));
|
SCLRecord record = new SCLRecord(TestcaseRecordInputStream.create(0xa0, data));
|
||||||
assertEquals( 3, record.getNumerator());
|
assertEquals( 3, record.getNumerator());
|
||||||
assertEquals( 4, record.getDenominator());
|
assertEquals( 4, record.getDenominator());
|
||||||
|
@ -44,7 +44,7 @@ public final class TestSCLRecord {
|
||||||
|
|
||||||
@SuppressWarnings("squid:S2699")
|
@SuppressWarnings("squid:S2699")
|
||||||
@Test
|
@Test
|
||||||
public void testStore() {
|
void testStore() {
|
||||||
SCLRecord record = new SCLRecord();
|
SCLRecord record = new SCLRecord();
|
||||||
record.setNumerator( (short)3 );
|
record.setNumerator( (short)3 );
|
||||||
record.setDenominator( (short)4 );
|
record.setDenominator( (short)4 );
|
||||||
|
|
|
@ -53,7 +53,7 @@ public final class TestSSTDeserializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSpanRichTextToPlainText() throws IOException {
|
void testSpanRichTextToPlainText() throws IOException {
|
||||||
byte[] header = readSampleHexData("richtextdata.txt", "header", FAKE_SID);
|
byte[] header = readSampleHexData("richtextdata.txt", "header", FAKE_SID);
|
||||||
byte[] continueBytes = readSampleHexData("richtextdata.txt", "continue1", ContinueRecord.sid);
|
byte[] continueBytes = readSampleHexData("richtextdata.txt", "continue1", ContinueRecord.sid);
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
||||||
|
@ -67,7 +67,7 @@ public final class TestSSTDeserializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testContinuationWithNoOverlap() throws IOException {
|
void testContinuationWithNoOverlap() throws IOException {
|
||||||
byte[] header = readSampleHexData("evencontinuation.txt", "header", FAKE_SID);
|
byte[] header = readSampleHexData("evencontinuation.txt", "header", FAKE_SID);
|
||||||
byte[] continueBytes = readSampleHexData("evencontinuation.txt", "continue1", ContinueRecord.sid);
|
byte[] continueBytes = readSampleHexData("evencontinuation.txt", "continue1", ContinueRecord.sid);
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
||||||
|
@ -84,7 +84,7 @@ public final class TestSSTDeserializer {
|
||||||
* Strings can actually span across more than one continuation.
|
* Strings can actually span across more than one continuation.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStringAcross2Continuations() throws IOException {
|
void testStringAcross2Continuations() throws IOException {
|
||||||
byte[] header = readSampleHexData("stringacross2continuations.txt", "header", FAKE_SID);
|
byte[] header = readSampleHexData("stringacross2continuations.txt", "header", FAKE_SID);
|
||||||
byte[] continue1 = readSampleHexData("stringacross2continuations.txt", "continue1", ContinueRecord.sid);
|
byte[] continue1 = readSampleHexData("stringacross2continuations.txt", "continue1", ContinueRecord.sid);
|
||||||
byte[] continue2 = readSampleHexData("stringacross2continuations.txt", "continue2", ContinueRecord.sid);
|
byte[] continue2 = readSampleHexData("stringacross2continuations.txt", "continue2", ContinueRecord.sid);
|
||||||
|
@ -100,7 +100,7 @@ public final class TestSSTDeserializer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExtendedStrings() throws IOException {
|
void testExtendedStrings() throws IOException {
|
||||||
byte[] header = readSampleHexData("extendedtextstrings.txt", "rich-header", FAKE_SID);
|
byte[] header = readSampleHexData("extendedtextstrings.txt", "rich-header", FAKE_SID);
|
||||||
byte[] continueBytes = readSampleHexData("extendedtextstrings.txt", "rich-continue1", ContinueRecord.sid);
|
byte[] continueBytes = readSampleHexData("extendedtextstrings.txt", "rich-continue1", ContinueRecord.sid);
|
||||||
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
RecordInputStream in = TestcaseRecordInputStream.create(concat(header, continueBytes));
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue