poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r707839 [2/2] - in /poi/branches/ooxml/src: examples/src/org/apache/poi/xssf/usermodel/examples/ java/org/apache/poi/ss/util/ ooxml/interfaces-jdk15/org/apache/poi/ss/usermodel/ ooxml/java/org/apache/poi/ ooxml/java/org/apache/poi/xssf/mode...
Date Sat, 25 Oct 2008 11:48:51 GMT
Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java?rev=707839&r1=707838&r2=707839&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFDrawing.java
Sat Oct 25 04:48:50 2008
@@ -42,8 +42,8 @@
         String drawingId = drawing.getPackageRelationship().getId();
 
         //there should be a relation to this drawing in the worksheet
-        assertTrue(sheet.getWorksheet().isSetDrawing());
-        assertEquals(drawingId, sheet.getWorksheet().getDrawing().getId());
+        assertTrue(sheet.getCTWorksheet().isSetDrawing());
+        assertEquals(drawingId, sheet.getCTWorksheet().getDrawing().getId());
 
     }
 
@@ -63,8 +63,8 @@
         String drawingId = drawing.getPackageRelationship().getId();
 
         //there should be a relation to this drawing in the worksheet
-        assertTrue(sheet.getWorksheet().isSetDrawing());
-        assertEquals(drawingId, sheet.getWorksheet().getDrawing().getId());
+        assertTrue(sheet.getCTWorksheet().isSetDrawing());
+        assertEquals(drawingId, sheet.getCTWorksheet().getDrawing().getId());
 
     }
     public void testMultipleDrawings(){

Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java?rev=707839&r1=707838&r2=707839&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
Sat Oct 25 04:48:50 2008
@@ -25,6 +25,7 @@
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.poi.ss.util.Region;
+import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.model.CommentsTable;
 import org.apache.poi.xssf.model.StylesTable;
 import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
@@ -404,7 +405,7 @@
         // Now check the low level stuff, and check that's all
         //  been set correctly
         XSSFSheet xs = sheet;
-        CTWorksheet cts = xs.getWorksheet();
+        CTWorksheet cts = xs.getCTWorksheet();
 
         CTCols[] cols_s = cts.getColsArray();
         assertEquals(1, cols_s.length);
@@ -621,7 +622,7 @@
         sheet.setCellComment("A1", comment);
         assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef());
         comment.setAuthor("test A1 author");
-        assertEquals("test A1 author", comments.getAuthor(ctComments.getCommentList().getCommentArray(0).getAuthorId()));
+        assertEquals("test A1 author", comments.getAuthor((int)ctComments.getCommentList().getCommentArray(0).getAuthorId()));
     }
     
     public void testGetActiveCell() {
@@ -636,7 +637,7 @@
     public void testCreateFreezePane() {
     	XSSFWorkbook workbook = new XSSFWorkbook();
     	XSSFSheet sheet = workbook.createSheet();
-        CTWorksheet ctWorksheet = sheet.getWorksheet();
+        CTWorksheet ctWorksheet = sheet.getCTWorksheet();
 
     	sheet.createFreezePane(2, 4);
     	assertEquals((double)2, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
@@ -653,17 +654,16 @@
     public void testNewMergedRegionAt() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
-    	Region region = new Region("B2:D4");
+    	CellRangeAddress region = CellRangeAddress.valueOf("B2:D4");
     	sheet.addMergedRegion(region);
-    	assertEquals("B2:D4", sheet.getMergedRegionAt(0).getRegionRef());
+    	assertEquals("B2:D4", sheet.getMergedRegion(0).formatAsString());
     }
     
     public void testGetNumMergedRegions() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
-        CTWorksheet ctWorksheet = sheet.getWorksheet();
     	assertEquals(0, sheet.getNumMergedRegions());
-    	Region region = new Region("B2:D4");
+    	CellRangeAddress region = CellRangeAddress.valueOf("B2:D4");
     	sheet.addMergedRegion(region);
     	assertEquals(1, sheet.getNumMergedRegions());
     }
@@ -671,10 +671,10 @@
     public void testRemoveMergedRegion() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
-        CTWorksheet ctWorksheet = sheet.getWorksheet();
-    	Region region_1 = new Region("A1:B2");
-    	Region region_2 = new Region("C3:D4");
-    	Region region_3 = new Region("E5:F6");
+        CTWorksheet ctWorksheet = sheet.getCTWorksheet();
+    	CellRangeAddress region_1 = CellRangeAddress.valueOf("A1:B2");
+    	CellRangeAddress region_2 = CellRangeAddress.valueOf("C3:D4");
+    	CellRangeAddress region_3 = CellRangeAddress.valueOf("E5:F6");
     	sheet.addMergedRegion(region_1);
     	sheet.addMergedRegion(region_2);
     	sheet.addMergedRegion(region_3);
@@ -691,7 +691,7 @@
     public void testSetDefaultColumnStyle() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
-        CTWorksheet ctWorksheet = sheet.getWorksheet();
+        CTWorksheet ctWorksheet = sheet.getCTWorksheet();
     	StylesTable stylesTable = workbook.getStylesSource();
     	XSSFFont font = new XSSFFont();
     	font.setFontName("Cambria");
@@ -750,7 +750,7 @@
 	    	//one level
 	    	sheet.groupColumn((short)2,(short)7);
 	    	sheet.groupColumn((short)10,(short)11);
-	    	CTCols cols=sheet.getWorksheet().getColsArray(0);
+	    	CTCols cols=sheet.getCTWorksheet().getColsArray(0);
 	    	assertEquals(2,cols.sizeOfColArray());
 	    	CTCol[]colArray=cols.getColArray();
 	    	assertNotNull(colArray);
@@ -760,7 +760,7 @@
 
 	    	//two level  
 	    	sheet.groupColumn((short)1,(short)2);
-	    	cols=sheet.getWorksheet().getColsArray(0);
+	    	cols=sheet.getCTWorksheet().getColsArray(0);
 	    	assertEquals(4,cols.sizeOfColArray());
 	    	colArray=cols.getColArray();
 	    	assertEquals(2, colArray[1].getOutlineLevel());
@@ -768,7 +768,7 @@
 	    	//three level
 	    	sheet.groupColumn((short)6,(short)8);
 	    	sheet.groupColumn((short)2,(short)3);
-	    	cols=sheet.getWorksheet().getColsArray(0);
+	    	cols=sheet.getCTWorksheet().getColsArray(0);
 	    	assertEquals(7,cols.sizeOfColArray());
 	    	colArray=cols.getColArray();
 	    	assertEquals(3, colArray[1].getOutlineLevel());
@@ -792,7 +792,7 @@
 
 	    	//one level
 	    	sheet.groupRow(9,10);
-	    	assertEquals(2,sheet.rows.size());
+	    	assertEquals(2,sheet.getPhysicalNumberOfRows());
 	    	CTRow ctrow = sheet.getRow(8).getCTRow();
 
 	    	assertNotNull(ctrow);
@@ -802,7 +802,7 @@
 
 	    	//two level    	
 	    	sheet.groupRow(10,13);
-	    	assertEquals(5,sheet.rows.size());
+	    	assertEquals(5,sheet.getPhysicalNumberOfRows());
 	    	ctrow = sheet.getRow(9).getCTRow();
 	    	assertNotNull(ctrow);
 	    	assertEquals(10,ctrow.getR());
@@ -811,11 +811,11 @@
 
 	    	
 	    	sheet.ungroupRow(8, 10);
-            assertEquals(4,sheet.rows.size());
+            assertEquals(4,sheet.getPhysicalNumberOfRows());
 	    	assertEquals(1,sheet.getSheetTypeSheetFormatPr().getOutlineLevelRow());
 
 	    	sheet.ungroupRow(10,10);
-            assertEquals(3,sheet.rows.size());
+            assertEquals(3,sheet.getPhysicalNumberOfRows());
 
 	    	assertEquals(1,sheet.getSheetTypeSheetFormatPr().getOutlineLevelRow());
 	    }

Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java?rev=707839&r1=707838&r2=707839&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
Sat Oct 25 04:48:50 2008
@@ -54,6 +54,8 @@
 
 	public void testGetSetActiveSheet(){
 		XSSFWorkbook workbook = new XSSFWorkbook();
+        assertEquals(0, workbook.getActiveSheetIndex());
+
 		workbook.createSheet("sheet1");
 		workbook.createSheet("sheet2");
 		workbook.createSheet("sheet3");
@@ -84,7 +86,7 @@
 		assertSame(sheet2, workbook.getSheetAt(0));
 		assertSame(sheet1, workbook.getSheetAt(1));
 		// Test reordering of CTSheets
-		CTWorkbook ctwb = workbook.getWorkbook();
+		CTWorkbook ctwb = workbook.getCTWorkbook();
 		CTSheet[] ctsheets = ctwb.getSheets().getSheetArray();
 		assertEquals("sheet2", ctsheets[0].getName());
 		assertEquals("sheet1", ctsheets[1].getName());
@@ -334,19 +336,19 @@
 		assertNotNull(cellStyleAt);
 		
 		//get custom style
-		StylesSource styleSource = workbook.getStylesSource();
+		StylesTable styleSource = workbook.getStylesSource();
 		CellStyle customStyle = new XSSFCellStyle(styleSource);
 		Font font = new XSSFFont();
 		font.setFontName("Verdana");
 		customStyle.setFont(font);
-		Long x = styleSource.putStyle(customStyle);
-		cellStyleAt = workbook.getCellStyleAt(x.shortValue());
+		int x = styleSource.putStyle(customStyle);
+		cellStyleAt = workbook.getCellStyleAt((short)x);
 		assertNotNull(cellStyleAt);		
 	}
 	
 	public void testGetFontAt(){
 	 	XSSFWorkbook workbook = new XSSFWorkbook();
-		StylesSource styleSource = workbook.getStylesSource();
+		StylesTable styleSource = workbook.getStylesSource();
 		short i = 0;
 		//get default font
 		Font fontAt = workbook.getFontAt(i);
@@ -355,8 +357,8 @@
 		//get customized font
 		Font customFont = new XSSFFont();
 		customFont.setItalic(true);
-		Long x = styleSource.putFont(customFont);
-		fontAt = workbook.getFontAt(x.shortValue());
+		int x = styleSource.putFont(customFont);
+		fontAt = workbook.getFontAt((short)x);
 		assertNotNull(fontAt);
 	}
 	
@@ -432,7 +434,7 @@
 	public void testStyles() {
 		XSSFWorkbook workbook = XSSFTestDataSamples.openSampleWorkbook("Formatting.xlsx");
 		
-		StylesSource ss = workbook.getStylesSource();
+		StylesTable ss = workbook.getStylesSource();
 		assertNotNull(ss);
 		assertTrue(ss instanceof StylesTable);
 		StylesTable st = (StylesTable)ss;

Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java?rev=707839&r1=707838&r2=707839&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/helpers/TestColumnHelper.java
Sat Oct 25 04:48:50 2008
@@ -25,7 +25,6 @@
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
 
@@ -64,7 +63,7 @@
         // Remember - POI column 0 == OOXML column 1
         assertEquals((double) 88, helper.getColumn(0, false).getWidth());
         assertTrue(helper.getColumn(0, false).getHidden());
-        assertEquals((double) 00, helper.getColumn(1, false).getWidth());
+        assertEquals((double)0, helper.getColumn(1, false).getWidth());
         assertFalse(helper.getColumn(1, false).getHidden());
     }
 
@@ -260,7 +259,7 @@
     public void testGetSetColDefaultStyle() {
         XSSFWorkbook workbook = new XSSFWorkbook();
         XSSFSheet sheet = workbook.createSheet();
-        CTWorksheet ctWorksheet = sheet.getWorksheet();
+        CTWorksheet ctWorksheet = sheet.getCTWorksheet();
         ColumnHelper columnHelper = sheet.getColumnHelper();
         
         // POI column 3, OOXML column 4
@@ -271,7 +270,7 @@
         columnHelper.setColDefaultStyle(3, 2);
         assertEquals(2, columnHelper.getColDefaultStyle(3));
         assertEquals(-1, columnHelper.getColDefaultStyle(4));
-        StylesTable stylesTable = (StylesTable) workbook.getStylesSource();
+        StylesTable stylesTable = workbook.getStylesSource();
         CTXf cellXf = CTXf.Factory.newInstance();
         cellXf.setFontId(0);
         cellXf.setFillId(0);



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


Mime
View raw message