From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9633 invoked by alias); 23 Nov 2006 12:16:03 -0000 Received: (qmail 9622 invoked by uid 22791); 23 Nov 2006 12:16:02 -0000 X-Spam-Check-By: sourceware.org Received: from vsmtp3alice.tin.it (HELO vsmtp3.tin.it) (212.216.176.143) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 23 Nov 2006 12:15:50 +0000 Received: from [192.168.0.155] (87.19.151.5) by vsmtp3.tin.it (7.2.072.1) id 4565722E0000AFA5 for mauve-patches@sources.redhat.com; Thu, 23 Nov 2006 13:15:47 +0100 Subject: FYI: few tests update. From: Mario Torre To: mauve-patches Content-Type: multipart/mixed; boundary="=-7PnGyqb8Ira2SsvHgFbP" Date: Thu, 23 Nov 2006 12:16:00 -0000 Message-Id: <1164284158.3120.24.camel@nirvana.limasoftware.net> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1.1 (2.8.1.1-3.fc6) X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2006/txt/msg00744.txt.bz2 --=-7PnGyqb8Ira2SsvHgFbP Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 742 Committed. 2006-11-23 Mario Torre * gnu/testlet/java/text/DecimalFormat/formatToCharacterIterator.java (test): Code reformatted, added test for Format.Field attributes. * gnu/testlet/java/text/DecimalFormat/formatExp.java (test): New tests. * gnu/testlet/java/text/DecimalFormat/applyPattern.java (test): fix broken test, plus explicity set the locale for the test. * gnu/testlet/javax/swing/text/InternationalFormatter/InternationalFormatterTest.java: fix test tag, moved to 1.4. -- Lima Software, SO.PR.IND. s.r.l. http://www.limasoftware.net/ pgp key: http://subkeys.pgp.net/ Please, support open standards: http://opendocumentfellowship.org/petition/ http://www.nosoftwarepatents.com/ --=-7PnGyqb8Ira2SsvHgFbP Content-Disposition: attachment; filename=2006-11-23-mauve.patch Content-Type: text/x-patch; name=2006-11-23-mauve.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 5503 ### Eclipse Workspace Patch 1.0 #P mauve Index: gnu/testlet/java/text/DecimalFormat/formatExp.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/formatExp.java,v retrieving revision 1.3 diff -u -r1.3 formatExp.java --- gnu/testlet/java/text/DecimalFormat/formatExp.java 22 Sep 2006 20:28:38 -0000 1.3 +++ gnu/testlet/java/text/DecimalFormat/formatExp.java 23 Nov 2006 12:10:06 -0000 @@ -70,6 +70,9 @@ apply (harness, df, "##.###E0"); harness.check (df.format (12345), "1.2345E4"); + apply (harness, df, "##.###E0"); + harness.check (df.format (12346), "1.2346E4"); + apply (harness, df, "00.###E0"); harness.check (df.format (12345), "12.345E3"); harness.check (df.format (1234), "12.34E2"); Index: gnu/testlet/java/text/DecimalFormat/applyPattern.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/applyPattern.java,v retrieving revision 1.3 diff -u -r1.3 applyPattern.java --- gnu/testlet/java/text/DecimalFormat/applyPattern.java 10 Oct 2006 22:36:48 -0000 1.3 +++ gnu/testlet/java/text/DecimalFormat/applyPattern.java 23 Nov 2006 12:10:06 -0000 @@ -25,6 +25,7 @@ import gnu.testlet.Testlet; import java.text.DecimalFormat; +import java.util.Locale; /** * Some checks for the applyPattern() method in the {@link DecimalFormat} class. @@ -39,6 +40,9 @@ */ public void test(TestHarness harness) { + Locale orig = Locale.getDefault(); + Locale.setDefault(Locale.US); + DecimalFormat f1 = new DecimalFormat(); // negativePrefix @@ -80,7 +84,7 @@ harness.checkPoint("null pattern"); f1.applyPattern(""); - harness.check(f1.format(123456789.123456789), "123.456.789,12345679"); + harness.check(f1.format(123456789.123456789), "123,456,789.12345679"); harness.checkPoint("invalid pattern"); // try null argument @@ -107,6 +111,7 @@ } harness.check(pass); + Locale.setDefault(orig); } } Index: gnu/testlet/java/text/DecimalFormat/formatToCharacterIterator.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DecimalFormat/formatToCharacterIterator.java,v retrieving revision 1.1 diff -u -r1.1 formatToCharacterIterator.java --- gnu/testlet/java/text/DecimalFormat/formatToCharacterIterator.java 13 Mar 2005 20:42:07 -0000 1.1 +++ gnu/testlet/java/text/DecimalFormat/formatToCharacterIterator.java 23 Nov 2006 12:10:06 -0000 @@ -19,52 +19,87 @@ // the Free Software Foundation, 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. */ + package gnu.testlet.java.text.DecimalFormat; import gnu.testlet.TestHarness; import gnu.testlet.Testlet; +import java.text.AttributedCharacterIterator; import java.text.DecimalFormat; +import java.text.NumberFormat.Field; +import java.util.Iterator; +import java.util.Set; /** - * Some checks for the formatToCharacterIterator() method in the + * Some checks for the formatToCharacterIterator() method in the * {@link DecimalFormat} class. */ -public class formatToCharacterIterator implements Testlet +public class formatToCharacterIterator + implements Testlet { /** * Runs the test using the specified harness. * - * @param harness the test harness (null not permitted). + * @param harness the test harness (null not permitted). */ - public void test(TestHarness harness) + public void test(TestHarness harness) { DecimalFormat f1 = new DecimalFormat(); - + // check null argument boolean pass = false; try - { - f1.formatToCharacterIterator(null); - } + { + f1.formatToCharacterIterator(null); + } catch (NullPointerException e) - { - pass = true; - } + { + pass = true; + } harness.check(pass); - + // check non-numeric argument pass = false; try - { - f1.formatToCharacterIterator("Not a number"); - } + { + f1.formatToCharacterIterator("Not a number"); + } catch (IllegalArgumentException e) - { - pass = true; - } + { + pass = true; + } harness.check(pass); + + harness.checkPoint("Check for attributes after a valid parse"); + + DecimalFormat f2 = new DecimalFormat("0.##;-0.##"); + + // result is "-1234.56" + AttributedCharacterIterator chIter = + f2.formatToCharacterIterator(Double.valueOf(-1234.56)); + + Set _keys = chIter.getAllAttributeKeys(); + + // It seems that we don't get always the same order in the results + // but the values need to be the ones written later. + // This test should be completed checking even the start/end of each field + boolean pass1 = false; + boolean pass2 = false; + boolean pass3 = false; + boolean pass4 = false; + + for (Iterator i = _keys.iterator(); i.hasNext();) + { + //harness.debug("field: " + i.next()); + Field field = (Field) i.next(); + if (field.equals(Field.INTEGER)) pass1 = true; + if (field.equals(Field.FRACTION)) pass2 = true; + if (field.equals(Field.DECIMAL_SEPARATOR)) pass3 = true; + if (field.equals(Field.SIGN)) pass4 = true; + } + + harness.check(pass1 && pass2 && pass3 && pass4); } - } --=-7PnGyqb8Ira2SsvHgFbP--