aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-01-16 23:13:11 +0000
committerJosh Micich <josh@apache.org>2009-01-16 23:13:11 +0000
commit64509ab218d6ef5d856bc4ebbf3af241279e9714 (patch)
tree1c163def4ec0c268a2f2eac74acdafd007b700f0 /src/testcases/org
parentbf424cbb4297f89cc63b0701193aeced20c9e8d6 (diff)
downloadpoi-64509ab218d6ef5d856bc4ebbf3af241279e9714.tar.gz
poi-64509ab218d6ef5d856bc4ebbf3af241279e9714.zip
Bug 46548 - fixes for Page Settings Block (patch from Dmitriy Kumshayev + some mods)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@735179 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org')
-rw-r--r--src/testcases/org/apache/poi/hssf/data/ex46548-23133.xlsbin0 -> 22016 bytes
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestSheet.java7
-rw-r--r--src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java83
-rw-r--r--src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingBlock.java50
4 files changed, 96 insertions, 44 deletions
diff --git a/src/testcases/org/apache/poi/hssf/data/ex46548-23133.xls b/src/testcases/org/apache/poi/hssf/data/ex46548-23133.xls
new file mode 100644
index 0000000000..cc1fe3a291
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/data/ex46548-23133.xls
Binary files differ
diff --git a/src/testcases/org/apache/poi/hssf/model/TestSheet.java b/src/testcases/org/apache/poi/hssf/model/TestSheet.java
index bd8678720e..7a857d6ca5 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestSheet.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestSheet.java
@@ -68,7 +68,7 @@ public final class TestSheet extends TestCase {
public void testCreateSheet() {
// Check we're adding row and cell aggregates
List<Record> records = new ArrayList<Record>();
- records.add( new BOFRecord() );
+ records.add(BOFRecord.createSheetBOF());
records.add( new DimensionsRecord() );
records.add(createWindow2Record());
records.add(EOFRecord.instance);
@@ -187,6 +187,7 @@ public final class TestSheet extends TestCase {
new CellRangeAddress(0, 1, 0, 2),
};
MergeCellsRecord merged = new MergeCellsRecord(cras, 0, cras.length);
+ records.add(BOFRecord.createSheetBOF());
records.add(new DimensionsRecord());
records.add(new RowRecord(0));
records.add(new RowRecord(1));
@@ -449,7 +450,7 @@ public final class TestSheet extends TestCase {
public void testUncalcSize_bug45066() {
List<Record> records = new ArrayList<Record>();
- records.add(new BOFRecord());
+ records.add(BOFRecord.createSheetBOF());
records.add(new UncalcedRecord());
records.add(new DimensionsRecord());
records.add(createWindow2Record());
@@ -600,7 +601,7 @@ public final class TestSheet extends TestCase {
nr.setValue(3.0);
List<Record> inRecs = new ArrayList<Record>();
- inRecs.add(new BOFRecord());
+ inRecs.add(BOFRecord.createSheetBOF());
inRecs.add(new RowRecord(rowIx));
inRecs.add(nr);
inRecs.add(createWindow2Record());
diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java b/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java
index aafe082582..e19f182f77 100644
--- a/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java
+++ b/src/testcases/org/apache/poi/hssf/record/aggregates/AllRecordAggregateTests.java
@@ -1,41 +1,42 @@
-/* ====================================================================
- 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.hssf.record.aggregates;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Collects all tests for package <tt>org.apache.poi.hssf.record.aggregates</tt>.
- *
- * @author Josh Micich
- */
-public final class AllRecordAggregateTests {
-
- public static Test suite() {
- TestSuite result = new TestSuite(AllRecordAggregateTests.class.getName());
-
- result.addTestSuite(TestCFRecordsAggregate.class);
- result.addTestSuite(TestColumnInfoRecordsAggregate.class);
- result.addTestSuite(TestFormulaRecordAggregate.class);
- result.addTestSuite(TestRowRecordsAggregate.class);
- result.addTestSuite(TestSharedValueManager.class);
- result.addTestSuite(TestValueRecordsAggregate.class);
- return result;
- }
-}
+/* ====================================================================
+ 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.hssf.record.aggregates;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * Collects all tests for package <tt>org.apache.poi.hssf.record.aggregates</tt>.
+ *
+ * @author Josh Micich
+ */
+public final class AllRecordAggregateTests {
+
+ public static Test suite() {
+ TestSuite result = new TestSuite(AllRecordAggregateTests.class.getName());
+
+ result.addTestSuite(TestCFRecordsAggregate.class);
+ result.addTestSuite(TestColumnInfoRecordsAggregate.class);
+ result.addTestSuite(TestFormulaRecordAggregate.class);
+ result.addTestSuite(TestRowRecordsAggregate.class);
+ result.addTestSuite(TestSharedValueManager.class);
+ result.addTestSuite(TestValueRecordsAggregate.class);
+ result.addTestSuite(TestPageSettingBlock.class);
+ return result;
+ }
+}
diff --git a/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingBlock.java b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingBlock.java
new file mode 100644
index 0000000000..518ed5f308
--- /dev/null
+++ b/src/testcases/org/apache/poi/hssf/record/aggregates/TestPageSettingBlock.java
@@ -0,0 +1,50 @@
+/* ====================================================================
+ 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.hssf.record.aggregates;
+
+import junit.framework.AssertionFailedError;
+import junit.framework.TestCase;
+
+import org.apache.poi.hssf.HSSFTestDataSamples;
+import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+
+/**
+ * Tess for {@link PageSettingsBlock}
+ *
+ * @author Dmitriy Kumshayev
+ */
+public final class TestPageSettingBlock extends TestCase {
+
+ public void testPrintSetup_bug46548() {
+
+ // PageSettingBlock in this file contains PLS (sid=x004D) record
+ // followed by ContinueRecord (sid=x003C)
+ HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("ex46548-23133.xls");
+ HSSFSheet sheet = wb.getSheetAt(0);
+ HSSFPrintSetup ps = sheet.getPrintSetup();
+
+ try {
+ ps.getCopies();
+ } catch (NullPointerException e) {
+ e.printStackTrace();
+ throw new AssertionFailedError("Identified bug 46548: PageSettingBlock missing PrintSetupRecord record");
+ }
+ }
+}