Return-Path: Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: (qmail 65327 invoked from network); 22 May 2010 16:06:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 22 May 2010 16:06:58 -0000 Received: (qmail 86500 invoked by uid 500); 22 May 2010 16:06:58 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 86464 invoked by uid 500); 22 May 2010 16:06:58 -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 86457 invoked by uid 99); 22 May 2010 16:06:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 May 2010 16:06:58 +0000 X-ASF-Spam-Status: No, hits=-1126.0 required=10.0 tests=ALL_TRUSTED,AWL 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; Sat, 22 May 2010 16:06:57 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 44B8B2388900; Sat, 22 May 2010 16:06:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r947310 - /poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java Date: Sat, 22 May 2010 16:06:37 -0000 To: commits@poi.apache.org From: yegor@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100522160637.44B8B2388900@eris.apache.org> Author: yegor Date: Sat May 22 16:06:36 2010 New Revision: 947310 URL: http://svn.apache.org/viewvc?rev=947310&view=rev Log: Fixed tests failing in non-english locales, see Bugzilla 49191 Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java Modified: poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java?rev=947310&r1=947309&r2=947310&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java (original) +++ poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/functions/TestText.java Sat May 22 16:06:36 2010 @@ -17,6 +17,10 @@ package org.apache.poi.hssf.record.formula.functions; +import java.text.DecimalFormatSymbols; +import java.text.SimpleDateFormat; +import java.util.GregorianCalendar; + import junit.framework.TestCase; import org.apache.poi.hssf.record.formula.eval.ErrorEval; import org.apache.poi.hssf.record.formula.eval.NumberEval; @@ -46,20 +50,22 @@ public final class TestText extends Test ValueEval formatArg = new StringEval("#,###.00000"); ValueEval[] args = { numArg, formatArg }; ValueEval result = T.TEXT.evaluate(args, -1, (short)-1); - ValueEval testResult = new StringEval("321,321.32100"); + char groupSeparator = DecimalFormatSymbols.getInstance().getGroupingSeparator(); + char decimalSeparator = DecimalFormatSymbols.getInstance().getDecimalSeparator(); + ValueEval testResult = new StringEval("321" + groupSeparator + "321" + decimalSeparator + "32100"); assertEquals(testResult.toString(), result.toString()); numArg = new NumberEval(321.321); formatArg = new StringEval("00000.00000"); args[0] = numArg; args[1] = formatArg; result = T.TEXT.evaluate(args, -1, (short)-1); - testResult = new StringEval("00321.32100"); + testResult = new StringEval("00321" + decimalSeparator + "32100"); assertEquals(testResult.toString(), result.toString()); formatArg = new StringEval("$#.#"); args[1] = formatArg; result = T.TEXT.evaluate(args, -1, (short)-1); - testResult = new StringEval("$321.3"); + testResult = new StringEval("$321" + decimalSeparator + "3"); assertEquals(testResult.toString(), result.toString()); } @@ -94,10 +100,13 @@ public final class TestText extends Test ValueEval testResult = new StringEval("16:11:1900 07:42:14"); assertEquals(testResult.toString(), result.toString()); + // this line is intended to compute how "November" would look like in the current locale + String november = new SimpleDateFormat("MMMM").format(new GregorianCalendar(2010,10,15).getTime()); + formatArg = new StringEval("MMMM dd, yyyy"); args[1] = formatArg; result = T.TEXT.evaluate(args, -1, (short)-1); - testResult = new StringEval("November 16, 1900"); + testResult = new StringEval(november + " 16, 1900"); assertEquals(testResult.toString(), result.toString()); } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org