This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Re: Mauve patches.
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 <zander@kde.org>
* 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 ----
+ <?xml version="1.0"?>
+ <!--Copyright (c) 2004 Thomas Zander <zander@kde.org>
+
+ 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. -->
+
+ <project name="mauve" default="test" basedir=".">
+
+ <!-- this loads the ant global properties -->
+ <property file="${user.home}/.ant-global.properties"/>
+
+ <property name="src" value="."/>
+ <property name="build" value="build"/>
+ <property name="docs" value="doc"/>
+
+ <!-- clean up .class and .jar files -->
+ <target name="clean" description="Clean out compiled files">
+ <!-- call clean from example-buildfile -->
+ <delete dir="${build}"/>
+ <delete dir="${docs}"/>
+ </target>
+
+ <!-- INIT creates the required directories and files -->
+ <target name="init">
+ <tstamp/>
+ <mkdir dir="${build}"/>
+ <mkdir dir="${docs}"/>
+ <!-- if ant runs; we can be pretty sure these are correct. -->
+ <filter token="SRCDIR" value="${user.dir}"/>
+ <filter token="TMPDIR" value="${java.io.tmpdir}" />
+ <filter token="CHECK_PATH_SEPARATOR" value="${path.separator}"/>
+ <filter token="CHECK_FILE_SEPARATOR" value="${file.separator}"/>
+ <copy file="${src}/gnu/testlet/config.java.in"
+ tofile="${src}/gnu/testlet/config.java"
+ verbose="true"
+ filtering="true" />
+ </target>
+
+ <!-- CLASSPATH -->
+ <path id="myclass.path">
+ <pathelement location="${build}" />
+ </path>
+
+ <!-- compiles all the sources -->
+ <target name="compile" depends="init" description="Compile all files">
+ <javac srcdir="${src}" destdir="${build}"
+ includes="gnu/**/*.java"
+ exlucdes="gnu/testlet/BinaryCompatibility/**"
+ classpathref="myclass.path"
+ debug="on" />
+ </target>
+
+ <target name="doc" depends="init" description="Build javadoc">
+ <javadoc packagenames="gnu.testlet"
+ defaultexcludes="yes"
+ destdir="${docs}/"
+ classpathref="myclass.path"
+ windowtitle="Mauve test API" >
+ <doctitle><![CDATA[<h1>Mauve test API</h1>]]></doctitle>
+ </javadoc>
+ </target>
+
+ <target name="test" depends="init,compile" description="run the tests">
+ <taskdef name="mauve" classname="gnu.anttask.RunTests" classpath="build"/>
+ <mauve debug="false"
+ verbose="false"
+ haltonfailure="false"
+ failonerror="true">
+ <fileset dir="${build}" includes="gnu/testlet/java/**" />
+ <fileset dir="${build}" includes="gnu/testlet/javax/**" />
+ </mauve>
+ </target>
+ </project>
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 <zander@kde.org>
+
+ 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 <zander@kde.org>
+
+ // 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 <zander@kde.org>
+
+ // 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);
+ }
+ }