Author: sergey
Date: Mon Nov 5 12:39:58 2012
New Revision: 1405771
URL: http://svn.apache.org/viewvc?rev=1405771&view=rev
Log:
move test case for Bug 47563 to distinguish file
Added:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug47563.java
Modified:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
Added:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug47563.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug47563.java?rev=1405771&view=auto
==============================================================================
---
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug47563.java
(added)
+++
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBug47563.java
Mon Nov 5 12:39:58 2012
@@ -0,0 +1,86 @@
+/* ====================================================================
+ 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.hwpf.usermodel;
+
+import junit.framework.TestCase;
+
+import org.apache.poi.hwpf.HWPFDocument;
+import org.apache.poi.hwpf.HWPFTestDataSamples;
+
+/**
+ * Bug 47563 - Exception when working with table
+ */
+public class TestBug47563 extends TestCase {
+
+ public void test() throws Exception {
+ test(1, 5);
+ test(1, 6);
+ test(5, 1);
+ test(6, 1);
+ test(2, 2);
+ test(3, 2);
+ test(2, 3);
+ test(3, 3);
+ }
+
+ private void test(int rows, int columns) throws Exception {
+ // POI apparently can't create a document from scratch,
+ // so we need an existing empty dummy document
+ HWPFDocument doc =
HWPFTestDataSamples.openSampleFile("empty.doc");
+
+ Range range = doc.getRange();
+ range.sanityCheck();
+
+ Table table = range.insertTableBefore((short) columns, rows);
+ table.sanityCheck();
+
+ for (int rowIdx = 0; rowIdx < table.numRows(); rowIdx++) {
+ TableRow row = table.getRow(rowIdx);
+ row.sanityCheck();
+
+ System.out.println("row " + rowIdx);
+ for (int colIdx = 0; colIdx < row.numCells(); colIdx++)
{
+ TableCell cell = row.getCell(colIdx);
+ cell.sanityCheck();
+
+ System.out.println("column " + colIdx + ", num
paragraphs "
+ + cell.numParagraphs());
+
+ Paragraph par = cell.getParagraph(0);
+ par.sanityCheck();
+
+ par.insertBefore("" + (rowIdx * row.numCells()
+ colIdx));
+ par.sanityCheck();
+
+ row.sanityCheck();
+ table.sanityCheck();
+ range.sanityCheck();
+
+ }
+ }
+
+ String text = range.text();
+ int mustBeAfter = 0;
+ for (int i = 0; i < rows * columns; i++) {
+ int next = text.indexOf(Integer.toString(i),
mustBeAfter);
+ assertFalse(next == -1);
+ mustBeAfter = next;
+ }
+ }
+
+
+}
Modified:
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java?rev=1405771&r1=1405770&r2=1405771&view=diff
==============================================================================
---
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
(original)
+++
poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestBugs.java
Mon Nov 5 12:39:58 2012
@@ -109,49 +109,6 @@ public class TestBugs extends TestCase
+ "Please resolve the issue in Bugzilla and remove
fail() from the test" );
}
- private static void test47563_insertTable( int rows, int columns )
- {
- // POI apparently can't create a document from scratch,
- // so we need an existing empty dummy document
- HWPFDocument doc = HWPFTestDataSamples.openSampleFile( "empty.doc" );
-
- Range range = doc.getRange();
- Table table = range.insertTableBefore( (short) columns, rows );
- table.sanityCheck();
- range.sanityCheck();
-
- for ( int rowIdx = 0; rowIdx < table.numRows(); rowIdx++ )
- {
- TableRow row = table.getRow( rowIdx );
- row.sanityCheck();
- for ( int colIdx = 0; colIdx < row.numCells(); colIdx++ )
- {
- TableCell cell = row.getCell( colIdx );
- cell.sanityCheck();
-
- Paragraph par = cell.getParagraph( 0 );
- par.sanityCheck();
-
- par.insertBefore( "" + ( rowIdx * row.numCells() + colIdx ) );
-
- par.sanityCheck();
- cell.sanityCheck();
- row.sanityCheck();
- table.sanityCheck();
- range.sanityCheck();
- }
- }
-
- String text = range.text();
- int mustBeAfter = 0;
- for ( int i = 0; i < rows * columns; i++ )
- {
- int next = text.indexOf( Integer.toString( i ), mustBeAfter );
- assertFalse( next == -1 );
- mustBeAfter = next;
- }
- }
-
/**
* Bug 33519 - HWPF fails to read a file
*/
@@ -413,21 +370,6 @@ public class TestBugs extends TestCase
}
/**
- * [RESOLVED FIXED] Bug 47563 - Exception when working with table
- */
- public void test47563()
- {
- test47563_insertTable( 1, 5 );
- test47563_insertTable( 1, 6 );
- test47563_insertTable( 5, 1 );
- test47563_insertTable( 6, 1 );
- test47563_insertTable( 2, 2 );
- test47563_insertTable( 3, 2 );
- test47563_insertTable( 2, 3 );
- test47563_insertTable( 3, 3 );
- }
-
- /**
* [RESOLVED FIXED] Bug 47731 - Word Extractor considers text copied from
* some website as an embedded object
*/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]