poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ber...@apache.org
Subject svn commit: r1366700 - in /poi/branches/gsoc2012: src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java test-data/spreadsheet/51675.xls
Date Sat, 28 Jul 2012 16:01:24 GMT
Author: berlog
Date: Sat Jul 28 16:01:24 2012
New Revision: 1366700

URL: http://svn.apache.org/viewvc?rev=1366700&view=rev
Log:
fixed bug 51675, added test case for bug 52272

Added:
    poi/branches/gsoc2012/test-data/spreadsheet/51675.xls   (with props)
Modified:
    poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
    poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java?rev=1366700&r1=1366699&r2=1366700&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
(original)
+++ poi/branches/gsoc2012/src/java/org/apache/poi/hssf/record/aggregates/PageSettingsBlock.java
Sat Jul 28 16:01:24 2012
@@ -284,9 +284,9 @@ public final class PageSettingsBlock ext
 			pls.visitContainedRecords(rv);
 		}
 		visitIfPresent(_printSetup, rv);
-		visitIfPresent(_bitmap, rv);
 		visitIfPresent(_printSize, rv);
 		visitIfPresent(_headerFooter, rv);
+        visitIfPresent(_bitmap, rv);
 	}
 	private static void visitIfPresent(Record r, RecordVisitor rv) {
 		if (r != null) {

Modified: poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1366700&r1=1366699&r2=1366700&view=diff
==============================================================================
--- poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/branches/gsoc2012/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Sat Jul
28 16:01:24 2012
@@ -24,9 +24,12 @@ import org.apache.poi.hssf.HSSFITestData
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.OldExcelFormatException;
 import org.apache.poi.hssf.extractor.ExcelExtractor;
+import org.apache.poi.hssf.model.InternalSheet;
 import org.apache.poi.hssf.model.InternalWorkbook;
 import org.apache.poi.hssf.record.*;
 import org.apache.poi.hssf.record.aggregates.FormulaRecordAggregate;
+import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
+import org.apache.poi.hssf.record.aggregates.RecordAggregate;
 import org.apache.poi.hssf.record.common.UnicodeString;
 import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
@@ -2238,4 +2241,31 @@ if(1==2) {
         // make sure we are still readable
         writeOutAndReadBack(workbook);
     }
+    
+    public void test51675(){
+        final List<Short> list = new ArrayList<Short>();
+        HSSFWorkbook workbook = openSample("51675.xls");
+        HSSFSheet sh = workbook.getSheetAt(0);
+        InternalSheet ish = HSSFTestHelper.getSheetForTest(sh);
+        PageSettingsBlock psb = (PageSettingsBlock) ish.getRecords().get(13);
+        psb.visitContainedRecords(new RecordAggregate.RecordVisitor() {
+            public void visitRecord(Record r) {
+                list.add(r.getSid());
+            }
+        });
+        assertTrue(list.get(list.size()-1).intValue() == UnknownRecord.BITMAP_00E9);
+        assertTrue(list.get(list.size()-2).intValue() == UnknownRecord.HEADER_FOOTER_089C);
+    }
+    
+    public void test52272(){
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFSheet sh = wb.createSheet();
+        HSSFPatriarch p = sh.createDrawingPatriarch();
+        
+        HSSFSimpleShape s = p.createSimpleShape(new HSSFClientAnchor());
+        s.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
+
+        HSSFSheet sh2 = wb.cloneSheet(0);
+        assertNotNull(sh2.getDrawingPatriarch());
+    }
 }

Added: poi/branches/gsoc2012/test-data/spreadsheet/51675.xls
URL: http://svn.apache.org/viewvc/poi/branches/gsoc2012/test-data/spreadsheet/51675.xls?rev=1366700&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/branches/gsoc2012/test-data/spreadsheet/51675.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message