This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: JFileChooser tests
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Wed, 12 Oct 2005 16:40:33 +0000
- Subject: FYI: JFileChooser tests
Here are some tests I am using in my work on JFileChooser. I have a
patch for JFileChooser to make it pass all the tests, but it depends on
some other changes to BasicFileChooserUI that are not ready to go into
CVS yet:
2005-10-12 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/javax/swing/JFileChooser/accept.java: new test,
* gnu/testlet/javax/swing/JFileChooser/addChoosableFileFilter.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/constructors.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getAccessory.java: new test,
*
gnu/testlet/javax/swing/JFileChooser/getApproveButtonMnemonic.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/getApproveButtonText.java:
new test,
*
gnu/testlet/javax/swing/JFileChooser/getApproveButtonToolTipText.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/getChoosableFileFilters.java:
new test,
*
gnu/testlet/javax/swing/JFileChooser/getControlButtonsAreShown.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/getDialogTitle.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getDialogType.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getFileFilter.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getFileSelectionMode.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/getFileSystemView.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getFileView.java: new test,
* gnu/testlet/javax/swing/JFileChooser/getSelectedFiles.java: new test,
*
gnu/testlet/javax/swing/JFileChooser/isAcceptAllFileFilterUsed.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/isFileHidingEnabled.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/MyFileFilter.java: new test,
* gnu/testlet/javax/swing/JFileChooser/MyFileSystemView.java: new test,
*
gnu/testlet/javax/swing/JFileChooser/removeChoosableFileFilter.java: new
test,
*
gnu/testlet/javax/swing/JFileChooser/setAcceptAllFileFilterUsed.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/setAccessory.java: new test,
*
gnu/testlet/javax/swing/JFileChooser/setApproveButtonMnemonic.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/setApproveButtonText.java:
new test,
*
gnu/testlet/javax/swing/JFileChooser/setApproveButtonToolTipText.java:
new test,
*
gnu/testlet/javax/swing/JFileChooser/setControlButtonsAreShown.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/setCurrentDirectory.java: new
test,
* gnu/testlet/javax/swing/JFileChooser/setDialogTitle.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setDialogType.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setFileFilter.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setFileHidingEnabled.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/setFileSelectionMode.java:
new test,
* gnu/testlet/javax/swing/JFileChooser/setFileSystemView.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setFileView.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setSelectedFile.java: new test,
* gnu/testlet/javax/swing/JFileChooser/setSelectedFiles.java: new test.
Regards,
Dave
Index: gnu/testlet/javax/swing/JFileChooser/MyFileFilter.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/MyFileFilter.java
diff -N gnu/testlet/javax/swing/JFileChooser/MyFileFilter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/MyFileFilter.java 12 Oct 2005 15:29:36 -0000
@@ -0,0 +1,55 @@
+// Tags: not-a-test
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import java.io.File;
+
+import javax.swing.filechooser.FileFilter;
+
+public class MyFileFilter extends FileFilter
+{
+ private boolean directories;
+
+ /**
+ * Creates a new filter for testing purposes.
+ *
+ * @param acceptDirectories if <code>true</code> accept directories
+ * only, otherwise accept non-directory files only.
+ */
+ public MyFileFilter(boolean acceptDirectories)
+ {
+ directories = acceptDirectories;
+ }
+
+ public boolean accept(File file)
+ {
+ if (file == null)
+ return false;
+ if (directories)
+ return file.isDirectory();
+ else
+ return !file.isDirectory();
+ }
+
+ public String getDescription()
+ {
+ return "Test filter";
+ }
+}
Index: gnu/testlet/javax/swing/JFileChooser/MyFileSystemView.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/MyFileSystemView.java
diff -N gnu/testlet/javax/swing/JFileChooser/MyFileSystemView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/MyFileSystemView.java 12 Oct 2005 15:29:36 -0000
@@ -0,0 +1,20 @@
+/*
+ * Created on Oct 11, 2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package gnu.testlet.javax.swing.JFileChooser;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.swing.filechooser.FileSystemView;
+
+public class MyFileSystemView extends FileSystemView
+{
+ public File createNewFolder(File containingDir) throws IOException
+ {
+ return null;
+ }
+}
Index: gnu/testlet/javax/swing/JFileChooser/accept.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/accept.java
diff -N gnu/testlet/javax/swing/JFileChooser/accept.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/accept.java 12 Oct 2005 15:29:36 -0000
@@ -0,0 +1,57 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the accept() method of the
+ * {@link JFileChooser} class.
+ */
+public class accept implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ File f = new File(System.getProperty("user.home"));
+ harness.check(fc.accept(f), true);
+ harness.check(fc.accept(null), true);
+
+ fc.setFileFilter(new MyFileFilter(true));
+ harness.check(fc.accept(f), true);
+
+ fc.setFileFilter(new MyFileFilter(false));
+ harness.check(fc.accept(f), false);
+
+ fc.setFileFilter(null);
+ harness.check(fc.accept(f), true);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/addChoosableFileFilter.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/addChoosableFileFilter.java
diff -N gnu/testlet/javax/swing/JFileChooser/addChoosableFileFilter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/addChoosableFileFilter.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,124 @@
+// Tags: JDK1.2
+// Uses: MyFileFilter
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the addChoosableFileFilter() method of the
+ * {@link JFileChooser} class.
+ */
+public class addChoosableFileFilter implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testGeneral(harness);
+ testNull(harness);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void testGeneral(TestHarness harness)
+ {
+ harness.checkPoint("testGeneral()");
+ JFileChooser fc = new JFileChooser();
+ fc.addPropertyChangeListener(this);
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 2);
+ harness.check(filters[0], fc.getAcceptAllFileFilter());
+ harness.check(filters[1], f1);
+ harness.check(events.size(), 2);
+
+ // adding the new filter should have generated two events, one for
+ // the addition of a choosable file filter, and one for making it the
+ // selected filter...
+ PropertyChangeEvent event1 = (PropertyChangeEvent) events.get(0);
+ harness.check(event1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] oldFilters = (FileFilter[]) event1.getOldValue();
+ harness.check(oldFilters.length, 1);
+ harness.check(oldFilters[0], fc.getAcceptAllFileFilter());
+ FileFilter[] newFilters = (FileFilter[]) event1.getNewValue();
+ harness.check(newFilters.length, 2);
+ harness.check(newFilters[0], fc.getAcceptAllFileFilter());
+ harness.check(newFilters[1], f1);
+ PropertyChangeEvent event2 = (PropertyChangeEvent) events.get(1);
+ harness.check(event2.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(event2.getOldValue(), fc.getAcceptAllFileFilter());
+ harness.check(event2.getNewValue(), f1);
+ events.clear();
+ }
+
+ /**
+ * In this test, a null filter is added.
+ *
+ * @param harness the test harness.
+ */
+ public void testNull(TestHarness harness)
+ {
+ harness.checkPoint("testNull()");
+ JFileChooser fc = new JFileChooser();
+ events.clear();
+ fc.addPropertyChangeListener(this);
+ fc.addChoosableFileFilter(null);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(filters[0], fc.getAcceptAllFileFilter());
+ harness.check(events.size(), 1);
+
+ // adding the new filter should have generated two events, one for
+ // the addition of a choosable file filter, and one for making it the
+ // selected filter...
+ PropertyChangeEvent event1 = (PropertyChangeEvent) events.get(0);
+ harness.check(event1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(event1.getOldValue(), fc.getAcceptAllFileFilter());
+ harness.check(event1.getNewValue(), null);
+ events.clear();
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/constructors.java
diff -N gnu/testlet/javax/swing/JFileChooser/constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/constructors.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,150 @@
+// Tags: JDK1.2
+// Uses: MyFileSystemView
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileSystemView;
+
+/**
+ * Some checks for the constructors of the {@link JFileChooser} class.
+ */
+public class constructors implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testConstructor1(harness);
+ testConstructor2(harness);
+ testConstructor3(harness);
+ testConstructor4(harness);
+ testConstructor5(harness);
+ testConstructor6(harness);
+ }
+
+ public void testConstructor1(TestHarness harness)
+ {
+ harness.checkPoint("()");
+ JFileChooser fc = new JFileChooser();
+ harness.check(fc.getCurrentDirectory(),
+ new File(System.getProperty("user.home")));
+ }
+
+ public void testConstructor2(TestHarness harness)
+ {
+ harness.checkPoint("(File)");
+ File f = new File(System.getProperty("user.home"));
+ JFileChooser fc = new JFileChooser(f);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+
+ // null is OK and defaults to home directory
+ fc = new JFileChooser((File) null);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ }
+
+ public void testConstructor3(TestHarness harness)
+ {
+ harness.checkPoint("(File, FileSystemView)");
+ FileSystemView fsv = new MyFileSystemView();
+ File f = new File(System.getProperty("user.home"));
+ JFileChooser fc = new JFileChooser(f, fsv);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), fsv);
+
+ // null file is OK and defaults to home directory
+ fc = new JFileChooser((File) null, fsv);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), fsv);
+
+ // null FileSystemView reverts to default
+ fc = new JFileChooser(f, null);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), FileSystemView.getFileSystemView());
+ }
+
+ public void testConstructor4(TestHarness harness)
+ {
+ harness.checkPoint("(FileSystemView)");
+ FileSystemView fsv = new MyFileSystemView();
+ File f = new File(System.getProperty("user.home"));
+ JFileChooser fc = new JFileChooser(fsv);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), fsv);
+
+ // null FileSystemView reverts to default
+ fc = new JFileChooser((FileSystemView) null);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), FileSystemView.getFileSystemView());
+ }
+
+ public void testConstructor5(TestHarness harness)
+ {
+ harness.checkPoint("(String)");
+ File f = new File(System.getProperty("user.home"));
+ JFileChooser fc = new JFileChooser(System.getProperty("user.home"));
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+
+ // null is OK and defaults to home directory
+ fc = new JFileChooser((String) null);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ }
+
+ public void testConstructor6(TestHarness harness)
+ {
+ harness.checkPoint("(String, FileSystemView)");
+ FileSystemView fsv = new MyFileSystemView();
+ File f = new File(System.getProperty("user.home"));
+ JFileChooser fc = new JFileChooser(System.getProperty("user.home"), fsv);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), fsv);
+
+ // null file is OK and defaults to home directory
+ fc = new JFileChooser((String) null, fsv);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), fsv);
+
+ // null FileSystemView reverts to default
+ fc = new JFileChooser(System.getProperty("user.home"), null);
+ harness.check(fc.getCurrentDirectory(), f);
+ harness.check(fc.getSelectedFile(), null);
+ harness.check(fc.getFileSystemView(), FileSystemView.getFileSystemView());
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getAccessory.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getAccessory.java
diff -N gnu/testlet/javax/swing/JFileChooser/getAccessory.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getAccessory.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,52 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+
+/**
+ * Some checks for the getAccessory() method of the
+ * {@link JFileChooser} class.
+ */
+public class getAccessory implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getAccessory(), null);
+
+ JPanel acc1 = new JPanel();
+ jfc.setAccessory(acc1);
+ harness.check(jfc.getAccessory(), acc1);
+
+ jfc.setAccessory(null);
+ harness.check(jfc.getAccessory(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getApproveButtonMnemonic.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getApproveButtonMnemonic.java
diff -N gnu/testlet/javax/swing/JFileChooser/getApproveButtonMnemonic.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getApproveButtonMnemonic.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getApproveButtonMnemoic() method of the
+ * {@link JFileChooser} class.
+ */
+public class getApproveButtonMnemonic implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getApproveButtonMnemonic(), 0);
+
+ jfc.setApproveButtonMnemonic(79);
+ harness.check(jfc.getApproveButtonMnemonic(), 79);
+
+ jfc.setApproveButtonMnemonic(0);
+ harness.check(jfc.getApproveButtonMnemonic(), 0);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getApproveButtonText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getApproveButtonText.java
diff -N gnu/testlet/javax/swing/JFileChooser/getApproveButtonText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getApproveButtonText.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getApproveButtonText() method of the
+ * {@link JFileChooser} class.
+ */
+public class getApproveButtonText implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getApproveButtonText(), null);
+
+ jfc.setApproveButtonText("XYZ");
+ harness.check(jfc.getApproveButtonText(), "XYZ");
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getApproveButtonToolTipText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getApproveButtonToolTipText.java
diff -N gnu/testlet/javax/swing/JFileChooser/getApproveButtonToolTipText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getApproveButtonToolTipText.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getApproveButtonToolTipText() method of the
+ * {@link JFileChooser} class.
+ */
+public class getApproveButtonToolTipText implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getApproveButtonToolTipText(), null);
+
+ jfc.setApproveButtonToolTipText("XYZ");
+ harness.check(jfc.getApproveButtonToolTipText(), "XYZ");
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getChoosableFileFilters.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getChoosableFileFilters.java
diff -N gnu/testlet/javax/swing/JFileChooser/getChoosableFileFilters.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getChoosableFileFilters.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,49 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the getChoosableFileFilters() method of the
+ * {@link JFileChooser} class.
+ */
+public class getChoosableFileFilters implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ FileFilter[] ff1 = fc.getChoosableFileFilters();
+ FileFilter[] ff2 = fc.getChoosableFileFilters();
+ harness.check(ff1 != ff2);
+ harness.check(ff1[0], ff2[0]);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getControlButtonsAreShown.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getControlButtonsAreShown.java
diff -N gnu/testlet/javax/swing/JFileChooser/getControlButtonsAreShown.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getControlButtonsAreShown.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,51 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getControlButtonsAreShown() method of the
+ * {@link JFileChooser} class.
+ */
+public class getControlButtonsAreShown implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getControlButtonsAreShown(), true);
+
+ jfc.setControlButtonsAreShown(false);
+ harness.check(jfc.getControlButtonsAreShown(), false);
+
+ jfc.setControlButtonsAreShown(true);
+ harness.check(jfc.getControlButtonsAreShown(), true);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getDialogTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getDialogTitle.java
diff -N gnu/testlet/javax/swing/JFileChooser/getDialogTitle.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getDialogTitle.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getDialogTitle() method of the
+ * {@link JFileChooser} class.
+ */
+public class getDialogTitle implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getDialogTitle(), null);
+
+ jfc.setDialogTitle("XYZ");
+ harness.check(jfc.getDialogTitle(), "XYZ");
+
+ jfc.setDialogTitle(null);
+ harness.check(jfc.getDialogTitle(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getDialogType.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getDialogType.java
diff -N gnu/testlet/javax/swing/JFileChooser/getDialogType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getDialogType.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getDialogType() method of the
+ * {@link JFileChooser} class.
+ */
+public class getDialogType implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getDialogType(), JFileChooser.OPEN_DIALOG);
+
+ jfc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(jfc.getDialogType(), JFileChooser.SAVE_DIALOG);
+
+ jfc.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ harness.check(jfc.getDialogType(), JFileChooser.CUSTOM_DIALOG);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getFileFilter.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getFileFilter.java
diff -N gnu/testlet/javax/swing/JFileChooser/getFileFilter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getFileFilter.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+// Uses: MyFileFilter
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the getFileFilter() method of the
+ * {@link JFileChooser} class.
+ */
+public class getFileFilter implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ harness.check(fc.getFileFilter(), fc.getAcceptAllFileFilter());
+
+ FileFilter ff1 = new MyFileFilter(true);
+ fc.setFileFilter(ff1);
+ harness.check(fc.getFileFilter(), ff1);
+
+ fc.setFileFilter(null);
+ harness.check(fc.getFileFilter(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getFileSelectionMode.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getFileSelectionMode.java
diff -N gnu/testlet/javax/swing/JFileChooser/getFileSelectionMode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getFileSelectionMode.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getFileSelectionMode() method of the
+ * {@link JFileChooser} class.
+ */
+public class getFileSelectionMode implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ harness.check(fc.getFileSelectionMode(), JFileChooser.FILES_ONLY);
+
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ harness.check(fc.getFileSelectionMode(), JFileChooser.DIRECTORIES_ONLY);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getFileSystemView.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getFileSystemView.java
diff -N gnu/testlet/javax/swing/JFileChooser/getFileSystemView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getFileSystemView.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,52 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileSystemView;
+
+/**
+ * Some checks for the getFileSystemView() method of the
+ * {@link JFileChooser} class.
+ */
+public class getFileSystemView implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getFileSystemView(), FileSystemView.getFileSystemView());
+
+ FileSystemView fsv1 = new MyFileSystemView();
+ jfc.setFileSystemView(fsv1);
+ harness.check(jfc.getFileSystemView(), fsv1);
+
+ jfc.setFileSystemView(null);
+ harness.check(jfc.getFileSystemView(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getFileView.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getFileView.java
diff -N gnu/testlet/javax/swing/JFileChooser/getFileView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getFileView.java 12 Oct 2005 15:29:37 -0000
@@ -0,0 +1,51 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileView;
+
+/**
+ * Some checks for the getFileView() method of the
+ * {@link JFileChooser} class.
+ */
+public class getFileView implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.getFileView(), null);
+
+ FileView fv1 = new FileView() {};
+ jfc.setFileView(fv1);
+ harness.check(jfc.getFileView(), fv1);
+ jfc.setFileView(null);
+ harness.check(jfc.getFileView(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/getSelectedFiles.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/getSelectedFiles.java
diff -N gnu/testlet/javax/swing/JFileChooser/getSelectedFiles.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/getSelectedFiles.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,64 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the getSelectedFiles() method of the
+ * {@link JFileChooser} class.
+ */
+public class getSelectedFiles implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ File[] files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+
+ File f1 = new File("X");
+ files = new File[] { f1 };
+ fc.setSelectedFiles(files);
+ File[] ff = fc.getSelectedFiles();
+ harness.check(ff[0], f1);
+
+ // try null
+ fc.setSelectedFiles(null);
+ ff = fc.getSelectedFiles();
+ harness.check(ff.length, 0);
+
+ // try an empty array
+ fc.setSelectedFiles(new File[0]);
+ ff = fc.getSelectedFiles();
+ harness.check(ff.length, 0);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/isAcceptAllFileFilterUsed.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/isAcceptAllFileFilterUsed.java
diff -N gnu/testlet/javax/swing/JFileChooser/isAcceptAllFileFilterUsed.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/isAcceptAllFileFilterUsed.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the isAcceptAllFileFilterUsed() method of the
+ * {@link JFileChooser} class.
+ */
+public class isAcceptAllFileFilterUsed implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.isAcceptAllFileFilterUsed(), true);
+
+ jfc.setAcceptAllFileFilterUsed(false);
+ harness.check(jfc.isAcceptAllFileFilterUsed(), false);
+
+ jfc.setAcceptAllFileFilterUsed(true);
+ harness.check(jfc.isAcceptAllFileFilterUsed(), true);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/isFileHidingEnabled.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/isFileHidingEnabled.java
diff -N gnu/testlet/javax/swing/JFileChooser/isFileHidingEnabled.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/isFileHidingEnabled.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,50 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the isFileHidingEnabled() method of the
+ * {@link JFileChooser} class.
+ */
+public class isFileHidingEnabled implements Testlet {
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ harness.check(jfc.isFileHidingEnabled(), true);
+
+ jfc.setFileHidingEnabled(false);
+ harness.check(jfc.isFileHidingEnabled(), false);
+
+ jfc.setFileHidingEnabled(true);
+ harness.check(jfc.isFileHidingEnabled(), true);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/removeChoosableFileFilter.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/removeChoosableFileFilter.java
diff -N gnu/testlet/javax/swing/JFileChooser/removeChoosableFileFilter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/removeChoosableFileFilter.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,333 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+import javax.swing.UIManager;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the removeChoosableFileFilter() method of the
+ * {@link JFileChooser} class.
+ */
+public class removeChoosableFileFilter implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ try
+ {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ test1(harness);
+ test2(harness);
+ test3(harness);
+ test4(harness);
+ test5(harness);
+ test6(harness);
+ test7(harness);
+ test8(harness);
+ }
+
+ /**
+ * In this test, 'accept all' is the only filter in the list, and we try
+ * removing it.
+ *
+ * @param harness
+ */
+ public void test1(TestHarness harness)
+ {
+ harness.checkPoint("test1");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ fc.addPropertyChangeListener(this);
+ fc.removeChoosableFileFilter(acceptAllFilter);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 0);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), acceptAllFilter);
+ harness.check(e1.getNewValue(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e2.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e2.getNewValue();
+ harness.check(ff1.length, 1);
+ harness.check(ff2.length, 0);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is the selected filter, there is another
+ * item in the list, and we remove 'accept all'.
+ * @param harness
+ */
+ public void test2(TestHarness harness)
+ {
+ harness.checkPoint("test2");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ fc.setFileFilter(acceptAllFilter);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(acceptAllFilter);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), acceptAllFilter);
+ harness.check(e1.getNewValue(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e2.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e2.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), null);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is the selected filter, there is another
+ * item in the list, and we remove the other item.
+ *
+ * @param harness
+ */
+ public void test3(TestHarness harness)
+ {
+ harness.checkPoint("test3");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ fc.setFileFilter(acceptAllFilter);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(f1);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e1.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e1.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), acceptAllFilter);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is in the list, there is another
+ * item selected, and we remove 'accept all'.
+ * @param harness
+ */
+ public void test4(TestHarness harness)
+ {
+ harness.checkPoint("test4");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(acceptAllFilter);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e1.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e1.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), f1);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is in the list, there is another
+ * item selected, and we remove the selected item.
+ * @param harness
+ */
+ public void test5(TestHarness harness)
+ {
+ harness.checkPoint("test5");
+ JFileChooser fc = new JFileChooser();
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(f1);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), f1);
+ harness.check(e1.getNewValue(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e2.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e2.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), null);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is not in use, there is only one item and we
+ * remove it.
+ *
+ * @param harness
+ */
+ public void test6(TestHarness harness)
+ {
+ harness.checkPoint("test6");
+ JFileChooser fc = new JFileChooser();
+ FileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ fc.setAcceptAllFileFilterUsed(false);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(f1);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 0);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), f1);
+ harness.check(e1.getNewValue(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e2.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e2.getNewValue();
+ harness.check(ff1.length, 1);
+ harness.check(ff2.length, 0);
+ harness.check(fc.getFileFilter(), null);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is not in use, there are two filters and we
+ * remove the selected filter.
+ *
+ * @param harness
+ */
+ public void test7(TestHarness harness)
+ {
+ harness.checkPoint("test7");
+ JFileChooser fc = new JFileChooser();
+ FileFilter f1 = new MyFileFilter(true);
+ FileFilter f2 = new MyFileFilter(false);
+ fc.addChoosableFileFilter(f1);
+ fc.addChoosableFileFilter(f2);
+ fc.setAcceptAllFileFilterUsed(false);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(f2);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), f2);
+ harness.check(e1.getNewValue(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e2.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e2.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), null);
+ events.clear();
+ }
+
+ /**
+ * In this test, 'accept all' is not in use, there are two filters and we
+ * remove the not-selected filter.
+ *
+ * @param harness
+ */
+ public void test8(TestHarness harness)
+ {
+ harness.checkPoint("test8");
+ JFileChooser fc = new JFileChooser();
+ FileFilter f1 = new MyFileFilter(true);
+ FileFilter f2 = new MyFileFilter(false);
+ fc.addChoosableFileFilter(f1);
+ fc.addChoosableFileFilter(f2);
+ fc.setAcceptAllFileFilterUsed(false);
+ fc.addPropertyChangeListener(this);
+ boolean removed = fc.removeChoosableFileFilter(f1);
+ harness.check(removed);
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] ff1 = (FileFilter[]) e1.getOldValue();
+ FileFilter[] ff2 = (FileFilter[]) e1.getNewValue();
+ harness.check(ff1.length, 2);
+ harness.check(ff2.length, 1);
+ harness.check(fc.getFileFilter(), f2);
+ events.clear();
+ }
+}
Index: gnu/testlet/javax/swing/JFileChooser/setAcceptAllFileFilterUsed.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setAcceptAllFileFilterUsed.java
diff -N gnu/testlet/javax/swing/JFileChooser/setAcceptAllFileFilterUsed.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setAcceptAllFileFilterUsed.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,112 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the setAcceptAllFileFilterUsed() method of the
+ * {@link JFileChooser} class.
+ */
+public class setAcceptAllFileFilterUsed implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ fc.addPropertyChangeListener(this);
+ harness.check(fc.isAcceptAllFileFilterUsed(), true);
+ MyFileFilter f1 = new MyFileFilter(true);
+ fc.addChoosableFileFilter(f1);
+ events.clear();
+
+ fc.setAcceptAllFileFilterUsed(false);
+ harness.check(fc.isAcceptAllFileFilterUsed(), false);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] oldFilters = (FileFilter[]) e1.getOldValue();
+ harness.check(oldFilters.length, 2);
+ harness.check(oldFilters[0], acceptAllFilter);
+ harness.check(oldFilters[1], f1);
+ FileFilter[] newFilters = (FileFilter[]) e1.getNewValue();
+ harness.check(newFilters.length, 1);
+ harness.check(newFilters[0], f1);
+
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY);
+
+ // also check if the 'accept all' filter is removed from the choosable
+ // filters list
+ FileFilter[] filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 1);
+ harness.check(filters[0], f1);
+ events.clear();
+
+ FileFilter ff = new MyFileFilter(false);
+ fc.addChoosableFileFilter(ff);
+ events.clear();
+ harness.check(fc.getFileFilter(), ff);
+ fc.setAcceptAllFileFilterUsed(true);
+ harness.check(fc.isAcceptAllFileFilterUsed(), true);
+ harness.check(fc.getFileFilter(), fc.getAcceptAllFileFilter());
+
+ // expect 3 events
+ harness.check(events.size(), 3);
+ e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+
+ e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+// harness.check(e1.getOldValue(), Boolean.FALSE);
+// harness.check(e1.getNewValue(), Boolean.TRUE);
+ PropertyChangeEvent e3 = (PropertyChangeEvent) events.get(2);
+ harness.check(e3.getPropertyName(),
+ JFileChooser.ACCEPT_ALL_FILE_FILTER_USED_CHANGED_PROPERTY);
+
+ filters = fc.getChoosableFileFilters();
+ harness.check(filters.length, 3);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setAccessory.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setAccessory.java
diff -N gnu/testlet/javax/swing/JFileChooser/setAccessory.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setAccessory.java 12 Oct 2005 15:29:38 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+
+/**
+ * Some checks for the setAccessory() method of the
+ * {@link JFileChooser} class.
+ */
+public class setAccessory implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getAccessory(), null);
+
+ JPanel acc1 = new JPanel();
+ jfc.setAccessory(acc1);
+ harness.check(jfc.getAccessory(), acc1);
+ harness.check(event.getPropertyName(),
+ JFileChooser.ACCESSORY_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), null);
+ harness.check(event.getNewValue(), acc1);
+
+ jfc.setAccessory(null);
+ harness.check(jfc.getAccessory(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.ACCESSORY_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), acc1);
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setApproveButtonMnemonic.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setApproveButtonMnemonic.java
diff -N gnu/testlet/javax/swing/JFileChooser/setApproveButtonMnemonic.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setApproveButtonMnemonic.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setApproveButtonMnemoic() method of the
+ * {@link JFileChooser} class.
+ */
+public class setApproveButtonMnemonic implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getApproveButtonMnemonic(), 0);
+
+ jfc.setApproveButtonMnemonic(79);
+ harness.check(jfc.getApproveButtonMnemonic(), 79);
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), new Integer(0));
+ harness.check(event.getNewValue(), new Integer(79));
+
+ jfc.setApproveButtonMnemonic(0);
+ harness.check(jfc.getApproveButtonMnemonic(), 0);
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), new Integer(79));
+ harness.check(event.getNewValue(), new Integer(0));
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setApproveButtonText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setApproveButtonText.java
diff -N gnu/testlet/javax/swing/JFileChooser/setApproveButtonText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setApproveButtonText.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setApproveButtonText() method of the
+ * {@link JFileChooser} class.
+ */
+public class setApproveButtonText implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getApproveButtonText(), null);
+
+ jfc.setApproveButtonText("XYZ");
+ harness.check(jfc.getApproveButtonText(), "XYZ");
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), null);
+ harness.check(event.getNewValue(), "XYZ");
+
+ jfc.setApproveButtonText(null);
+ harness.check(jfc.getApproveButtonText(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), "XYZ");
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setApproveButtonToolTipText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setApproveButtonToolTipText.java
diff -N gnu/testlet/javax/swing/JFileChooser/setApproveButtonToolTipText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setApproveButtonToolTipText.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,70 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setApproveButtonToolTipText() method of the
+ * {@link JFileChooser} class.
+ */
+public class setApproveButtonToolTipText
+ implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getApproveButtonToolTipText(), null);
+
+ jfc.setApproveButtonToolTipText("XYZ");
+ harness.check(jfc.getApproveButtonToolTipText(), "XYZ");
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), null);
+ harness.check(event.getNewValue(), "XYZ");
+
+ jfc.setApproveButtonToolTipText(null);
+ harness.check(jfc.getApproveButtonToolTipText(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), "XYZ");
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setControlButtonsAreShown.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setControlButtonsAreShown.java
diff -N gnu/testlet/javax/swing/JFileChooser/setControlButtonsAreShown.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setControlButtonsAreShown.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,70 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setControlButtonsAreShown() method of the
+ * {@link JFileChooser} class.
+ */
+public class setControlButtonsAreShown implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getControlButtonsAreShown(), true);
+
+ jfc.setControlButtonsAreShown(false);
+ harness.check(jfc.getControlButtonsAreShown(), false);
+ harness.check(event.getPropertyName(),
+ JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), Boolean.TRUE);
+ harness.check(event.getNewValue(), Boolean.FALSE);
+
+ jfc.setControlButtonsAreShown(true);
+ harness.check(jfc.getControlButtonsAreShown(), true);
+ harness.check(event.getPropertyName(),
+ JFileChooser.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), Boolean.FALSE);
+ harness.check(event.getNewValue(), Boolean.TRUE);
+
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setCurrentDirectory.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setCurrentDirectory.java
diff -N gnu/testlet/javax/swing/JFileChooser/setCurrentDirectory.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setCurrentDirectory.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setCurrentDirectory() method of the
+ * {@link JFileChooser} class.
+ */
+public class setCurrentDirectory implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser fc = new JFileChooser();
+ fc.addPropertyChangeListener(this);
+ harness.check(fc.getCurrentDirectory(), new File(System.getProperty("user.home")));
+
+ File d = new File(harness.getTempDirectory());
+ fc.setCurrentDirectory(d);
+ harness.check(fc.getCurrentDirectory(), d);
+ harness.check(event.getPropertyName(), JFileChooser.DIRECTORY_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), new File(System.getProperty("user.home")));
+ harness.check(event.getNewValue(), d);
+
+ fc.setCurrentDirectory(null);
+ harness.check(fc.getCurrentDirectory(), new File(System.getProperty("user.home")));
+ harness.check(event.getPropertyName(), JFileChooser.DIRECTORY_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), d);
+ harness.check(event.getNewValue(), new File(System.getProperty("user.home")));
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setDialogTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setDialogTitle.java
diff -N gnu/testlet/javax/swing/JFileChooser/setDialogTitle.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setDialogTitle.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setDialogTitle() method of the
+ * {@link JFileChooser} class.
+ */
+public class setDialogTitle implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getDialogTitle(), null);
+
+ jfc.setDialogTitle("XYZ");
+ harness.check(jfc.getDialogTitle(), "XYZ");
+ harness.check(event.getPropertyName(),
+ JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), null);
+ harness.check(event.getNewValue(), "XYZ");
+
+ jfc.setDialogTitle(null);
+ harness.check(jfc.getDialogTitle(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.DIALOG_TITLE_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), "XYZ");
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setDialogType.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setDialogType.java
diff -N gnu/testlet/javax/swing/JFileChooser/setDialogType.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setDialogType.java 12 Oct 2005 15:29:39 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setDialogType() method of the
+ * {@link JFileChooser} class.
+ */
+public class setDialogType implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getDialogType(), JFileChooser.OPEN_DIALOG);
+
+ jfc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(jfc.getDialogType(), JFileChooser.SAVE_DIALOG);
+ harness.check(event.getPropertyName(),
+ JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), new Integer(JFileChooser.OPEN_DIALOG));
+ harness.check(event.getNewValue(), new Integer(JFileChooser.SAVE_DIALOG));
+
+ jfc.setDialogType(JFileChooser.CUSTOM_DIALOG);
+ harness.check(jfc.getDialogType(), JFileChooser.CUSTOM_DIALOG);
+ harness.check(event.getPropertyName(),
+ JFileChooser.DIALOG_TYPE_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), new Integer(JFileChooser.SAVE_DIALOG));
+ harness.check(event.getNewValue(), new Integer(JFileChooser.CUSTOM_DIALOG));
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setFileFilter.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setFileFilter.java
diff -N gnu/testlet/javax/swing/JFileChooser/setFileFilter.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setFileFilter.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,101 @@
+// Tags: JDK1.2
+// Uses: MyFileFilter
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ * Some checks for the setFileFilter() method of the
+ * {@link JFileChooser} class.
+ */
+public class setFileFilter implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ test1(harness);
+ test2(harness);
+ }
+
+ public void test1(TestHarness harness)
+ {
+ harness.checkPoint("test1");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ fc.addPropertyChangeListener(this);
+ harness.check(fc.getFileFilter(), acceptAllFilter);
+
+ FileFilter ff1 = new MyFileFilter(true);
+ fc.setFileFilter(ff1);
+ harness.check(fc.getFileFilter(), ff1);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY);
+ FileFilter[] filters1 = (FileFilter[]) e1.getOldValue();
+ harness.check(filters1.length, 1);
+ FileFilter[] filters2 = (FileFilter[]) e1.getNewValue();
+ harness.check(filters2.length, 2);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(e2.getOldValue(), acceptAllFilter);
+ harness.check(e2.getNewValue(), ff1);
+ events.clear();
+ }
+
+ public void test2(TestHarness harness)
+ {
+ harness.checkPoint("test2");
+ JFileChooser fc = new JFileChooser();
+ FileFilter acceptAllFilter = fc.getAcceptAllFileFilter();
+ fc.addPropertyChangeListener(this);
+ harness.check(fc.getFileFilter(), acceptAllFilter);
+
+ fc.setFileFilter(null);
+ harness.check(fc.getFileFilter(), null);
+ harness.check(events.size(), 1);
+ PropertyChangeEvent event = (PropertyChangeEvent) events.get(0);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_FILTER_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), acceptAllFilter);
+ harness.check(event.getNewValue(), null);
+ }
+}
Index: gnu/testlet/javax/swing/JFileChooser/setFileHidingEnabled.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setFileHidingEnabled.java
diff -N gnu/testlet/javax/swing/JFileChooser/setFileHidingEnabled.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setFileHidingEnabled.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,70 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setFileHidingEnabled() method of the
+ * {@link JFileChooser} class.
+ */
+public class setFileHidingEnabled implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.isFileHidingEnabled(), true);
+
+ jfc.setFileHidingEnabled(false);
+ harness.check(jfc.isFileHidingEnabled(), false);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_HIDING_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), Boolean.TRUE);
+ harness.check(event.getNewValue(), Boolean.FALSE);
+
+ jfc.setFileHidingEnabled(true);
+ harness.check(jfc.isFileHidingEnabled(), true);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_HIDING_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), Boolean.FALSE);
+ harness.check(event.getNewValue(), Boolean.TRUE);
+
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setFileSelectionMode.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setFileSelectionMode.java
diff -N gnu/testlet/javax/swing/JFileChooser/setFileSelectionMode.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setFileSelectionMode.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,76 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setFileSelectionMode() method of the
+ * {@link JFileChooser} class.
+ */
+public class setFileSelectionMode implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getFileSelectionMode(),
+ JFileChooser.FILES_ONLY);
+
+ jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ harness.check(jfc.getFileSelectionMode(), JFileChooser.DIRECTORIES_ONLY);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_SELECTION_MODE_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(),
+ new Integer(JFileChooser.FILES_ONLY));
+ harness.check(event.getNewValue(),
+ new Integer(JFileChooser.DIRECTORIES_ONLY));
+
+ boolean pass = false;
+ try
+ {
+ jfc.setFileSelectionMode(99);
+ }
+ catch (IllegalArgumentException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setFileSystemView.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setFileSystemView.java
diff -N gnu/testlet/javax/swing/JFileChooser/setFileSystemView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setFileSystemView.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileSystemView;
+
+/**
+ * Some checks for the setFileSystemView() method of the
+ * {@link JFileChooser} class.
+ */
+public class setFileSystemView implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getFileSystemView(), FileSystemView.getFileSystemView());
+
+ FileSystemView fsv1 = new MyFileSystemView();
+ jfc.setFileSystemView(fsv1);
+ harness.check(jfc.getFileSystemView(), fsv1);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_SYSTEM_VIEW_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), FileSystemView.getFileSystemView());
+ harness.check(event.getNewValue(), fsv1);
+
+ jfc.setFileSystemView(null);
+ harness.check(jfc.getFileSystemView(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_SYSTEM_VIEW_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), fsv1);
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setFileView.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setFileView.java
diff -N gnu/testlet/javax/swing/JFileChooser/setFileView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setFileView.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,71 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileView;
+
+/**
+ * Some checks for the setFileView() method of the
+ * {@link JFileChooser} class.
+ */
+public class setFileView implements Testlet, PropertyChangeListener {
+
+ PropertyChangeEvent event;
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ event = e;
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ JFileChooser jfc = new JFileChooser();
+ jfc.addPropertyChangeListener(this);
+ harness.check(jfc.getFileView(), null);
+
+ FileView fv1 = new FileView() {};
+ jfc.setFileView(fv1);
+ harness.check(jfc.getFileView(), fv1);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_VIEW_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), null);
+ harness.check(event.getNewValue(), fv1);
+
+ jfc.setFileView(null);
+ harness.check(jfc.getFileView(), null);
+ harness.check(event.getPropertyName(),
+ JFileChooser.FILE_VIEW_CHANGED_PROPERTY);
+ harness.check(event.getOldValue(), fv1);
+ harness.check(event.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/JFileChooser/setSelectedFile.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setSelectedFile.java
diff -N gnu/testlet/javax/swing/JFileChooser/setSelectedFile.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setSelectedFile.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,117 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setSelectedFile() method of the
+ * {@link JFileChooser} class.
+ */
+public class setSelectedFile implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testGeneral(harness);
+ testNull(harness);
+ }
+
+ /**
+ * A general test.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void testGeneral(TestHarness harness)
+ {
+ harness.checkPoint("testGeneral()");
+ JFileChooser fc = new JFileChooser();
+ events.clear();
+ fc.addPropertyChangeListener(this);
+ File file = fc.getSelectedFile();
+ harness.check(file, null);
+
+ File f1 = new File("X");
+ fc.setSelectedFile(f1);
+ harness.check(fc.getSelectedFile(), f1);
+ File[] files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), null);
+ harness.check(e1.getNewValue(), f1);
+ events.clear();
+
+ // repeat the same file to see if an event is generated...
+ fc.setSelectedFile(f1);
+ harness.check(fc.getSelectedFile(), f1);
+ files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+
+ harness.check(events.size(), 0);
+ }
+
+ /**
+ * Test setting the selected files to null.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void testNull(TestHarness harness)
+ {
+ harness.checkPoint("testNull()");
+ JFileChooser fc = new JFileChooser();
+ events.clear();
+ fc.addPropertyChangeListener(this);
+ File file = fc.getSelectedFile();
+ harness.check(file, null);
+ fc.setSelectedFile(null);
+ harness.check(fc.getSelectedFile(), null);
+
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), null);
+ harness.check(e1.getNewValue(), null);
+ events.clear();
+ }
+}
Index: gnu/testlet/javax/swing/JFileChooser/setSelectedFiles.java
===================================================================
RCS file: gnu/testlet/javax/swing/JFileChooser/setSelectedFiles.java
diff -N gnu/testlet/javax/swing/JFileChooser/setSelectedFiles.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JFileChooser/setSelectedFiles.java 12 Oct 2005 15:29:40 -0000
@@ -0,0 +1,142 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// 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, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.JFileChooser;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.List;
+
+import javax.swing.JFileChooser;
+
+/**
+ * Some checks for the setSelectedFiles() method of the
+ * {@link JFileChooser} class.
+ */
+public class setSelectedFiles implements Testlet, PropertyChangeListener {
+
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ testGeneral(harness);
+ testNull(harness);
+ testEmptyArray(harness);
+ }
+
+ /**
+ * A general test.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void testGeneral(TestHarness harness)
+ {
+ harness.checkPoint("testGeneral()");
+ JFileChooser fc = new JFileChooser();
+ fc.addPropertyChangeListener(this);
+ File[] files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+
+ File f1 = new File("X");
+ files = new File[] { f1 };
+ fc.setSelectedFiles(files);
+ File[] ff = fc.getSelectedFiles();
+ harness.check(ff[0], f1);
+
+ harness.check(fc.getSelectedFile(), f1);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.SELECTED_FILES_CHANGED_PROPERTY);
+ events.clear();
+ }
+
+ /**
+ * Test setting the selected files to null.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void testNull(TestHarness harness)
+ {
+ harness.checkPoint("testNull()");
+ JFileChooser fc = new JFileChooser();
+ fc.addPropertyChangeListener(this);
+ File[] files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+ harness.check(fc.getSelectedFile(), null);
+
+ // try null
+ fc.setSelectedFiles(null);
+ files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY);
+ harness.check(e1.getOldValue(), null);
+ harness.check(e1.getNewValue(), null);
+ harness.check(fc.getSelectedFile(), null);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.SELECTED_FILES_CHANGED_PROPERTY);
+ events.clear();
+
+ }
+
+ public void testEmptyArray(TestHarness harness)
+ {
+ harness.checkPoint("testEmptyArray()");
+ JFileChooser fc = new JFileChooser();
+ events.clear();
+ fc.addPropertyChangeListener(this);
+ File[] files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+
+ // try an empty array
+ fc.setSelectedFiles(new File[0]);
+ files = fc.getSelectedFiles();
+ harness.check(files.length, 0);
+ harness.check(events.size(), 2);
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(0);
+ harness.check(e1.getPropertyName(),
+ JFileChooser.SELECTED_FILE_CHANGED_PROPERTY);
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(1);
+ harness.check(e2.getPropertyName(),
+ JFileChooser.SELECTED_FILES_CHANGED_PROPERTY);
+ events.clear();
+ }
+
+}