poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r668014 - in /poi/trunk/src: java/org/apache/poi/hssf/record/formula/Ref3DPtg.java testcases/org/apache/poi/hssf/data/testRVA.xls testcases/org/apache/poi/hssf/model/TestRVA.java
Date Sun, 15 Jun 2008 22:26:07 GMT
Author: josh
Date: Sun Jun 15 15:26:06 2008
New Revision: 668014

URL: http://svn.apache.org/viewvc?rev=668014&view=rev
Log:
added extra RVA test case (for bug 45206)

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java
    poi/trunk/src/testcases/org/apache/poi/hssf/data/testRVA.xls
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java?rev=668014&r1=668013&r2=668014&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/formula/Ref3DPtg.java Sun Jun 15 15:26:06
2008
@@ -15,11 +15,10 @@
    limitations under the License.
 ==================================================================== */
 
-
 package org.apache.poi.hssf.record.formula;
 
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.record.RecordInputStream;
+import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.CellReference;
 import org.apache.poi.hssf.util.RangeAddress;
 import org.apache.poi.hssf.util.SheetReferences;
@@ -69,16 +68,15 @@
     }
 
     public String toString() {
-        StringBuffer buffer = new StringBuffer();
-
-        buffer.append("Ref3dPtg\n");
-        buffer.append("Index to Extern Sheet = " + getExternSheetIndex()).append("\n");
-        buffer.append("Row = " + getRow()).append("\n");
-        buffer.append("Col  = " + getColumn()).append("\n");
-        buffer.append("ColRowRel= "
-        + isRowRelative()).append("\n");
-        buffer.append("ColRel   = " + isColRelative()).append("\n");
-        return buffer.toString();
+        CellReference cr = new CellReference(getRow(), getColumn(), !isRowRelative(),!isColRelative());
+        StringBuffer sb = new StringBuffer();
+        sb.append(getClass().getName());
+        sb.append(" [");
+        sb.append("sheetIx=").append(getExternSheetIndex());
+        sb.append(" ! ");
+        sb.append(cr.formatAsString());
+        sb.append("]");
+        return sb.toString();
     }
 
     public void writeBytes(byte [] array, int offset) {

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/data/testRVA.xls
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/data/testRVA.xls?rev=668014&r1=668013&r2=668014&view=diff
==============================================================================
Binary files - no diff available.

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java?rev=668014&r1=668013&r2=668014&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestRVA.java Sun Jun 15 15:26:06 2008
@@ -23,7 +23,6 @@
 import org.apache.poi.hssf.HSSFTestDataSamples;
 import org.apache.poi.hssf.record.formula.AttrPtg;
 import org.apache.poi.hssf.record.formula.Ptg;
-import org.apache.poi.hssf.record.formula.RefPtgBase;
 import org.apache.poi.hssf.usermodel.FormulaExtractor;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
@@ -60,7 +59,7 @@
 			}
 			String formula = cell.getCellFormula();
 			try {
-				confirmCell(cell, formula);
+				confirmCell(cell, formula, wb);
 			} catch (AssertionFailedError e) {
 				System.err.println("Problem with row[" + rowIx + "] formula '" + formula + "'");
 				System.err.println(e.getMessage());
@@ -79,9 +78,9 @@
 		}
 	}
 
-	private void confirmCell(HSSFCell formulaCell, String formula) {
+	private void confirmCell(HSSFCell formulaCell, String formula, HSSFWorkbook wb) {
 		Ptg[] excelPtgs = FormulaExtractor.getPtgs(formulaCell);
-		Ptg[] poiPtgs = FormulaParser.parse(formula, null);
+		Ptg[] poiPtgs = FormulaParser.parse(formula, wb);
 		int nExcelTokens = excelPtgs.length;
 		int nPoiTokens = poiPtgs.length;
 		if (nExcelTokens != nPoiTokens) {
@@ -122,6 +121,10 @@
 			}
 			sb.append(NEW_LINE);
 		}
+		if (false) { // set 'true' to see trace of RVA values
+			System.out.println(formula);
+			System.out.println(sb.toString());
+		}
 		if (hasMismatch) {
 			throw new AssertionFailedError(sb.toString());
 		}



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


Mime
View raw message