This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: BasicFileChooserUI
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Thu, 13 Oct 2005 09:42:15 +0000
- Subject: FYI: BasicFileChooserUI
I committed these new tests for the BasicFileChooserUI class, part of my
ongoing work on JFileChooser, BasicFileChooserUI and MetalFileChooserUI:
2005-10-13 David Gilbert <david.gilbert@object-refinery.com>
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/MyBasicFileChooserUI.java:
new support class,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/constructor.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButton.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonMnemonic.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonText.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonToolTipText.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveSelectionAciton.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getCancelSelectionAction.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getChangeToParentDirectoryAction.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDialogTitle.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDirectoryName.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileName.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileView.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getGoHomeAction.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getNewFolderAction.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getUpdateAction.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installIcons.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installStrings.java:
new test,
*
gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/uninstallStrings.java:
new test.
Regards,
Dave
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/MyBasicFileChooserUI.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/MyBasicFileChooserUI.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/MyBasicFileChooserUI.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/MyBasicFileChooserUI.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,173 @@
+// Tags: not-a-test
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import javax.swing.Icon;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Provides access to protected fields and methods.
+ */
+public class MyBasicFileChooserUI extends BasicFileChooserUI
+{
+
+ public MyBasicFileChooserUI(JFileChooser fc)
+ {
+ super(fc);
+ }
+ public JButton getApproveButton(JFileChooser fc)
+ {
+ return super.getApproveButton(fc);
+ }
+ public int getCancelButtonMnemonic()
+ {
+ return this.cancelButtonMnemonic;
+ }
+ public String getCancelButtonText()
+ {
+ return this.cancelButtonText;
+ }
+ public String getCancelButtonToolTipText()
+ {
+ return this.cancelButtonToolTipText;
+ }
+ public int getDirectoryOpenButtonMnemonic()
+ {
+ return this.directoryOpenButtonMnemonic;
+ }
+ public String getDirectoryOpenButtonText()
+ {
+ return this.directoryOpenButtonText;
+ }
+ public String getDirectoryOpenButtonToolTipText()
+ {
+ return this.directoryOpenButtonToolTipText;
+ }
+ public int getHelpButtonMnemonic()
+ {
+ return this.helpButtonMnemonic;
+ }
+ public String getHelpButtonText()
+ {
+ return this.helpButtonText;
+ }
+ public String getHelpButtonToolTipText()
+ {
+ return this.helpButtonToolTipText;
+ }
+ public int getOpenButtonMnemonic()
+ {
+ return this.openButtonMnemonic;
+ }
+ public String getOpenButtonText()
+ {
+ return this.openButtonText;
+ }
+ public String getOpenButtonToolTipText()
+ {
+ return this.openButtonToolTipText;
+ }
+ public int getSaveButtonMnemonic()
+ {
+ return this.saveButtonMnemonic;
+ }
+ public String getSaveButtonText()
+ {
+ return this.saveButtonText;
+ }
+ public String getSaveButtonToolTipText()
+ {
+ return this.saveButtonToolTipText;
+ }
+ public int getUpdateButtonMnemonic()
+ {
+ return this.updateButtonMnemonic;
+ }
+ public String getUpdateButtonText()
+ {
+ return this.updateButtonText;
+ }
+ public String getUpdateButtonToolTipText()
+ {
+ return this.updateButtonToolTipText;
+ }
+ public void installStrings(JFileChooser fc)
+ {
+ super.installStrings(fc);
+ }
+ public void uninstallStrings(JFileChooser fc)
+ {
+ super.uninstallStrings(fc);
+ }
+ public void installIcons(JFileChooser fc)
+ {
+ super.installIcons(fc);
+ }
+ public void uninstallIcons(JFileChooser fc)
+ {
+ super.uninstallIcons(fc);
+ }
+ public Icon getComputerIcon()
+ {
+ return this.computerIcon;
+ }
+ public Icon getDetailsViewIcon()
+ {
+ return this.detailsViewIcon;
+ }
+ public Icon getDirectoryIcon()
+ {
+ return this.directoryIcon;
+ }
+ public Icon getFileIcon()
+ {
+ return this.fileIcon;
+ }
+ public Icon getFloppyDriveIcon()
+ {
+ return this.floppyDriveIcon;
+ }
+ public Icon getHardDriveIcon()
+ {
+ return this.hardDriveIcon;
+ }
+ public Icon getHomeFolderIcon()
+ {
+ return this.homeFolderIcon;
+ }
+ public Icon getListViewIcon()
+ {
+ return this.listViewIcon;
+ }
+ public Icon getNewFolderIcon()
+ {
+ return this.newFolderIcon;
+ }
+ public Icon getUpFolderIcon()
+ {
+ return this.upFolderIcon;
+ }
+}
+
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/constructor.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/constructor.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/constructor.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/constructor.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,54 @@
+// Tags: JDK1.2
+// Uses: MyBasicFileChooserUI
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the constructor in the {@link BasicFileChooserUI}
+ * class.
+ */
+public class constructor 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();
+ MyBasicFileChooserUI ui = new MyBasicFileChooserUI(fc);
+ harness.check(ui.getFileChooser(), null);
+ harness.check(ui.getCancelButtonText(), null);
+ harness.check(ui.getCancelButtonToolTipText(), null);
+ harness.check(ui.getApproveButton(fc), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButton.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButton.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButton.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButton.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,59 @@
+// Tags: JDK1.2
+// Uses: MyBasicFileChooserUI
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getApproveButton() method in the
+ * {@link BasicFileChooserUI} class.
+ */
+public class getApproveButton 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();
+ fc.setDialogType(JFileChooser.OPEN_DIALOG);
+ MyBasicFileChooserUI ui = new MyBasicFileChooserUI(fc);
+ ui.installUI(fc);
+
+ // the method just returns a reference to the button, it doesn't create
+ // a new one each time the method is called...
+ JButton b1 = ui.getApproveButton(fc);
+ JButton b2 = ui.getApproveButton(fc);
+ harness.check(b1 == b2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonMnemonic.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonMnemonic.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonMnemonic.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonMnemonic.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,56 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getApproveButtonMnemonic() method in the
+ * {@link BasicFileChooserUI} 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 fc = new JFileChooser();
+ fc.setDialogType(JFileChooser.OPEN_DIALOG);
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ ui.installUI(fc);
+ harness.check(ui.getApproveButtonMnemonic(fc), 79);
+ fc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(ui.getApproveButtonMnemonic(fc), 83);
+ fc.setApproveButtonMnemonic(99);
+ harness.check(ui.getApproveButtonMnemonic(fc), 99);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonText.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonText.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonText.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,56 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getApproveButtonText() method in the
+ * {@link BasicFileChooserUI} 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 fc = new JFileChooser();
+ fc.setDialogType(JFileChooser.OPEN_DIALOG);
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ ui.installUI(fc);
+ harness.check(ui.getApproveButtonText(fc), "Open");
+ fc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(ui.getApproveButtonText(fc), "Save");
+ fc.setApproveButtonText("Hello World!");
+ harness.check(ui.getApproveButtonText(fc), "Hello World!");
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonToolTipText.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonToolTipText.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonToolTipText.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveButtonToolTipText.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,56 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getApproveButtonToolTipText() method in the
+ * {@link BasicFileChooserUI} 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 fc = new JFileChooser();
+ fc.setDialogType(JFileChooser.OPEN_DIALOG);
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ ui.installUI(fc);
+ harness.check(ui.getApproveButtonToolTipText(fc), "Open selected file");
+ fc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(ui.getApproveButtonToolTipText(fc), "Save selected file");
+ fc.setApproveButtonToolTipText("Hello World!");
+ harness.check(ui.getApproveButtonToolTipText(fc), "Hello World!");
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveSelectionAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveSelectionAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveSelectionAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getApproveSelectionAction.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getApproveSelectionAction.
+ */
+public class getApproveSelectionAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ Action a = ui.getApproveSelectionAction();
+ harness.check(a.getValue("Name"), "approveSelection");
+
+ Action a2 = ui.getApproveSelectionAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getCancelSelectionAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getCancelSelectionAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getCancelSelectionAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getCancelSelectionAction.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getCancelSelectionAction() method.
+ */
+public class getCancelSelectionAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ Action a = ui.getCancelSelectionAction();
+ harness.check(a.getValue("Name"), null);
+
+ Action a2 = ui.getCancelSelectionAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getChangeToParentDirectoryAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getChangeToParentDirectoryAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getChangeToParentDirectoryAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getChangeToParentDirectoryAction.java 13 Oct 2005 08:38:09 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getChangeToParentDirectoryAction() method.
+ */
+public class getChangeToParentDirectoryAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ Action a = ui.getChangeToParentDirectoryAction();
+ harness.check(a.getValue("Name"), "Go Up");
+
+ Action a2 = ui.getChangeToParentDirectoryAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDialogTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDialogTitle.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDialogTitle.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDialogTitle.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,69 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getDialogTitle() method.
+ */
+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 fc = new JFileChooser();
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ harness.check(ui.getDialogTitle(fc), null);
+ ui.installUI(fc);
+ harness.check(ui.getDialogTitle(fc), "Open");
+ fc.setDialogType(JFileChooser.SAVE_DIALOG);
+ harness.check(ui.getDialogTitle(fc), "Save");
+ fc.setDialogTitle("XYZ");
+ harness.check(ui.getDialogTitle(fc), "XYZ");
+ fc.setDialogTitle(null);
+ harness.check(ui.getDialogTitle(fc), "Save");
+
+ // try a null argument
+ boolean pass = false;
+ try
+ {
+ /*String t =*/ ui.getDialogTitle(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDirectoryName.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDirectoryName.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDirectoryName.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getDirectoryName.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,58 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getDirectoryName() method in the {@link BasicFileChooserUI}
+ * class.
+ */
+public class getDirectoryName 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();
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ harness.check(ui.getDirectoryName(), null);
+ ui.installUI(fc);
+ harness.check(ui.getDirectoryName(), null);
+ ui.setDirectoryName("XYZ");
+ harness.check(ui.getDirectoryName(), null);
+ fc.setCurrentDirectory(new File("ABC"));
+ harness.check(ui.getDirectoryName(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileName.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileName.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileName.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileName.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,58 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getFileName() method in the {@link BasicFileChooserUI}
+ * class.
+ */
+public class getFileName 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();
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ harness.check(ui.getFileName(), null);
+ ui.installUI(fc);
+ harness.check(ui.getFileName(), null);
+ ui.setFileName("XYZ");
+ harness.check(ui.getFileName(), null);
+ fc.setCurrentDirectory(new File("ABC"));
+ harness.check(ui.getFileName(), null);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileView.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileView.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileView.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getFileView.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,60 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.filechooser.FileView;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getFileView() method in the {@link BasicFileChooserUI}
+ * 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 fc = new JFileChooser();
+ BasicFileChooserUI ui = new BasicFileChooserUI(fc);
+ harness.check(ui.getFileView(fc) != null);
+ ui.installUI(fc);
+ FileView fv = ui.getFileView(fc);
+ harness.check(fv != null);
+
+ // the file chooser setting is ignored
+ FileView myFV = new FileView() {};
+ fc.setFileView(myFV);
+ harness.check(ui.getFileView(fc) != myFV);
+ harness.check(ui.getFileView(null) != null);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getGoHomeAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getGoHomeAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getGoHomeAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getGoHomeAction.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,55 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getGoHomeAction() method.
+ */
+public class getGoHomeAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ AbstractAction a = (AbstractAction) ui.getGoHomeAction();
+ harness.check(a.getValue("Name"), "Go Home");
+ Object[] keys = a.getKeys();
+ harness.check(keys.length, 1);
+ Action a2 = ui.getGoHomeAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getNewFolderAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getNewFolderAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getNewFolderAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getNewFolderAction.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getNewFolderAction() method.
+ */
+public class getNewFolderAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ Action a = ui.getNewFolderAction();
+ harness.check(a.getValue("Name"), "New Folder");
+
+ Action a2 = ui.getNewFolderAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getUpdateAction.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getUpdateAction.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getUpdateAction.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/getUpdateAction.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the getUpdateAction() method.
+ */
+public class getUpdateAction implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ BasicFileChooserUI ui = new BasicFileChooserUI(new JFileChooser());
+ Action a = ui.getUpdateAction();
+ harness.check(a.getValue("Name"), null);
+
+ Action a2 = ui.getUpdateAction();
+ harness.check(a == a2);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installIcons.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installIcons.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installIcons.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installIcons.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,77 @@
+// Tags: JDK1.2
+// Uses: MyBasicFileChooserUI
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+/**
+ * Some checks for the installIcons() method in the
+ * {@link BasicFileChooserUI} class.
+ */
+public class installIcons 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();
+ MyBasicFileChooserUI ui = new MyBasicFileChooserUI(fc);
+ harness.check(ui.getComputerIcon(), null);
+ harness.check(ui.getDetailsViewIcon(), null);
+ harness.check(ui.getDirectoryIcon(), null);
+ harness.check(ui.getFileIcon(), null);
+ harness.check(ui.getFloppyDriveIcon(), null);
+ harness.check(ui.getHardDriveIcon(), null);
+ harness.check(ui.getHomeFolderIcon(), null);
+ harness.check(ui.getListViewIcon(), null);
+ harness.check(ui.getNewFolderIcon(), null);
+ harness.check(ui.getUpFolderIcon(), null);
+
+ ui.installIcons(fc);
+ harness.check(ui.getComputerIcon(), MetalIconFactory.getTreeComputerIcon());
+ harness.check(ui.getDetailsViewIcon(), MetalIconFactory.getFileChooserDetailViewIcon());
+ harness.check(ui.getDirectoryIcon() instanceof MetalIconFactory.TreeFolderIcon);
+ harness.check(ui.getDirectoryIcon().getIconWidth(), 16);
+ harness.check(ui.getDirectoryIcon().getIconHeight(), 18);
+ harness.check(ui.getFileIcon() instanceof MetalIconFactory.TreeLeafIcon);
+ harness.check(ui.getFileIcon().getIconWidth(), 16);
+ harness.check(ui.getFileIcon().getIconHeight(), 20);
+ harness.check(ui.getFloppyDriveIcon(), MetalIconFactory.getTreeFloppyDriveIcon());
+ harness.check(ui.getHardDriveIcon(), MetalIconFactory.getTreeHardDriveIcon());
+ harness.check(ui.getHomeFolderIcon(), MetalIconFactory.getFileChooserHomeFolderIcon());
+ harness.check(ui.getListViewIcon(), MetalIconFactory.getFileChooserListViewIcon());
+ harness.check(ui.getNewFolderIcon(), MetalIconFactory.getFileChooserNewFolderIcon());
+ harness.check(ui.getUpFolderIcon(), MetalIconFactory.getFileChooserUpFolderIcon());
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installStrings.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installStrings.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installStrings.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/installStrings.java 13 Oct 2005 08:38:10 -0000
@@ -0,0 +1,115 @@
+// Tags: JDK1.2
+// Uses: MyBasicFileChooserUI
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Locale;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the installStrings() method in the
+ * {@link BasicFileChooserUI} class.
+ */
+public class installStrings implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Locale.setDefault(Locale.UK);
+ JFileChooser fc1 = new JFileChooser();
+ MyBasicFileChooserUI ui = new MyBasicFileChooserUI(fc1);
+ harness.check(ui.getCancelButtonText(), null);
+ harness.check(ui.getCancelButtonToolTipText(), null);
+ harness.check(ui.getCancelButtonMnemonic(), 0);
+ harness.check(ui.getDirectoryOpenButtonText(), null);
+ harness.check(ui.getDirectoryOpenButtonToolTipText(), null);
+ harness.check(ui.getDirectoryOpenButtonMnemonic(), 0);
+ harness.check(ui.getHelpButtonText(), null);
+ harness.check(ui.getHelpButtonToolTipText(), null);
+ harness.check(ui.getHelpButtonMnemonic(), 0);
+ harness.check(ui.getOpenButtonText(), null);
+ harness.check(ui.getOpenButtonToolTipText(), null);
+ harness.check(ui.getOpenButtonMnemonic(), 0);
+ harness.check(ui.getSaveButtonText(), null);
+ harness.check(ui.getSaveButtonToolTipText(), null);
+ harness.check(ui.getSaveButtonMnemonic(), 0);
+ harness.check(ui.getUpdateButtonText(), null);
+ harness.check(ui.getUpdateButtonToolTipText(), null);
+ harness.check(ui.getUpdateButtonMnemonic(), 0);
+
+ ui.installStrings(fc1);
+ harness.check(ui.getCancelButtonText(), "Cancel");
+ harness.check(ui.getCancelButtonToolTipText(), "Abort file chooser dialog");
+ harness.check(ui.getCancelButtonMnemonic(), 67);
+ harness.check(ui.getDirectoryOpenButtonText(), "Open");
+ harness.check(ui.getDirectoryOpenButtonToolTipText(), "Open selected directory");
+ harness.check(ui.getDirectoryOpenButtonMnemonic(), 79);
+ harness.check(ui.getHelpButtonText(), "Help");
+ harness.check(ui.getHelpButtonToolTipText(), "FileChooser help");
+ harness.check(ui.getHelpButtonMnemonic(), 72);
+ harness.check(ui.getOpenButtonText(), "Open");
+ harness.check(ui.getOpenButtonToolTipText(), "Open selected file");
+ harness.check(ui.getOpenButtonMnemonic(), 79);
+ harness.check(ui.getSaveButtonText(), "Save");
+ harness.check(ui.getSaveButtonToolTipText(), "Save selected file");
+ harness.check(ui.getSaveButtonMnemonic(), 83);
+ harness.check(ui.getUpdateButtonText(), "Update");
+ harness.check(ui.getUpdateButtonToolTipText(), "Update directory listing");
+ harness.check(ui.getUpdateButtonMnemonic(), 85);
+
+ // it appears that the default strings in the Basic look and feel are
+ // not localised...
+ Locale.setDefault(Locale.FRANCE);
+ JFileChooser fc2 = new JFileChooser();
+ MyBasicFileChooserUI ui2 = new MyBasicFileChooserUI(fc2);
+ ui2.installStrings(fc2);
+ harness.check(ui2.getCancelButtonText(), "Cancel");
+ harness.check(ui2.getCancelButtonToolTipText(), "Abort file chooser dialog");
+ harness.check(ui2.getDirectoryOpenButtonText(), "Open");
+ harness.check(ui2.getDirectoryOpenButtonToolTipText(), "Open selected directory");
+ harness.check(ui2.getDirectoryOpenButtonMnemonic(), 79);
+ harness.check(ui2.getHelpButtonText(), "Help");
+ harness.check(ui2.getHelpButtonToolTipText(), "FileChooser help");
+ harness.check(ui2.getHelpButtonMnemonic(), 72);
+ harness.check(ui2.getOpenButtonText(), "Open");
+ harness.check(ui2.getOpenButtonToolTipText(), "Open selected file");
+ harness.check(ui2.getOpenButtonMnemonic(), 79);
+ harness.check(ui2.getSaveButtonText(), "Save");
+ harness.check(ui2.getSaveButtonToolTipText(), "Save selected file");
+ harness.check(ui2.getSaveButtonMnemonic(), 83);
+ harness.check(ui2.getUpdateButtonText(), "Update");
+ harness.check(ui2.getUpdateButtonToolTipText(), "Update directory listing");
+ harness.check(ui2.getUpdateButtonMnemonic(), 85);
+ }
+
+}
Index: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/uninstallStrings.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/uninstallStrings.java
diff -N gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/uninstallStrings.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/basic/BasicFileChooserUI/uninstallStrings.java 13 Oct 2005 08:38:11 -0000
@@ -0,0 +1,93 @@
+// Tags: JDK1.2
+// Uses: MyBasicFileChooserUI
+
+// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+
+// This file is part of Mauve.
+
+// Mauve is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+// Boston, MA 02110-1301 USA.
+
+
+package gnu.testlet.javax.swing.plaf.basic.BasicFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.Locale;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.basic.BasicFileChooserUI;
+
+/**
+ * Some checks for the uninstallStrings() method in the
+ * {@link BasicFileChooserUI} class.
+ */
+public class uninstallStrings implements Testlet
+{
+
+ /**
+ * Runs the test using the specified harness.
+ *
+ * @param harness the test harness (<code>null</code> not permitted).
+ */
+ public void test(TestHarness harness)
+ {
+ Locale.setDefault(Locale.UK);
+ JFileChooser fc1 = new JFileChooser();
+ MyBasicFileChooserUI ui = new MyBasicFileChooserUI(fc1);
+
+ ui.installStrings(fc1);
+ harness.check(ui.getCancelButtonText(), "Cancel");
+ harness.check(ui.getCancelButtonToolTipText(), "Abort file chooser dialog");
+ harness.check(ui.getCancelButtonMnemonic(), 67);
+ harness.check(ui.getDirectoryOpenButtonText(), "Open");
+ harness.check(ui.getDirectoryOpenButtonToolTipText(), "Open selected directory");
+ harness.check(ui.getDirectoryOpenButtonMnemonic(), 79);
+ harness.check(ui.getHelpButtonText(), "Help");
+ harness.check(ui.getHelpButtonToolTipText(), "FileChooser help");
+ harness.check(ui.getHelpButtonMnemonic(), 72);
+ harness.check(ui.getOpenButtonText(), "Open");
+ harness.check(ui.getOpenButtonToolTipText(), "Open selected file");
+ harness.check(ui.getOpenButtonMnemonic(), 79);
+ harness.check(ui.getSaveButtonText(), "Save");
+ harness.check(ui.getSaveButtonToolTipText(), "Save selected file");
+ harness.check(ui.getSaveButtonMnemonic(), 83);
+ harness.check(ui.getUpdateButtonText(), "Update");
+ harness.check(ui.getUpdateButtonToolTipText(), "Update directory listing");
+ harness.check(ui.getUpdateButtonMnemonic(), 85);
+
+ ui.uninstallStrings(fc1);
+ harness.check(ui.getCancelButtonText(), null);
+ harness.check(ui.getCancelButtonToolTipText(), null);
+ harness.check(ui.getCancelButtonMnemonic(), 67);
+ harness.check(ui.getDirectoryOpenButtonText(), null);
+ harness.check(ui.getDirectoryOpenButtonToolTipText(), null);
+ harness.check(ui.getDirectoryOpenButtonMnemonic(), 79);
+ harness.check(ui.getHelpButtonText(), null);
+ harness.check(ui.getHelpButtonToolTipText(), null);
+ harness.check(ui.getHelpButtonMnemonic(), 72);
+ harness.check(ui.getOpenButtonText(), null);
+ harness.check(ui.getOpenButtonToolTipText(), null);
+ harness.check(ui.getOpenButtonMnemonic(), 79);
+ harness.check(ui.getSaveButtonText(), null);
+ harness.check(ui.getSaveButtonToolTipText(), null);
+ harness.check(ui.getSaveButtonMnemonic(), 83);
+ harness.check(ui.getUpdateButtonText(), null);
+ harness.check(ui.getUpdateButtonToolTipText(), null);
+ harness.check(ui.getUpdateButtonMnemonic(), 85);
+ }
+
+}