FileDocCategorySizeDatePackage
TestAreaReference.javaAPI DocApache Poi 3.0.12720Mon Jan 01 12:39:46 GMT 2007org.apache.poi.hssf.util

TestAreaReference

public class TestAreaReference extends TestCase

Fields Summary
Constructors Summary
public TestAreaReference(String s)

        super(s);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        
		junit.textui.TestRunner.run(TestAreaReference.class);
	
public voidtestAreaRef1()

        AreaReference ar = new AreaReference("$A$1:$B$2");
        assertTrue("Two cells expected",ar.getCells().length == 2);
        CellReference cf = ar.getCells()[0];
        assertTrue("row is 4",cf.getRow()==0);
        assertTrue("col is 1",cf.getCol()==0);
        assertTrue("row is abs",cf.isRowAbsolute());
        assertTrue("col is abs",cf.isColAbsolute());
        assertTrue("string is $A$1",cf.toString().equals("$A$1"));
        
        cf = ar.getCells()[1];
        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.toString().equals("$B$2"));
    
public voidtestReferenceWithSheet()
References failed when sheet names were being used Reported by Arne.Clauss@gedas.de

    	String ref = "Tabelle1!$B$5";
		AreaReference myAreaReference = new AreaReference(ref);
		CellReference[] myCellReference = myAreaReference.getCells();
		
		assertNotNull("cell reference not null : "+myCellReference[0]);
    	assertEquals("Not Column B", (short)1,myCellReference[0].getCol());
		assertEquals("Not Row 5", 4,myCellReference[0].getRow());