From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6675 invoked by alias); 13 Apr 2004 17:45:59 -0000 Mailing-List: contact mauve-discuss-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-discuss-owner@sources.redhat.com Received: (qmail 6657 invoked from network); 13 Apr 2004 17:45:55 -0000 Received: from unknown (HELO cuddles.cambridge.redhat.com) (81.96.64.123) by sources.redhat.com with SMTP; 13 Apr 2004 17:45:55 -0000 Received: from redhat.com (localhost.localdomain [127.0.0.1]) by cuddles.cambridge.redhat.com (8.12.8/8.12.8) with ESMTP id i3DHikP0009340; Tue, 13 Apr 2004 18:44:56 +0100 Received: (from aph@localhost) by redhat.com (8.12.8/8.12.8/Submit) id i3DHijMZ009336; Tue, 13 Apr 2004 18:44:45 +0100 From: Andrew Haley MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16508.9997.393675.283091@cuddles.cambridge.redhat.com> Date: Tue, 13 Apr 2004 17:45:00 -0000 To: Thomas Zander Cc: mauve-discuss@sources.redhat.com Subject: Re: Mauve patches. In-Reply-To: <200404131913.49935.zander@javalobby.org> References: <200404060956.14298.zander@javalobby.org> <200404131556.13282.zander@javalobby.org> <16507.63791.746420.624801@cuddles.cambridge.redhat.com> <200404131913.49935.zander@javalobby.org> X-SW-Source: 2004-q2/txt/msg00029.txt.bz2 Thomas Zander writes: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > On Tuesday 13 April 2004 16:29, Andrew Haley wrote: > > Thomas writes: > > > On Tuesday 13 April 2004 15:19, you wrote: > > > > Yes. I suppose Thomas' Ant script should do the right thing with > > > > respect to the tags. > > > > > > The selecting of files based on some 'tag in their content is quite > > > easy in ant; its a standard target. > > > I could add an ant-build target that builds based on tags. > > > > Excellent. Now I feel not so bad for being slow to commit... > > Hmm; I kind of (really) like working in CVS, its like a net that catches > you when you fail (and more). > What about you commit first; then I can safely start to work on adding > extra features. Alright. > I mean; all the questions I posed have been quietly been ignored, I'm not > really under the impression Mauve is getting the attention it deserves; I > honestly begin starting to wonder if putting it in a CVS on sourceforge or > whereever, and more freely giving out CVS accounts is such a bad idea. Actually, all the questions you posed have not quietly been ignored. I have answered some of them. > Some rights to commit and/or to clean up the webpages is the only > thing standing in my way to really help make Mauve move forward! That and the fact that as yet you have not managed correctly to submit a patch. I have attached a version here, FYI. I don't think I've broken anything with the checkin, but please check. Andrew. 2004-04-13 Thomas Zander * build.xml: New file. * gnu/anttask/RunTests.java: New file. * gnu/testlet/SimpleTestHarness.java (getFailures): New method. * gnu/testlet/javax/swing/JLabel/Icon.java: New file. * gnu/testlet/javax/swing/JLabel/Mnemonic.java: New file. * gnu/testlet/java/text/SimpleDateFormat/attribute.java (test_FieldPos): Locals no longer static. Index: build.xml =================================================================== RCS file: build.xml diff -N build.xml *** /dev/null 1 Jan 1970 00:00:00 -0000 --- build.xml 13 Apr 2004 17:38:48 -0000 *************** *** 0 **** --- 1,87 ---- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Mauve test API]]> + + + + + + + + + + + Index: gnu/anttask/RunTests.java =================================================================== RCS file: gnu/anttask/RunTests.java diff -N gnu/anttask/RunTests.java *** /dev/null 1 Jan 1970 00:00:00 -0000 --- gnu/anttask/RunTests.java 13 Apr 2004 17:38:48 -0000 *************** *** 0 **** --- 1,101 ---- + /* + Copyright (c) 2004 Thomas Zander + + This file is part of Mauve. + + Mauve is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + Mauve is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Mauve; see the file COPYING. If not, write to + the Free Software Foundation, 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + + package gnu.anttask; + + import gnu.testlet.*; + import java.io.*; + import java.util.*; + + import org.apache.tools.ant.*; + import org.apache.tools.ant.taskdefs.*; + import org.apache.tools.ant.types.*; + + public class RunTests extends MatchingTask { + private boolean verbose=false, debug=false, haltOnFailure=false, failOnError=true; + private Path sourceDir=null; + private Vector filesets=new Vector(); + + public void execute() throws BuildException { + MyTestHarness harness = new MyTestHarness (verbose, debug, haltOnFailure); + + Iterator iter = filesets.iterator(); + while(iter.hasNext()) { + FileSet fs = (FileSet) iter.next(); + try { + DirectoryScanner ds = fs.getDirectoryScanner(getProject()); + Iterator classNames = Arrays.asList(ds.getIncludedFiles()).iterator(); + while(classNames.hasNext()) { + String filename = (String) classNames.next(); + if(! filename.endsWith(".class")) + continue; // only class files + if(filename.lastIndexOf("$") > filename.lastIndexOf(File.separator)) + continue; // no inner classeS + filename=filename.substring(0, filename.length()-6); + filename=filename.replace(File.separatorChar, '.'); + + harness.runTest(filename); + } + } catch (BuildException be) { + // directory doesn't exist or is not readable + if (failOnError) + throw be; + else + log(be.getMessage(),Project.MSG_WARN); + } + } + } + + public void setVerbose(boolean verbose) { + this.verbose = verbose; + } + + public void setDebug(boolean debug) { + this.debug = debug; + } + + public void setHaltOnFailure(boolean on) { + haltOnFailure = on; + } + + public void setFailOnError(boolean on) { + failOnError = on; + } + + public void addFileset(FileSet set) { + filesets.add(set); + } + + + private static class MyTestHarness extends SimpleTestHarness { + private boolean haltOnFailure; + // extend it b/cause someone thought it should not have public constructors. + public MyTestHarness(boolean verbose, boolean debug, boolean haltOnFailure) { + super(verbose, debug, false); + this.haltOnFailure = haltOnFailure; + } + + protected void runTest (String name) throws BuildException { + super.runtest(name); + if(haltOnFailure && getFailures() > 0) + throw new BuildException("Failures"); + } + } + } Index: gnu/testlet/SimpleTestHarness.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/SimpleTestHarness.java,v retrieving revision 1.38 diff -p -2 -c -r1.38 SimpleTestHarness.java *** gnu/testlet/SimpleTestHarness.java 29 Aug 2003 14:52:21 -0000 1.38 --- gnu/testlet/SimpleTestHarness.java 13 Apr 2004 17:38:48 -0000 *************** public class SimpleTestHarness *** 51,54 **** --- 51,59 ---- } + + protected int getFailures() { + return failures; + } + public void check (boolean result) { Index: gnu/testlet/java/text/SimpleDateFormat/attribute.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/SimpleDateFormat/attribute.java,v retrieving revision 1.1 diff -p -2 -c -r1.1 attribute.java *** gnu/testlet/java/text/SimpleDateFormat/attribute.java 24 Mar 2004 20:21:29 -0000 1.1 --- gnu/testlet/java/text/SimpleDateFormat/attribute.java 13 Apr 2004 17:38:48 -0000 *************** public class attribute implements Testle *** 158,170 **** SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd hh:kk:mm:ss 'zone' zzzz"); Date date = new Date(); ! static Format.Field[] fields = new Format.Field[] { DateFormat.Field.YEAR, DateFormat.Field.MONTH, DateFormat.Field.DAY_OF_MONTH, DateFormat.Field.HOUR1, DateFormat.Field.HOUR_OF_DAY1, DateFormat.Field.MINUTE, DateFormat.Field.SECOND }; ! static int[] begin = new int[] { 0, 5, 8, /***/ 11, 14, 17, 20 }; ! static int[] end = new int[] { 4, 7, 10, /***/ 13, 16, 19, 22 }; --- 158,170 ---- SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd hh:kk:mm:ss 'zone' zzzz"); Date date = new Date(); ! Format.Field[] fields = new Format.Field[] { DateFormat.Field.YEAR, DateFormat.Field.MONTH, DateFormat.Field.DAY_OF_MONTH, DateFormat.Field.HOUR1, DateFormat.Field.HOUR_OF_DAY1, DateFormat.Field.MINUTE, DateFormat.Field.SECOND }; ! int[] begin = new int[] { 0, 5, 8, /***/ 11, 14, 17, 20 }; ! int[] end = new int[] { 4, 7, 10, /***/ 13, 16, 19, 22 }; Index: gnu/testlet/javax/swing/JLabel/Icon.java =================================================================== RCS file: gnu/testlet/javax/swing/JLabel/Icon.java diff -N gnu/testlet/javax/swing/JLabel/Icon.java *** /dev/null 1 Jan 1970 00:00:00 -0000 --- gnu/testlet/javax/swing/JLabel/Icon.java 13 Apr 2004 17:38:48 -0000 *************** *** 0 **** --- 1,75 ---- + // Tags: JDK1.2 + + // Copyright (C) 2004 Thomas Zander + + // This file is part of Mauve. + + // Mauve is free software; you can redistribute it and/or modify + // it under the terms of the GNU General Public License as published by + // the Free Software Foundation; either version 2, or (at your option) + // any later version. + + // Mauve is distributed in the hope that it will be useful, + // but WITHOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + + // You should have received a copy of the GNU General Public License + // along with Mauve; see the file COPYING. If not, write to + // the Free Software Foundation, 59 Temple Place - Suite 330, + // Boston, MA 02111-1307, USA. + + package gnu.testlet.javax.swing.JLabel; + + import gnu.testlet.Testlet; + import gnu.testlet.TestHarness; + import java.util.EventListener; + import java.awt.*; + import javax.swing.*; + + /** + * These tests pass with the Sun JDK 1.4.1_03 on GNU/Linux IA-32. + */ + public class Icon implements Testlet { + public void test(TestHarness harness) { + MyIcon icon = new MyIcon(); + JLabel l = new JLabel(icon); + harness.check(l.getIcon(), icon); + harness.check(l.getDisabledIcon(), null); + l.setIcon(icon); + harness.check(l.getIcon(), icon); + harness.check(l.getDisabledIcon(), null); + + l = new JLabel(); + Dimension base = l.getPreferredSize(); + l.setIcon(icon); + Dimension one = l.getPreferredSize(); + harness.check(one.width, base.width + icon.getIconWidth()); + + l = new JLabel("bla"); + base = l.getPreferredSize(); + l.setIcon(icon); + one = l.getPreferredSize(); + harness.check(one.width, base.width + icon.getIconWidth() + l.getIconTextGap() ); + + l.setIconTextGap(100); + one = l.getPreferredSize(); + harness.check(one.width, base.width + icon.getIconWidth() + 100 ); + } + + private static class MyIcon implements javax.swing.Icon { + private int painted = 0; + public int getIconHeight() { + return 10; + } + public int getIconWidth() { + return 20; + } + public void paintIcon(Component c, Graphics g, int x, int y) { + painted++; + } + public int getPainted() { + return painted; + } + } + } Index: gnu/testlet/javax/swing/JLabel/Mnemonic.java =================================================================== RCS file: gnu/testlet/javax/swing/JLabel/Mnemonic.java diff -N gnu/testlet/javax/swing/JLabel/Mnemonic.java *** /dev/null 1 Jan 1970 00:00:00 -0000 --- gnu/testlet/javax/swing/JLabel/Mnemonic.java 13 Apr 2004 17:38:48 -0000 *************** *** 0 **** --- 1,61 ---- + // Tags: JDK1.2 + + // Copyright (C) 2004 Thomas Zander + + // This file is part of Mauve. + + // Mauve is free software; you can redistribute it and/or modify + // it under the terms of the GNU General Public License as published by + // the Free Software Foundation; either version 2, or (at your option) + // any later version. + + // Mauve is distributed in the hope that it will be useful, + // but WITHOUT ANY WARRANTY; without even the implied warranty of + // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + // GNU General Public License for more details. + + // You should have received a copy of the GNU General Public License + // along with Mauve; see the file COPYING. If not, write to + // the Free Software Foundation, 59 Temple Place - Suite 330, + // Boston, MA 02111-1307, USA. + + package gnu.testlet.javax.swing.JLabel; + + import gnu.testlet.Testlet; + import gnu.testlet.TestHarness; + import java.util.EventListener; + import javax.swing.JLabel; + + /** + * These tests pass with the Sun JDK 1.4.1_03 on GNU/Linux IA-32. + */ + public class Mnemonic implements Testlet { + public void test(TestHarness harness) { + JLabel l = new JLabel("lskdjnvmdsklzedfsdmnWK"); + harness.check(l.getDisplayedMnemonic(), 0); + harness.check(l.getDisplayedMnemonicIndex(), -1); + + l.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_K); + harness.check(l.getDisplayedMnemonic(), java.awt.event.KeyEvent.VK_K); + harness.check(l.getDisplayedMnemonicIndex(), 2); + + l.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_Q); + harness.check(l.getDisplayedMnemonicIndex(), -1); + + l.setDisplayedMnemonic(java.awt.event.KeyEvent.VK_W); + harness.check(l.getDisplayedMnemonicIndex(), 20); + + l.setText("new text"); + harness.check(l.getDisplayedMnemonicIndex(), 2); + + l.setDisplayedMnemonicIndex(5); + // the following test is really un-intuitive... Is this a bug in Suns JVM? + harness.check(l.getDisplayedMnemonic(), java.awt.event.KeyEvent.VK_W); // unchanged + harness.check(l.getDisplayedMnemonicIndex(), 5); + + l = new JLabel("new text"); + l.setDisplayedMnemonicIndex(5); + harness.check(l.getDisplayedMnemonic(), 0); + harness.check(l.getDisplayedMnemonicIndex(), 5); + } + }