Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 565D39742 for ; Wed, 8 Feb 2012 17:23:11 +0000 (UTC) Received: (qmail 57692 invoked by uid 500); 8 Feb 2012 17:23:11 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 57649 invoked by uid 500); 8 Feb 2012 17:23:10 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 57642 invoked by uid 99); 8 Feb 2012 17:23:10 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 17:23:10 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Feb 2012 17:23:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6B55D23888E4 for ; Wed, 8 Feb 2012 17:22:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1241993 - in /poi/trunk: src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java test-data/spreadsheet/51498.xls Date: Wed, 08 Feb 2012 17:22:47 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120208172247.6B55D23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nick Date: Wed Feb 8 17:22:46 2012 New Revision: 1241993 URL: http://svn.apache.org/viewvc?rev=1241993&view=rev Log: Unit test from Maciej for bug #51498 Added: poi/trunk/test-data/spreadsheet/51498.xls (with props) Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java Modified: poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java?rev=1241993&r1=1241992&r2=1241993&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java (original) +++ poi/trunk/src/testcases/org/apache/poi/ss/formula/functions/TestCountFuncs.java Wed Feb 8 17:22:46 2012 @@ -17,6 +17,9 @@ package org.apache.poi.ss.formula.functions; +import java.util.Arrays; +import java.util.List; + import junit.framework.AssertionFailedError; import junit.framework.TestCase; @@ -36,6 +39,7 @@ import org.apache.poi.hssf.usermodel.HSS import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.CellValue; +import org.apache.poi.ss.usermodel.FormulaEvaluator; /** * Test cases for COUNT(), COUNTA() COUNTIF(), COUNTBLANK() @@ -357,6 +361,33 @@ public final class TestCountFuncs extend confirmPredicate(false, mp, ErrorEval.REF_INVALID); } + /** + * Bug #51498 - Check that CountIf behaves correctly for GTE, LTE + * and NEQ cases + */ + public void testCountifLTEGTE() throws Exception { + final int REF_COL = 4; + final int EVAL_COL = 3; + + // Note - POI currently agrees with OpenOffice on certain blank cell cases, + // while Excel can differ. This is the list of checks to skip + List skipRowsPendingExcelVsOpenOffice = Arrays.asList( + new Integer[] {3}); + + HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("51498.xls"); + FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); + HSSFSheet sheet = workbook.getSheetAt(0); + for (int i = 0; i < 8; i++) { + if (skipRowsPendingExcelVsOpenOffice.contains(i)) { + // Skip the check for now + continue; + } + CellValue expected = evaluator.evaluate(sheet.getRow(i).getCell(REF_COL)); + CellValue actual = evaluator.evaluate(sheet.getRow(i).getCell(EVAL_COL)); + assertEquals(expected.formatAsString(), actual.formatAsString()); + } + } + public void testWildCards() { I_MatchPredicate mp; Added: poi/trunk/test-data/spreadsheet/51498.xls URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/51498.xls?rev=1241993&view=auto ============================================================================== Binary file - no diff available. Propchange: poi/trunk/test-data/spreadsheet/51498.xls ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org