View | Details | Raw Unified | Return to bug 21444
Collapse All | Expand All

(-)src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java (-6 / +26 lines)
Lines 744-750 Link Here
744
    }
744
    }
745
    
745
    
746
    public void testSheetFunctions()
746
    public void testSheetFunctions()
747
        throws java.io.IOException
747
        throws IOException
748
    {
748
    {
749
        String filename = System.getProperty("HSSF.testdata.path");
749
        String filename = System.getProperty("HSSF.testdata.path");
750
750
Lines 818-824 Link Here
818
    }
818
    }
819
    
819
    
820
    public void testStringFormulas()
820
    public void testStringFormulas()
821
        throws java.io.IOException
821
        throws IOException
822
    {
822
    {
823
        String readFilename = System.getProperty("HSSF.testdata.path");
823
        String readFilename = System.getProperty("HSSF.testdata.path");
824
824
Lines 852-858 Link Here
852
    
852
    
853
    
853
    
854
    public void testLogicalFormulas()
854
    public void testLogicalFormulas()
855
        throws java.io.IOException
855
        throws IOException
856
    {
856
    {
857
857
858
            File file = File.createTempFile("testLogicalFormula",".xls");
858
            File file = File.createTempFile("testLogicalFormula",".xls");
Lines 880-886 Link Here
880
    }
880
    }
881
    
881
    
882
    public void testDateFormulas()
882
    public void testDateFormulas()
883
        throws java.io.IOException
883
        throws IOException
884
    {
884
    {
885
        String readFilename = System.getProperty("HSSF.testdata.path");
885
        String readFilename = System.getProperty("HSSF.testdata.path");
886
886
Lines 918-924 Link Here
918
918
919
    
919
    
920
    public void testIfFormulas()
920
    public void testIfFormulas()
921
        throws java.io.IOException
921
        throws IOException
922
    {
922
    {
923
        String readFilename = System.getProperty("HSSF.testdata.path");
923
        String readFilename = System.getProperty("HSSF.testdata.path");
924
924
Lines 1008-1014 Link Here
1008
    }
1008
    }
1009
1009
1010
	public void testSumIf()
1010
	public void testSumIf()
1011
		throws java.io.IOException
1011
		throws IOException
1012
	{
1012
	{
1013
		String readFilename = System.getProperty("HSSF.testdata.path");		
1013
		String readFilename = System.getProperty("HSSF.testdata.path");		
1014
		String function ="SUMIF(A1:A5,\">4000\",B1:B5)";
1014
		String function ="SUMIF(A1:A5,\">4000\",B1:B5)";
Lines 1060-1065 Link Here
1060
		assertTrue("sumif == 0 bytes", file.length() > 0);
1060
		assertTrue("sumif == 0 bytes", file.length() > 0);
1061
	}
1061
	}
1062
    
1062
    
1063
    public void testSquareMacro() throws IOException {
1064
        File dir = new File(System.getProperty("HSSF.testdata.path"));
1065
        File xls = new File(dir, "SquareMacro.xls");
1066
        FileInputStream in = new FileInputStream(xls);
1067
        HSSFWorkbook w;
1068
        try {
1069
            w = new HSSFWorkbook(in);
1070
        } finally {
1071
            in.close();
1072
        }
1073
        HSSFSheet s0 = w.getSheetAt(0);
1074
        HSSFRow[] r = {s0.getRow(0), s0.getRow(1)};
1075
        HSSFCell a1 = r[0].getCell((short) 0);
1076
        assertEquals("SQUARE(1)", a1.getCellFormula());
1077
        assertEquals(1d, a1.getNumericCellValue(), 1e-9);
1078
        HSSFCell a2 = r[1].getCell((short) 0);
1079
        assertEquals("SQUARE(2)", a2.getCellFormula());
1080
        assertEquals(4d, a2.getNumericCellValue(), 1e-9);
1081
    }
1082
1063
    public static void main(String [] args) {
1083
    public static void main(String [] args) {
1064
        System.out
1084
        System.out
1065
        .println("Testing org.apache.poi.hssf.usermodel.TestFormulas");
1085
        .println("Testing org.apache.poi.hssf.usermodel.TestFormulas");

Return to bug 21444