poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r706003 [2/2] - in /poi/branches/ooxml/src/ooxml: interfaces-jdk15/org/apache/poi/ss/usermodel/ java/org/apache/poi/ java/org/apache/poi/xssf/eventusermodel/ java/org/apache/poi/xssf/model/ java/org/apache/poi/xssf/usermodel/ testcases/org/...
Date Sun, 19 Oct 2008 12:54:42 GMT
Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPrintSetup.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPrintSetup.java?rev=706003&r1=706002&r2=706003&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPrintSetup.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFPrintSetup.java
Sun Oct 19 05:54:40 2008
@@ -19,191 +19,188 @@
 
 import junit.framework.TestCase;
 
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageMargins;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTPageSetup;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellComments;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STOrientation;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPageOrder;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
 
 /**
  * Tests for {@link XSSFPrintSetup}
- *
  */
 public class TestXSSFPrintSetup extends TestCase {
 
 
-    public void testConstructor(){
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	CTPageMargins pMargins=CTPageMargins.Factory.newInstance();
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, pMargins);
-	assertNotNull(printSetup);
-
-	XSSFWorkbook wb=new XSSFWorkbook();
-	printSetup=new XSSFPrintSetup(wb.createSheet());
-	assertNotNull(printSetup);
-    }
-
     public void testSetGetPaperSize() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setPaperSize(9);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(PaperSize.A4_PAPER,printSetup.getPaperSizeEnum());
-	assertEquals(9,printSetup.getPaperSize());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setPaperSize(9);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(PaperSize.A4_PAPER, printSetup.getPaperSizeEnum());
+        assertEquals(9, printSetup.getPaperSize());
 
-	printSetup.setPaperSize(PaperSize.A3_PAPER);
-	assertEquals(8,pSetup.getPaperSize());
+        printSetup.setPaperSize(PaperSize.A3_PAPER);
+        assertEquals(8, pSetup.getPaperSize());
     }
 
 
     public void testSetGetScale() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setScale(9);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(9,printSetup.getScale());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setScale(9);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(9, printSetup.getScale());
 
-	printSetup.setScale((short)100);
-	assertEquals(100,pSetup.getScale());
+        printSetup.setScale((short) 100);
+        assertEquals(100, pSetup.getScale());
     }
 
     public void testSetGetPageStart() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setFirstPageNumber(9);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(9,printSetup.getPageStart());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setFirstPageNumber(9);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(9, printSetup.getPageStart());
 
-	printSetup.setPageStart((short)1);
-	assertEquals(1,pSetup.getFirstPageNumber());
+        printSetup.setPageStart((short) 1);
+        assertEquals(1, pSetup.getFirstPageNumber());
     }
 
 
     public void testSetGetFitWidthHeight() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setFitToWidth(50);
-	pSetup.setFitToHeight(99);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(50,printSetup.getFitWidth());
-	assertEquals(99,printSetup.getFitHeight());
-
-	printSetup.setFitWidth((short)66);
-	printSetup.setFitHeight((short)80);
-	assertEquals(66,pSetup.getFitToWidth());
-	assertEquals(80,pSetup.getFitToHeight());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setFitToWidth(50);
+        pSetup.setFitToHeight(99);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(50, printSetup.getFitWidth());
+        assertEquals(99, printSetup.getFitHeight());
+
+        printSetup.setFitWidth((short) 66);
+        printSetup.setFitHeight((short) 80);
+        assertEquals(66, pSetup.getFitToWidth());
+        assertEquals(80, pSetup.getFitToHeight());
 
     }
 
     public void testSetGetLeftToRight() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setPageOrder(STPageOrder.DOWN_THEN_OVER);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getLeftToRight());
-	
-	printSetup.setLeftToRight(true);
-	assertEquals(PageOrder.OVER_THEN_DOWN.getValue(),pSetup.getPageOrder());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setPageOrder(STPageOrder.DOWN_THEN_OVER);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getLeftToRight());
+
+        printSetup.setLeftToRight(true);
+        assertEquals(PageOrder.OVER_THEN_DOWN.getValue(), pSetup.getPageOrder().intValue());
     }
 
     public void testSetGetOrientation() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setOrientation(STOrientation.PORTRAIT);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(PrintOrientation.PORTRAIT,printSetup.getOrientation());
-	assertEquals(false,printSetup.getLandscape());
-	assertEquals(false,printSetup.getNoOrientation());
-
-	printSetup.setOrientation(PrintOrientation.LANDSCAPE);
-	assertEquals(pSetup.getOrientation(),printSetup.getOrientation().getValue());
-	assertEquals(true,printSetup.getLandscape());
-	assertEquals(false,printSetup.getNoOrientation());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setOrientation(STOrientation.PORTRAIT);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(PrintOrientation.PORTRAIT, printSetup.getOrientation());
+        assertEquals(false, printSetup.getLandscape());
+        assertEquals(false, printSetup.getNoOrientation());
+
+        printSetup.setOrientation(PrintOrientation.LANDSCAPE);
+        assertEquals(pSetup.getOrientation().intValue(), printSetup.getOrientation().getValue());
+        assertEquals(true, printSetup.getLandscape());
+        assertEquals(false, printSetup.getNoOrientation());
     }
 
 
     public void testSetGetValidSettings() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setUsePrinterDefaults(false);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getValidSettings());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setUsePrinterDefaults(false);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getValidSettings());
 
-	printSetup.setValidSettings(true);
-	assertEquals(true,pSetup.getUsePrinterDefaults());
+        printSetup.setValidSettings(true);
+        assertEquals(true, pSetup.getUsePrinterDefaults());
     }
 
     public void testSetGetNoColor() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setBlackAndWhite(false);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getNoColor());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setBlackAndWhite(false);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getNoColor());
 
-	printSetup.setNoColor(true);
-	assertEquals(true,pSetup.getBlackAndWhite());
+        printSetup.setNoColor(true);
+        assertEquals(true, pSetup.getBlackAndWhite());
     }
 
     public void testSetGetDraft() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setDraft(false);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getDraft());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setDraft(false);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getDraft());
 
-	printSetup.setDraft(true);
-	assertEquals(true,pSetup.getDraft());
+        printSetup.setDraft(true);
+        assertEquals(true, pSetup.getDraft());
     }
 
     public void testSetGetNotes() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setCellComments(STCellComments.NONE);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getNotes());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setCellComments(STCellComments.NONE);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getNotes());
 
-	printSetup.setNotes(true);
-	assertEquals(PrintCellComments.AS_DISPLAYED.getValue(),pSetup.getCellComments());
+        printSetup.setNotes(true);
+        assertEquals(PrintCellComments.AS_DISPLAYED.getValue(), pSetup.getCellComments().intValue());
     }
 
 
     public void testSetGetUsePage() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setUseFirstPageNumber(false);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(false,printSetup.getUsePage());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setUseFirstPageNumber(false);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(false, printSetup.getUsePage());
 
-	printSetup.setUsePage(true);
-	assertEquals(true,pSetup.getUseFirstPageNumber());
+        printSetup.setUsePage(true);
+        assertEquals(true, pSetup.getUseFirstPageNumber());
     }
 
     public void testSetGetHVResolution() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setHorizontalDpi(120);
-	pSetup.setVerticalDpi(100);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(120,printSetup.getHResolution());
-	assertEquals(100,printSetup.getVResolution());
-
-	printSetup.setHResolution((short)150);
-	printSetup.setVResolution((short)130);
-	assertEquals(150,pSetup.getHorizontalDpi());
-	assertEquals(130,pSetup.getVerticalDpi());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setHorizontalDpi(120);
+        pSetup.setVerticalDpi(100);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(120, printSetup.getHResolution());
+        assertEquals(100, printSetup.getVResolution());
+
+        printSetup.setHResolution((short) 150);
+        printSetup.setVResolution((short) 130);
+        assertEquals(150, pSetup.getHorizontalDpi());
+        assertEquals(130, pSetup.getVerticalDpi());
     }
 
     public void testSetGetHeaderFooterMargin() {
-	CTPageMargins pMargins=CTPageMargins.Factory.newInstance();
-	pMargins.setHeader(1.5);
-	pMargins.setFooter(2);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup( null, pMargins);
-	assertEquals(1.5,printSetup.getHeaderMargin());
-	assertEquals(2.0,printSetup.getFooterMargin());
-
-	printSetup.setHeaderMargin(5);
-	printSetup.setFooterMargin(3.5);
-	assertEquals(5.0,pMargins.getHeader());
-	assertEquals(3.5,pMargins.getFooter());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageMargins pMargins = worksheet.addNewPageMargins();
+        pMargins.setHeader(1.5);
+        pMargins.setFooter(2);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(1.5, printSetup.getHeaderMargin());
+        assertEquals(2.0, printSetup.getFooterMargin());
+
+        printSetup.setHeaderMargin(5);
+        printSetup.setFooterMargin(3.5);
+        assertEquals(5.0, pMargins.getHeader());
+        assertEquals(3.5, pMargins.getFooter());
     }
 
     public void testSetGetCopies() {
-	CTPageSetup pSetup=CTPageSetup.Factory.newInstance();
-	pSetup.setCopies(9);
-	XSSFPrintSetup printSetup=new XSSFPrintSetup(pSetup, null);
-	assertEquals(9,printSetup.getCopies());
+        CTWorksheet worksheet = CTWorksheet.Factory.newInstance();
+        CTPageSetup pSetup = worksheet.addNewPageSetup();
+        pSetup.setCopies(9);
+        XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
+        assertEquals(9, printSetup.getCopies());
 
-	printSetup.setCopies((short)15);
-	assertEquals(15,pSetup.getCopies());
+        printSetup.setCopies((short) 15);
+        assertEquals(15, pSetup.getCopies());
     }
 
-
 }

Modified: poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java
URL: http://svn.apache.org/viewvc/poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java?rev=706003&r1=706002&r2=706003&view=diff
==============================================================================
--- poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java
(original)
+++ poi/branches/ooxml/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFRow.java
Sun Oct 19 05:54:40 2008
@@ -43,7 +43,8 @@
      * Test adding cells to a row in various places and see if we can find them again.
      */
     public void testAddAndIterateCells() {
-        XSSFRow row = new XSSFRow(createParentObjects());
+        XSSFSheet sheet = createParentObjects();
+        XSSFRow row = sheet.createRow(0);
 
         // One cell at the beginning
         Cell cell1 = row.createCell((short) 1);
@@ -125,7 +126,8 @@
         assertFalse(row.getFirstCellNum() == (short) 2);
 
         // Test a row without cells
-        XSSFRow emptyRow = new XSSFRow(createParentObjects());
+        XSSFSheet sheet = createParentObjects();
+        XSSFRow emptyRow = sheet.createRow(0);
         assertEquals(-1, emptyRow.getFirstCellNum());
     }
 
@@ -155,7 +157,8 @@
      * Tests for the missing/blank cell policy stuff
      */
     public void testGetCellPolicy() throws Exception {
-        XSSFRow row = new XSSFRow(createParentObjects());
+        XSSFSheet sheet = createParentObjects();
+        XSSFRow row = sheet.createRow(0);
 
         // 0 -> string
         // 1 -> num
@@ -214,7 +217,8 @@
      * @return row
      */
     private static XSSFRow getSampleRow() {
-        XSSFRow row = new XSSFRow(createParentObjects());
+        XSSFSheet sheet = createParentObjects();
+        XSSFRow row = sheet.createRow(0);
         row.createCell((short) 2);
         row.createCell((short) 3, Cell.CELL_TYPE_NUMERIC);
         row.createCell((short) 4);

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=706003&r1=706002&r2=706003&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
Sun Oct 19 05:54:40 2008
@@ -35,7 +35,6 @@
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
-import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
@@ -284,7 +283,7 @@
 
     public void testGetFooter() {
         XSSFWorkbook workbook = new XSSFWorkbook();
-        XSSFSheet sheet = (XSSFSheet)workbook.createSheet("Sheet 1");
+        XSSFSheet sheet = workbook.createSheet("Sheet 1");
         assertNotNull(sheet.getFooter());
         sheet.getFooter().setCenter("test center footer");
         assertEquals("test center footer", sheet.getFooter().getCenter());
@@ -610,31 +609,25 @@
     
     public void testGetCellComment() {
         XSSFWorkbook workbook = new XSSFWorkbook();
-        CTSheet ctSheet = CTSheet.Factory.newInstance();
-        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-        CTComments ctComments = CTComments.Factory.newInstance();
-        CommentsTable sheetComments = new CommentsTable(ctComments);
-        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook, sheetComments);
-        assertNotNull(sheet);
-        
-        CTComment ctComment = ctComments.addNewCommentList().insertNewComment(0);
-        ctComment.setRef("C10");
-        ctComment.setAuthorId(sheetComments.findAuthor("test C10 author"));
-        
+        XSSFSheet sheet = workbook.createSheet();
+        XSSFComment comment = sheet.createComment();
+        comment.setAuthor("test C10 author");
+        sheet.setCellComment("C10", comment);
+
         assertNotNull(sheet.getCellComment(9, 2));
         assertEquals("test C10 author", sheet.getCellComment(9, 2).getAuthor());
     }
     
     public void testSetCellComment() {
         XSSFWorkbook workbook = new XSSFWorkbook();
-        CTSheet ctSheet = CTSheet.Factory.newInstance();
-        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook);
+        XSSFSheet sheet = workbook.createSheet();
+
+        XSSFComment comment = sheet.createComment();
+
         Cell cell = sheet.createRow(0).createCell((short)0);
-        CTComments ctComments = CTComments.Factory.newInstance();
-        CommentsTable comments = new CommentsTable(ctComments);
-        XSSFComment comment = comments.addComment();
-        
+        CommentsTable comments = (CommentsTable)sheet.getCommentsSourceIfExists();
+        CTComments ctComments = comments.getCTComments();
+
         sheet.setCellComment("A1", comment);
         assertEquals("A1", ctComments.getCommentList().getCommentArray(0).getRef());
         comment.setAuthor("test A1 author");
@@ -651,10 +644,10 @@
     }
     
     public void testCreateFreezePane() {
-    	Workbook workbook = new XSSFWorkbook();
-    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+    	XSSFWorkbook workbook = new XSSFWorkbook();
+    	XSSFSheet sheet = workbook.createSheet();
+        CTWorksheet ctWorksheet = sheet.getWorksheet();
+
     	sheet.createFreezePane(2, 4);
     	assertEquals((double)2, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
     	assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
@@ -668,20 +661,17 @@
     }
     
     public void testNewMergedRegionAt() {
-    	Workbook workbook = new XSSFWorkbook();
-    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        XSSFSheet sheet = workbook.createSheet();
     	Region region = new Region("B2:D4");
     	sheet.addMergedRegion(region);
     	assertEquals("B2:D4", sheet.getMergedRegionAt(0).getRegionRef());
     }
     
     public void testGetNumMergedRegions() {
-    	Workbook workbook = new XSSFWorkbook();
-    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        XSSFSheet sheet = workbook.createSheet();
+        CTWorksheet ctWorksheet = sheet.getWorksheet();
     	assertEquals(0, sheet.getNumMergedRegions());
     	Region region = new Region("B2:D4");
     	sheet.addMergedRegion(region);
@@ -689,10 +679,9 @@
     }
     
     public void testRemoveMergedRegion() {
-    	Workbook workbook = new XSSFWorkbook();
-    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+        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");
@@ -710,11 +699,10 @@
     }
     
     public void testSetDefaultColumnStyle() {
-    	XSSFWorkbook workbook = new XSSFWorkbook();
-    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
-    	StylesTable stylesTable = (StylesTable) workbook.getStylesSource();
+        XSSFWorkbook workbook = new XSSFWorkbook();
+        XSSFSheet sheet = workbook.createSheet();
+        CTWorksheet ctWorksheet = sheet.getWorksheet();
+    	StylesTable stylesTable = workbook.getStylesSource();
     	XSSFFont font = new XSSFFont();
     	font.setFontName("Cambria");
     	stylesTable.putFont(font);
@@ -766,10 +754,8 @@
 	
 	
 	   public void testGroupUngroupColumn() {
-	    	Workbook workbook = new XSSFWorkbook();
-	    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-	    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-	    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+           XSSFWorkbook workbook = new XSSFWorkbook();
+           XSSFSheet sheet = workbook.createSheet();
 
 	    	//one level
 	    	sheet.groupColumn((short)2,(short)7);
@@ -811,10 +797,8 @@
 
 	    
 	    public void testGroupUngroupRow() {
-	    	Workbook workbook = new XSSFWorkbook();
-	    	CTSheet ctSheet = CTSheet.Factory.newInstance();
-	    	CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-	    	XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, (XSSFWorkbook) workbook);
+            XSSFWorkbook workbook = new XSSFWorkbook();
+            XSSFSheet sheet = workbook.createSheet();
 
 	    	//one level
 	    	sheet.groupRow(9,10);

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=706003&r1=706002&r2=706003&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
Sun Oct 19 05:54:40 2008
@@ -259,9 +259,8 @@
     
     public void testGetSetColDefaultStyle() {
         XSSFWorkbook workbook = new XSSFWorkbook();
-        CTSheet ctSheet = CTSheet.Factory.newInstance();
-        CTWorksheet ctWorksheet = CTWorksheet.Factory.newInstance();
-        XSSFSheet sheet = new XSSFSheet(ctSheet, ctWorksheet, workbook);
+        XSSFSheet sheet = workbook.createSheet();
+        CTWorksheet ctWorksheet = sheet.getWorksheet();
         ColumnHelper columnHelper = sheet.getColumnHelper();
         
         // POI column 3, OOXML column 4



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


Mime
View raw message