poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r740162 - in /poi/trunk/src/testcases/org/apache/poi/hssf: model/TestFormulaParserEval.java record/TestNameRecord.java usermodel/TestDataValidation.java usermodel/TestNamedRange.java
Date Tue, 03 Feb 2009 00:34:14 GMT
Author: josh
Date: Tue Feb  3 00:34:14 2009
New Revision: 740162

URL: http://svn.apache.org/viewvc?rev=740162&view=rev
Log:
Fixed use of deprecated property HSSFName.reference (should be refersToFormula)

Modified:
    poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java
    poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java?rev=740162&r1=740161&r2=740162&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/model/TestFormulaParserEval.java Tue Feb 
3 00:34:14 2009
@@ -49,17 +49,17 @@
 
 		HSSFName name = workbook.createName();
 		name.setNameName("testName");
-		name.setReference("A1:A2");
+		name.setRefersToFormula("A1:A2");
 
 		confirmParseFormula(workbook);
 
 		// Now make it a single cell
-		name.setReference("C3");
+		name.setRefersToFormula("C3");
 		confirmParseFormula(workbook);
 		
 		// And make it non-contiguous
 		// using area unions
-		name.setReference("A1:A2,C3");
+		name.setRefersToFormula("A1:A2,C3");
 		
 		confirmParseFormula(workbook);
 	}

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java?rev=740162&r1=740161&r2=740162&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/record/TestNameRecord.java Tue Feb  3 00:34:14
2009
@@ -64,11 +64,11 @@
 		HSSFName name = wb.createName();
 		wb.createSheet("Sheet1");
 		name.setNameName("test");
-		name.setReference("Sheet1!$B$3");
-		if (name.getReference().equals("Sheet1!B3")) {
+		name.setRefersToFormula("Sheet1!$B$3");
+		if (name.getRefersToFormula().equals("Sheet1!B3")) {
 			throw new AssertionFailedError("Identified bug 46174");
 		}
-		assertEquals("Sheet1!$B$3", name.getReference());
+		assertEquals("Sheet1!$B$3", name.getRefersToFormula());
 	}
 	public void testFormulaGeneral() {
 		// perhaps this testcase belongs on TestHSSFName

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java?rev=740162&r1=740161&r2=740162&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java Tue Feb
 3 00:34:14 2009
@@ -36,7 +36,6 @@
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddressList;
-import org.apache.poi.ss.util.Region;
 
 /**
  * Class for testing Excel's data validation mechanism
@@ -385,7 +384,7 @@
 		va.addListValidation(null, strFormula, strFormula, false, false);
 		HSSFName namedRange = wb.createName();
 		namedRange.setNameName("myName");
-		namedRange.setReference(dataSheetName + "!$A$2:$A$7");
+		namedRange.setRefersToFormula(dataSheetName + "!$A$2:$A$7");
 		strFormula = "myName";
 		va.addListValidation(null, strFormula, strFormula, false, false);
 		strFormula = "offset(myName, 2, 1, 4, 2)"; // Note about last param '2': 

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java?rev=740162&r1=740161&r2=740162&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestNamedRange.java Tue Feb  3 00:34:14
2009
@@ -56,7 +56,7 @@
         //Setting its name
         newNamedRange.setNameName("RangeTest");
         //Setting its reference
-        newNamedRange.setReference(sheetName + "!$D$4:$E$8");
+        newNamedRange.setRefersToFormula(sheetName + "!$D$4:$E$8");
 
         //Getting NAmed Range
         HSSFName namedRange1 = wb.getNameAt(0);
@@ -70,7 +70,7 @@
         wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
         HSSFName nm =wb.getNameAt(wb.getNameIndex("RangeTest"));
         assertTrue("Name is "+nm.getNameName(),"RangeTest".equals(nm.getNameName()));
-        assertEquals(wb.getSheetName(0)+"!$D$4:$E$8", nm.getReference());
+        assertEquals(wb.getSheetName(0)+"!$D$4:$E$8", nm.getRefersToFormula());
     }
 
     /**
@@ -89,13 +89,13 @@
         String sheetName = wb.getSheetName(0);
 
         //Getting its reference
-        String reference = namedRange1.getReference();
+        String reference = namedRange1.getRefersToFormula();
 
         assertEquals(sheetName+"!$A$1:$D$10", reference);
 
         HSSFName namedRange2 = wb.getNameAt(1);
 
-        assertEquals(sheetName+"!$D$17:$G$27", namedRange2.getReference());
+        assertEquals(sheetName+"!$D$17:$G$27", namedRange2.getRefersToFormula());
         assertEquals("SecondNamedRange", namedRange2.getNameName());
     }
 
@@ -110,13 +110,13 @@
         HSSFName name = wb.getNameAt(0);
         String sheetName = wb.getSheetName(0);
 
-        assertEquals(sheetName+"!$A$1:$D$10", name.getReference());
+        assertEquals(sheetName+"!$A$1:$D$10", name.getRefersToFormula());
 
         name = wb.getNameAt(1);
         String newReference = sheetName +"!$A$1:$C$36";
 
-        name.setReference(newReference);
-        assertEquals(newReference, name.getReference());
+        name.setRefersToFormula(newReference);
+        assertEquals(newReference, name.getRefersToFormula());
     }
 
     /**
@@ -135,24 +135,24 @@
         HSSFName newNamedRange = wb.createName();
 
         newNamedRange.setNameName("RangeTest");
-        newNamedRange.setReference(sheetName + "!$D$4:$E$8");
+        newNamedRange.setRefersToFormula(sheetName + "!$D$4:$E$8");
 
         //Creating another new Named Range
         HSSFName newNamedRange2 = wb.createName();
 
         newNamedRange2.setNameName("AnotherTest");
-        newNamedRange2.setReference(sheetName + "!$F$1:$G$6");
+        newNamedRange2.setRefersToFormula(sheetName + "!$F$1:$G$6");
 
         wb.getNameAt(0);
 
         wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
         HSSFName nm =wb.getNameAt(wb.getNameIndex("RangeTest"));
         assertTrue("Name is "+nm.getNameName(),"RangeTest".equals(nm.getNameName()));
-        assertTrue("Reference is "+nm.getReference(),(wb.getSheetName(0)+"!$D$4:$E$8").equals(nm.getReference()));
+        assertTrue("Reference is "+nm.getRefersToFormula(),(wb.getSheetName(0)+"!$D$4:$E$8").equals(nm.getRefersToFormula()));
 
         nm = wb.getNameAt(wb.getNameIndex("AnotherTest"));
         assertTrue("Name is "+nm.getNameName(),"AnotherTest".equals(nm.getNameName()));
-        assertTrue("Reference is "+nm.getReference(),newNamedRange2.getReference().equals(nm.getReference()));
+        assertTrue("Reference is "+nm.getRefersToFormula(),newNamedRange2.getRefersToFormula().equals(nm.getRefersToFormula()));
     }
 
     /**
@@ -181,7 +181,7 @@
          namedRange1.setNameName("RangeTest1");
 
          // Set the reference for the named range for worksheet 'sheet1'
-         namedRange1.setReference("sheet1" + "!$A$1:$L$41");
+         namedRange1.setRefersToFormula("sheet1" + "!$A$1:$L$41");
 
          // Create a new named range for worksheet 'sheet2'
          HSSFName namedRange2 = wb.createName();
@@ -190,18 +190,18 @@
          namedRange2.setNameName("RangeTest2");
 
          // Set the reference for the named range for worksheet 'sheet2'
-         namedRange2.setReference("sheet2" + "!$A$1:$O$21");
+         namedRange2.setRefersToFormula("sheet2" + "!$A$1:$O$21");
 
          // Write the workbook to a file
          // Read the Excel file and verify its content
          wb = HSSFTestDataSamples.writeOutAndReadBack(wb);
          HSSFName nm1 =wb.getNameAt(wb.getNameIndex("RangeTest1"));
          assertTrue("Name is "+nm1.getNameName(),"RangeTest1".equals(nm1.getNameName()));
-         assertTrue("Reference is "+nm1.getReference(),(wb.getSheetName(0)+"!$A$1:$L$41").equals(nm1.getReference()));
+         assertTrue("Reference is "+nm1.getRefersToFormula(),(wb.getSheetName(0)+"!$A$1:$L$41").equals(nm1.getRefersToFormula()));
 
          HSSFName nm2 =wb.getNameAt(wb.getNameIndex("RangeTest2"));
          assertTrue("Name is "+nm2.getNameName(),"RangeTest2".equals(nm2.getNameName()));
-         assertTrue("Reference is "+nm2.getReference(),(wb.getSheetName(1)+"!$A$1:$O$21").equals(nm2.getReference()));
+         assertTrue("Reference is "+nm2.getRefersToFormula(),(wb.getSheetName(1)+"!$A$1:$O$21").equals(nm2.getRefersToFormula()));
      }
 
     public void testUnicodeNamedRange() {
@@ -209,14 +209,14 @@
         workBook.createSheet("Test");
         HSSFName name = workBook.createName();
         name.setNameName("\u03B1");
-        name.setReference("Test!$D$3:$E$8");
+        name.setRefersToFormula("Test!$D$3:$E$8");
 
 
         HSSFWorkbook workBook2 = HSSFTestDataSamples.writeOutAndReadBack(workBook);
         HSSFName name2 = workBook2.getNameAt(0);
 
         assertEquals("\u03B1", name2.getNameName());
-        assertEquals("Test!$D$3:$E$8", name2.getReference());
+        assertEquals("Test!$D$3:$E$8", name2.getRefersToFormula());
     }
 
      /**
@@ -402,7 +402,7 @@
         HSSFName namedCell = wb.createName();
         namedCell.setNameName(cellName);
         String reference = "'" + sheetName + "'" + "!A1:A1";
-        namedCell.setReference(reference);
+        namedCell.setRefersToFormula(reference);
 
         // retrieve the newly created named range
         int namedCellIdx = wb.getNameIndex(cellName);
@@ -410,7 +410,7 @@
         assertNotNull(aNamedCell);
 
         // retrieve the cell at the named range and test its contents
-        AreaReference aref = new AreaReference(aNamedCell.getReference());
+        AreaReference aref = new AreaReference(aNamedCell.getRefersToFormula());
         assertTrue("Should be exactly 1 cell in the named cell :'" +cellName+"'", aref.isSingleCell());
 
         CellReference cref = aref.getFirstCell();
@@ -438,7 +438,7 @@
         HSSFName namedCell = wb.createName();
         namedCell.setNameName(cname);
         String reference = sname+"!A1";
-        namedCell.setReference(reference);
+        namedCell.setRefersToFormula(reference);
 
         // retrieve the newly created named range
         int namedCellIdx = wb.getNameIndex(cname);
@@ -446,7 +446,7 @@
         assertNotNull(aNamedCell);
 
         // retrieve the cell at the named range and test its contents
-        CellReference cref = new CellReference(aNamedCell.getReference());
+        CellReference cref = new CellReference(aNamedCell.getRefersToFormula());
         assertNotNull(cref);
         HSSFSheet s = wb.getSheet(cref.getSheetName());
         HSSFRow r = sheet.getRow(cref.getRow());
@@ -461,16 +461,16 @@
 
         HSSFName name1 = wb.getNameAt(0);
         assertEquals("a", name1.getNameName());
-        assertEquals("Sheet1!$A$1", name1.getReference());
-        new AreaReference(name1.getReference());
+        assertEquals("Sheet1!$A$1", name1.getRefersToFormula());
+        new AreaReference(name1.getRefersToFormula());
         assertTrue("Successfully constructed first reference", true);
 
         HSSFName name2 = wb.getNameAt(1);
         assertEquals("b", name2.getNameName());
-        assertEquals("Sheet1!#REF!", name2.getReference());
+        assertEquals("Sheet1!#REF!", name2.getRefersToFormula());
         assertTrue(name2.isDeleted());
         try {
-            new AreaReference(name2.getReference());
+            new AreaReference(name2.getRefersToFormula());
             fail("attempt to supply an invalid reference to AreaReference constructor results
in exception");
         } catch (StringIndexOutOfBoundsException e) { // TODO - use a different exception
for this condition
             // expected during successful test
@@ -494,9 +494,9 @@
         assertEquals("Print_Titles", nr1.getNameName());
         if (false) {
             // 	TODO - full column references not rendering properly, absolute markers not
present either
-            assertEquals("FirstSheet!$A:$A,FirstSheet!$1:$3", nr1.getReference());
+            assertEquals("FirstSheet!$A:$A,FirstSheet!$1:$3", nr1.getRefersToFormula());
         } else {
-            assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getReference());
+            assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getRefersToFormula());
         }
 
         // Save and re-open
@@ -506,7 +506,7 @@
         nr1 = nwb.getNameAt(0);
 
         assertEquals("Print_Titles", nr1.getNameName());
-        assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getReference());
+        assertEquals("FirstSheet!A:A,FirstSheet!$A$1:$IV$3", nr1.getRefersToFormula());
 
         // check that setting RR&C on a second sheet causes a new Print_Titles built-in
         // name to be created
@@ -517,7 +517,7 @@
         HSSFName nr2 = nwb.getNameAt(1);
 
         assertEquals("Print_Titles", nr2.getNameName());
-        assertEquals("SecondSheet!B:C,SecondSheet!$A$1:$IV$1", nr2.getReference());
+        assertEquals("SecondSheet!B:C,SecondSheet!$A$1:$IV$1", nr2.getRefersToFormula());
 
         if (false) {
             // In case you fancy checking in excel, to ensure it



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


Mime
View raw message