aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2009-12-22 00:51:29 +0000
committerJosh Micich <josh@apache.org>2009-12-22 00:51:29 +0000
commit1fd52310cd92e6c426950d8045aafe3fb0d0ea6a (patch)
tree68995a5448799750ce7db91594de9525dfdcb7fa /src/testcases/org/apache
parent66d86cb8dab832860b4dc8c23d4059f395960860 (diff)
downloadpoi-1fd52310cd92e6c426950d8045aafe3fb0d0ea6a.tar.gz
poi-1fd52310cd92e6c426950d8045aafe3fb0d0ea6a.zip
Renamed model.Workbook to InternalWorkbook to alleviate name clash.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@893050 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache')
-rw-r--r--src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java56
-rw-r--r--src/testcases/org/apache/poi/hssf/model/TestWorkbook.java16
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java4
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java22
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java4
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java8
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java4
-rw-r--r--src/testcases/org/apache/poi/hssf/util/TestAreaReference.java105
8 files changed, 107 insertions, 112 deletions
diff --git a/src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java b/src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java
index 2c56ea57a1..483a38d755 100644
--- a/src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java
+++ b/src/testcases/org/apache/poi/hssf/eventusermodel/TestEventWorkbookBuilder.java
@@ -27,7 +27,7 @@ import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.eventusermodel.EventWorkbookBuilder.SheetRecordCollectingListener;
import org.apache.poi.hssf.model.HSSFFormulaParser;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.FormulaRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.formula.Ptg;
@@ -41,13 +41,13 @@ import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public final class TestEventWorkbookBuilder extends TestCase {
private MockHSSFListener mockListen;
private SheetRecordCollectingListener listener;
-
+
public void setUp() {
HSSFRequest req = new HSSFRequest();
mockListen = new MockHSSFListener();
listener = new SheetRecordCollectingListener(mockListen);
req.addListenerForAllRecords(listener);
-
+
HSSFEventFactory factory = new HSSFEventFactory();
try {
InputStream is = HSSFTestDataSamples.openSampleFileStream("3dFormulas.xls");
@@ -56,94 +56,94 @@ public final class TestEventWorkbookBuilder extends TestCase {
} catch (IOException e) {
throw new RuntimeException(e);
}
- }
-
+ }
+
public void testBasics() {
assertNotNull(listener.getSSTRecord());
assertNotNull(listener.getBoundSheetRecords());
assertNotNull(listener.getExternSheetRecords());
}
-
+
public void testGetStubWorkbooks() {
assertNotNull(listener.getStubWorkbook());
assertNotNull(listener.getStubHSSFWorkbook());
}
-
+
public void testContents() {
assertEquals(2, listener.getSSTRecord().getNumStrings());
assertEquals(3, listener.getBoundSheetRecords().length);
assertEquals(1, listener.getExternSheetRecords().length);
-
+
assertEquals(3, listener.getStubWorkbook().getNumSheets());
-
- Workbook ref = listener.getStubWorkbook();
+
+ InternalWorkbook ref = listener.getStubWorkbook();
assertEquals("Sh3", ref.findSheetNameFromExternSheet(0));
assertEquals("Sheet1", ref.findSheetNameFromExternSheet(1));
assertEquals("S2", ref.findSheetNameFromExternSheet(2));
}
-
+
public void testFormulas() {
-
+
FormulaRecord[] fRecs = mockListen.getFormulaRecords();
-
+
// Check our formula records
assertEquals(6, fRecs.length);
-
- Workbook stubWB = listener.getStubWorkbook();
+
+ InternalWorkbook stubWB = listener.getStubWorkbook();
assertNotNull(stubWB);
HSSFWorkbook stubHSSF = listener.getStubHSSFWorkbook();
assertNotNull(stubHSSF);
-
+
// Check these stubs have the right stuff on them
assertEquals("Sheet1", stubWB.getSheetName(0));
assertEquals("S2", stubWB.getSheetName(1));
assertEquals("Sh3", stubWB.getSheetName(2));
-
+
// Check we can get the formula without breaking
for(int i=0; i<fRecs.length; i++) {
HSSFFormulaParser.toFormulaString(stubHSSF, fRecs[i].getParsedExpression());
}
-
+
// Peer into just one formula, and check that
// all the ptgs give back the right things
Ptg[] ptgs = fRecs[0].getParsedExpression();
assertEquals(1, ptgs.length);
assertTrue(ptgs[0] instanceof Ref3DPtg);
-
+
Ref3DPtg ptg = (Ref3DPtg)ptgs[0];
HSSFEvaluationWorkbook book = HSSFEvaluationWorkbook.create(stubHSSF);
assertEquals("Sheet1!A1", ptg.toFormulaString(book));
-
-
+
+
// Now check we get the right formula back for
// a few sample ones
FormulaRecord fr;
-
+
// Sheet 1 A2 is on same sheet
fr = fRecs[0];
assertEquals(1, fr.getRow());
assertEquals(0, fr.getColumn());
assertEquals("Sheet1!A1", HSSFFormulaParser.toFormulaString(stubHSSF, fr.getParsedExpression()));
-
+
// Sheet 1 A5 is to another sheet
fr = fRecs[3];
assertEquals(4, fr.getRow());
assertEquals(0, fr.getColumn());
assertEquals("'S2'!A1", HSSFFormulaParser.toFormulaString(stubHSSF, fr.getParsedExpression()));
-
+
// Sheet 1 A7 is to another sheet, range
fr = fRecs[5];
assertEquals(6, fr.getRow());
assertEquals(0, fr.getColumn());
assertEquals("SUM(Sh3!A1:A4)", HSSFFormulaParser.toFormulaString(stubHSSF, fr.getParsedExpression()));
-
-
+
+
// Now, load via Usermodel and re-check
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("3dFormulas.xls");
assertEquals("Sheet1!A1", wb.getSheetAt(0).getRow(1).getCell(0).getCellFormula());
assertEquals("SUM(Sh3!A1:A4)", wb.getSheetAt(0).getRow(6).getCell(0).getCellFormula());
}
-
+
private static final class MockHSSFListener implements HSSFListener {
public MockHSSFListener() {}
private final List _records = new ArrayList();
@@ -161,4 +161,4 @@ public final class TestEventWorkbookBuilder extends TestCase {
return result;
}
}
-} \ No newline at end of file
+}
diff --git a/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java b/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java
index c7939e33a5..d6f1e7c90b 100644
--- a/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java
+++ b/src/testcases/org/apache/poi/hssf/model/TestWorkbook.java
@@ -17,10 +17,11 @@
package org.apache.poi.hssf.model;
+import junit.framework.TestCase;
+
import org.apache.poi.hssf.record.FontRecord;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-
-import junit.framework.TestCase;
+import org.apache.poi.hssf.usermodel.TestHSSFWorkbook;
/**
* Unit test for the Workbook class.
@@ -29,7 +30,7 @@ import junit.framework.TestCase;
*/
public final class TestWorkbook extends TestCase {
public void testFontStuff() {
- Workbook wb = (new HW()).getWorkbook();
+ InternalWorkbook wb = TestHSSFWorkbook.getInternalWorkbook(new HSSFWorkbook());
assertEquals(4, wb.getNumberOfFontRecords());
assertEquals(68, wb.getRecords().size());
@@ -82,13 +83,4 @@ public final class TestWorkbook extends TestCase {
assertEquals(6, wb.getFontIndex(n7));
assertEquals(n7, wb.getFontRecordAt(6));
}
-
- private static final class HW extends HSSFWorkbook {
- public HW() {
- super();
- }
- protected Workbook getWorkbook() {
- return super.getWorkbook();
- }
- }
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java b/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
index 8da432fa7e..2453575d44 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/SanityChecker.java
@@ -21,7 +21,7 @@ package org.apache.poi.hssf.usermodel;
import junit.framework.Assert;
import org.apache.poi.hssf.model.Sheet;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.record.aggregates.PageSettingsBlock;
@@ -208,7 +208,7 @@ public class SanityChecker
new CheckRecord(EOFRecord.class, '1')
};
- private void checkWorkbookRecords(Workbook workbook)
+ private void checkWorkbookRecords(InternalWorkbook workbook)
{
List records = workbook.getRecords();
assertTrue(records.get(0) instanceof BOFRecord);
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index df3f234882..c0f639d412 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -31,7 +31,7 @@ import junit.framework.AssertionFailedError;
import org.apache.poi.hssf.HSSFITestDataProvider;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.OldExcelFormatException;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.CellValueRecordInterface;
import org.apache.poi.hssf.record.EmbeddedObjectRefSubRecord;
import org.apache.poi.hssf.record.NameRecord;
@@ -171,7 +171,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
public void test15375_2() {
baseTest15375(6000);
}
-
+
/**Double byte strings*/
public void test15556() {
@@ -844,7 +844,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
// Check all names fit within range, and use
// DeletedArea3DPtg
- Workbook w = wb.getWorkbook();
+ InternalWorkbook w = wb.getWorkbook();
for(int i=0; i<w.getNumNames(); i++) {
NameRecord r = w.getNameRecord(i);
assertTrue(r.getSheetNumber() <= wb.getNumberOfSheets());
@@ -1249,7 +1249,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
/**
* The resolution for bug 45777 assumed that the maximum text length in a header / footer
* record was 256 bytes. This assumption appears to be wrong. Since the fix for bug 47244,
- * POI now supports header / footer text lengths beyond 256 bytes.
+ * POI now supports header / footer text lengths beyond 256 bytes.
*/
public void test45777() {
HSSFWorkbook wb = new HSSFWorkbook();
@@ -1375,7 +1375,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
HSSFWorkbook wb = openSample("45290.xls");
assertEquals(1, wb.getNumberOfSheets());
}
-
+
/**
* In POI-2.5 user reported exception when parsing a name with a custom VBA function:
* =MY_VBA_FUNCTION("lskdjflsk")
@@ -1455,7 +1455,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
wb.write(out);
out.close();
int size1 = out.size();
-
+
out = new ByteArrayOutputStream();
wb.write(out);
out.close();
@@ -1469,7 +1469,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
assertEquals(size2, size3);
}
-
+
/**
* java.io.IOException: block[ 0 ] already removed
* (is an excel 95 file though)
@@ -1484,7 +1484,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
));
}
}
-
+
/**
* java.lang.NegativeArraySizeException reading long
* non-unicode data for a name record
@@ -1514,7 +1514,7 @@ public final class TestBugs extends BaseTestBugzillaIssues {
*/
public void test48180() {
HSSFWorkbook wb = openSample("48180.xls");
-
+
HSSFSheet s = wb.getSheetAt(0);
HSSFCell cell1 = s.getRow(0).getCell(0);
assertEquals("test ", cell1.getStringCellValue().toString());
@@ -1524,12 +1524,12 @@ public final class TestBugs extends BaseTestBugzillaIssues {
}
/**
- * POI 3.5 beta 7 can not read excel file contain list box (Form Control)
+ * POI 3.5 beta 7 can not read excel file contain list box (Form Control)
*/
public void test47701() {
openSample("47701.xls");
}
-
+
public void test48026() {
openSample("48026.xls");
}
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
index 0f9c7ae0f1..02113fd6c2 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
@@ -25,7 +25,7 @@ import java.util.TimeZone;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
/**
* Class TestHSSFDateUtil
@@ -306,7 +306,7 @@ public final class TestHSSFDateUtil extends TestCase {
HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("DateFormats.xls");
HSSFSheet sheet = workbook.getSheetAt(0);
- Workbook wb = workbook.getWorkbook();
+ InternalWorkbook wb = workbook.getWorkbook();
HSSFRow row;
HSSFCell cell;
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
index 39a911c53e..360dc7cb46 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java
@@ -25,6 +25,7 @@ import junit.framework.AssertionFailedError;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.HSSFITestDataProvider;
import org.apache.poi.hssf.model.HSSFFormulaParser;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.model.Sheet;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.hssf.record.Record;
@@ -48,6 +49,13 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
return HSSFITestDataProvider.getInstance();
}
+ /**
+ * gives test code access to the {@link InternalWorkbook} within {@link HSSFWorkbook}
+ */
+ public static InternalWorkbook getInternalWorkbook(HSSFWorkbook wb) {
+ return wb.getWorkbook();
+ }
+
public void testSetRepeatingRowsAndColumns() {
// Test bug 29747
HSSFWorkbook b = new HSSFWorkbook( );
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java b/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
index 15682a074b..fde7179080 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestWorkbook.java
@@ -25,7 +25,7 @@ import java.io.IOException;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.BackupRecord;
import org.apache.poi.hssf.record.LabelSSTRecord;
import org.apache.poi.hssf.record.Record;
@@ -449,7 +449,7 @@ public final class TestWorkbook extends TestCase {
public void testBackupRecord() {
HSSFWorkbook wb = new HSSFWorkbook();
wb.createSheet();
- Workbook workbook = wb.getWorkbook();
+ InternalWorkbook workbook = wb.getWorkbook();
BackupRecord record = workbook.getBackupRecord();
assertEquals(0, record.getBackup());
diff --git a/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java b/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
index 4a15ac0eee..b17872922f 100644
--- a/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
+++ b/src/testcases/org/apache/poi/hssf/util/TestAreaReference.java
@@ -17,14 +17,13 @@
package org.apache.poi.hssf.util;
-import java.io.IOException;
import java.io.InputStream;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.model.HSSFFormulaParser;
-import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.model.InternalWorkbook;
import org.apache.poi.hssf.record.NameRecord;
import org.apache.poi.hssf.record.formula.Area3DPtg;
import org.apache.poi.hssf.record.formula.MemFuncPtg;
@@ -36,10 +35,11 @@ import org.apache.poi.hssf.usermodel.HSSFName;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.hssf.usermodel.TestHSSFWorkbook;
import org.apache.poi.ss.util.AreaReference;
import org.apache.poi.ss.util.CellReference;
/**
- *
+ *
*/
public final class TestAreaReference extends TestCase {
@@ -52,54 +52,54 @@ public final class TestAreaReference extends TestCase {
assertTrue("row is abs",cf.isRowAbsolute());
assertTrue("col is abs",cf.isColAbsolute());
assertTrue("string is $A$1",cf.formatAsString().equals("$A$1"));
-
+
cf = ar.getLastCell();
assertTrue("row is 4",cf.getRow()==1);
assertTrue("col is 1",cf.getCol()==1);
assertTrue("row is abs",cf.isRowAbsolute());
assertTrue("col is abs",cf.isColAbsolute());
assertTrue("string is $B$2",cf.formatAsString().equals("$B$2"));
-
+
CellReference[] refs = ar.getAllReferencedCells();
assertEquals(4, refs.length);
-
+
assertEquals(0, refs[0].getRow());
assertEquals(0, refs[0].getCol());
assertNull(refs[0].getSheetName());
-
+
assertEquals(0, refs[1].getRow());
assertEquals(1, refs[1].getCol());
assertNull(refs[1].getSheetName());
-
+
assertEquals(1, refs[2].getRow());
assertEquals(0, refs[2].getCol());
assertNull(refs[2].getSheetName());
-
+
assertEquals(1, refs[3].getRow());
assertEquals(1, refs[3].getCol());
assertNull(refs[3].getSheetName());
}
-
+
/**
* References failed when sheet names were being used
* Reported by Arne.Clauss@gedas.de
*/
public void testReferenceWithSheet() {
AreaReference ar;
-
+
ar = new AreaReference("Tabelle1!B5:B5");
assertTrue(ar.isSingleCell());
TestCellReference.confirmCell(ar.getFirstCell(), "Tabelle1", 4, 1, false, false, "Tabelle1!B5");
-
+
assertEquals(1, ar.getAllReferencedCells().length);
-
-
+
+
ar = new AreaReference("Tabelle1!$B$5:$B$7");
assertFalse(ar.isSingleCell());
-
+
TestCellReference.confirmCell(ar.getFirstCell(), "Tabelle1", 4, 1, true, true, "Tabelle1!$B$5");
TestCellReference.confirmCell(ar.getLastCell(), "Tabelle1", 6, 1, true, true, "Tabelle1!$B$7");
-
+
// And all that make it up
CellReference[] allCells = ar.getAllReferencedCells();
assertEquals(3, allCells.length);
@@ -108,16 +108,6 @@ public final class TestAreaReference extends TestCase {
TestCellReference.confirmCell(allCells[2], "Tabelle1", 6, 1, true, true, "Tabelle1!$B$7");
}
- // TODO - remove this sub-class
- private static final class HSSFWB extends HSSFWorkbook {
- public HSSFWB(InputStream in) throws IOException {
- super(in);
- }
- public Workbook getWorkbook() {
- return super.getWorkbook();
- }
- }
-
public void testContiguousReferences() {
String refSimple = "$C$10:$C$10";
String ref2D = "$C$10:$D$11";
@@ -138,15 +128,21 @@ public final class TestAreaReference extends TestCase {
try {
new AreaReference(refDCSimple);
fail();
- } catch(IllegalArgumentException e) {}
+ } catch(IllegalArgumentException e) {
+ // expected during successful test
+ }
try {
new AreaReference(refDC2D);
fail();
- } catch(IllegalArgumentException e) {}
+ } catch(IllegalArgumentException e) {
+ // expected during successful test
+ }
try {
new AreaReference(refDC3D);
fail();
- } catch(IllegalArgumentException e) {}
+ } catch(IllegalArgumentException e) {
+ // expected during successful test
+ }
// Test that we split as expected
AreaReference[] refs;
@@ -193,8 +189,8 @@ public final class TestAreaReference extends TestCase {
public void testDiscontinousReference() throws Exception {
InputStream is = HSSFTestDataSamples.openSampleFileStream("44167.xls");
- HSSFWB wb = new HSSFWB(is);
- Workbook workbook = wb.getWorkbook();
+ HSSFWorkbook wb = new HSSFWorkbook(is);
+ InternalWorkbook workbook = TestHSSFWorkbook.getInternalWorkbook(wb);
HSSFEvaluationWorkbook eb = HSSFEvaluationWorkbook.create(wb);
assertEquals(1, wb.getNumberOfNames());
@@ -252,18 +248,18 @@ public final class TestAreaReference extends TestCase {
HSSFCell c = r.getCell((int)cref.getCol());
assertNotNull(c);
}
-
+
public void testSpecialSheetNames() {
AreaReference ar;
ar = new AreaReference("'Sheet A'!A1:A1");
confirmAreaSheetName(ar, "Sheet A", "'Sheet A'!A1");
-
+
ar = new AreaReference("'Hey! Look Here!'!A1:A1");
confirmAreaSheetName(ar, "Hey! Look Here!", "'Hey! Look Here!'!A1");
-
+
ar = new AreaReference("'O''Toole'!A1:B2");
confirmAreaSheetName(ar, "O'Toole", "'O''Toole'!A1:B2");
-
+
ar = new AreaReference("'one:many'!A1:B2");
confirmAreaSheetName(ar, "one:many", "'one:many'!A1:B2");
}
@@ -273,25 +269,24 @@ public final class TestAreaReference extends TestCase {
assertEquals(sheetName, cells[0].getSheetName());
assertEquals(expectedFullText, ar.formatAsString());
}
-
+
public void testWholeColumnRefs() {
- confirmWholeColumnRef("A:A", 0, 0, false, false);
- confirmWholeColumnRef("$C:D", 2, 3, true, false);
- confirmWholeColumnRef("AD:$AE", 29, 30, false, true);
-
- }
-
- private static void confirmWholeColumnRef(String ref, int firstCol, int lastCol, boolean firstIsAbs, boolean lastIsAbs) {
- AreaReference ar = new AreaReference(ref);
- confirmCell(ar.getFirstCell(), 0, firstCol, true, firstIsAbs);
- confirmCell(ar.getLastCell(), 0xFFFF, lastCol, true, lastIsAbs);
- }
-
- private static void confirmCell(CellReference cell, int row, int col, boolean isRowAbs,
- boolean isColAbs) {
- assertEquals(row, cell.getRow());
- assertEquals(col, cell.getCol());
- assertEquals(isRowAbs, cell.isRowAbsolute());
- assertEquals(isColAbs, cell.isColAbsolute());
- }
+ confirmWholeColumnRef("A:A", 0, 0, false, false);
+ confirmWholeColumnRef("$C:D", 2, 3, true, false);
+ confirmWholeColumnRef("AD:$AE", 29, 30, false, true);
+ }
+
+ private static void confirmWholeColumnRef(String ref, int firstCol, int lastCol, boolean firstIsAbs, boolean lastIsAbs) {
+ AreaReference ar = new AreaReference(ref);
+ confirmCell(ar.getFirstCell(), 0, firstCol, true, firstIsAbs);
+ confirmCell(ar.getLastCell(), 0xFFFF, lastCol, true, lastIsAbs);
+ }
+
+ private static void confirmCell(CellReference cell, int row, int col, boolean isRowAbs,
+ boolean isColAbs) {
+ assertEquals(row, cell.getRow());
+ assertEquals(col, cell.getCol());
+ assertEquals(isRowAbs, cell.isRowAbsolute());
+ assertEquals(isColAbs, cell.isColAbsolute());
+ }
}