This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI: MetalFileChooserUI tests


I committed these tests for the MetalFileChooserUI class:

2005-12-06 David Gilbert <david.gilbert@object-refinery.com>

* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createFilterComboBoxModel.java:


New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getApproveButton.java:


New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getBottomPanel.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getButtonPanel.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getFileName.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMaximumSize.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java:
New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java:


New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/MyMetalFileChooserUI.java:


New file,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/setFileName.java:
New file.


Regards,

Dave
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/MyMetalFileChooserUI.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/MyMetalFileChooserUI.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/MyMetalFileChooserUI.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/MyMetalFileChooserUI.java	6 Dec 2005 13:56:00 -0000
@@ -0,0 +1,75 @@
+// 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.metal.MetalFileChooserUI;
+
+import javax.swing.ActionMap;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+public class MyMetalFileChooserUI extends MetalFileChooserUI 
+{
+  public class MyFilterComboBoxModel extends FilterComboBoxModel
+  {
+    public MyFilterComboBoxModel()
+    {
+      
+    }
+  }
+
+  public MyMetalFileChooserUI(JFileChooser fc) 
+  {
+    super(fc);
+  }
+  
+  /**
+   * Provides access to this protected method in the super class.
+   */
+  public JPanel getButtonPanel()
+  {
+    return super.getButtonPanel();
+  }
+  
+  /**
+   * Provides access to this protected method in the super class.
+   */
+  public JPanel getBottomPanel()
+  {
+    return super.getBottomPanel();
+  }
+  
+  public ActionMap createActionMap()
+  {
+    return super.createActionMap();
+  }
+  
+  public FilterComboBoxModel createFilterComboBoxModel() 
+  {
+    return super.createFilterComboBoxModel();
+  }
+  
+  public JButton getApproveButton(JFileChooser fc)
+  {
+    return super.getApproveButton(fc);
+  }
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.Action;
+import javax.swing.ActionMap;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the createActionMap() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class createActionMap 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();
+    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(fc);
+
+    ActionMap map = ui.createActionMap();
+    harness.check(map.getParent(), null);
+    harness.check(map.size(), 3);
+    Action a1 = map.get("approveSelection");
+    harness.check(a1.equals(ui.getApproveSelectionAction()));
+    Action a2 = map.get("cancelSelection");
+    harness.check(!a2.equals(ui.getCancelSelectionAction()));
+    Action a3 = map.get("Go Up");
+    harness.check(a3.equals(ui.getChangeToParentDirectoryAction()));
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createFilterComboBoxModel.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createFilterComboBoxModel.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createFilterComboBoxModel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createFilterComboBoxModel.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+import gnu.testlet.javax.swing.JFileChooser.MyFileChooser;
+
+import javax.swing.ComboBoxModel;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the createActionMap() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class createFilterComboBoxModel implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)  
+  {
+    MyFileChooser fc = new MyFileChooser();
+    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(fc);
+    fc.setUI(ui);
+    ComboBoxModel m = ui.createFilterComboBoxModel();
+    harness.check(m.getSize(), 1);
+    harness.check(m.getElementAt(0), fc.getFileFilter());
+    
+    ComboBoxModel m2 = ui.createFilterComboBoxModel();
+    harness.check(m != m2);
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getApproveButton.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getApproveButton.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getApproveButton.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getApproveButton.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getApproveButton() method in the 
+ * {@link MetalFileChooserUI} 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);
+    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(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/metal/MetalFileChooserUI/getBottomPanel.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getBottomPanel.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getBottomPanel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getBottomPanel.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getBottomPanel() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class getBottomPanel 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();
+    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(fc);
+
+    // some 'get' methods actually create a new instance every time, but not
+    // this one...
+    JPanel p1 = ui.getBottomPanel();
+    JPanel p2 = ui.getBottomPanel();
+    harness.check(p1 == p2);
+    
+    ui.installUI(fc);
+    p2 = ui.getBottomPanel();
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getButtonPanel.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getButtonPanel.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getButtonPanel.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getButtonPanel.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.JPanel;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getButtonPanel() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class getButtonPanel 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();
+    MyMetalFileChooserUI ui = new MyMetalFileChooserUI(fc);
+
+    // some 'get' methods actually create a new instance every time, but not
+    // this one...
+    JPanel p1 = ui.getButtonPanel();
+    JPanel p2 = ui.getButtonPanel();
+    harness.check(p1 == p2);
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getFileName.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getFileName.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getFileName.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getFileName.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getFileName() method in the {@link MetalFileChooserUI}
+ * 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();
+    MetalFileChooserUI ui = new MetalFileChooserUI(fc);
+    harness.check(ui.getFileName(), null);
+    ui.installUI(fc);
+    harness.check(ui.getFileName(), "");
+    ui.setFileName("XYZ");
+    harness.check(ui.getFileName(), "XYZ");
+    fc.setCurrentDirectory(new File("ABC"));
+    harness.check(ui.getFileName(), "XYZ");
+  }
+  
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMaximumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMaximumSize.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMaximumSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMaximumSize.java	6 Dec 2005 13:56:00 -0000
@@ -0,0 +1,61 @@
+// 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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getMaximumSize() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class getMaximumSize 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();
+    MetalFileChooserUI ui = new MetalFileChooserUI(fc);
+    Dimension expected = new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE);
+    Dimension d1 = ui.getMaximumSize(fc);
+    harness.check(d1, expected);
+    
+    // check that the method returns a new instance every time?
+    Dimension d2 = ui.getMaximumSize(fc);
+    harness.check(d1 != d2);
+    
+    // does the method look at the filechooser passed in?
+    Dimension d3 = ui.getMaximumSize(null);
+    harness.check(d3, expected);
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import java.awt.Dimension;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getMinimumSize() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class getMinimumSize 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();
+    MetalFileChooserUI ui = new MetalFileChooserUI(fc);
+    Dimension expected = new Dimension(506, 326);
+    Dimension d1 = ui.getPreferredSize(fc);
+    harness.check(d1, expected);
+    
+    // check that the method returns a new instance every time?
+    Dimension d2 = ui.getPreferredSize(fc);
+    harness.check(d1 != d2);
+    
+    // does the method look at the filechooser passed in?
+    boolean pass = false;
+    try
+    {
+      /*Dimension d3 =*/ ui.getPreferredSize(null);    
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Dimension;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the getPreferredSize() method in the 
+ * {@link MetalFileChooserUI} class.  
+ */
+public class getPreferredSize 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();
+    MetalFileChooserUI ui = new MetalFileChooserUI(fc);
+    Dimension expected = new Dimension(506, 326);
+    Dimension d1 = ui.getPreferredSize(fc);
+    harness.check(d1, expected);
+    
+    // check that the method returns a new instance every time?
+    Dimension d2 = ui.getPreferredSize(fc);
+    harness.check(d1 != d2);
+    
+    // does the method look at the filechooser passed in?
+    boolean pass = false;
+    try
+    {
+      /*Dimension d3 =*/ ui.getPreferredSize(null);    
+    }
+    catch (NullPointerException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/setFileName.java
===================================================================
RCS file: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/setFileName.java
diff -N gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/setFileName.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/setFileName.java	6 Dec 2005 13:56:00 -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.metal.MetalFileChooserUI;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JFileChooser;
+import javax.swing.plaf.metal.MetalFileChooserUI;
+
+/**
+ * Some checks for the setFileName() method in the {@link MetalFileChooserUI}
+ * class.
+ */
+public class setFileName 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();
+    MetalFileChooserUI ui = new MetalFileChooserUI(fc);
+    harness.check(ui.getFileName(), null);
+    ui.installUI(fc);
+    harness.check(ui.getFileName(), "");
+    ui.setFileName("XYZ");
+    harness.check(ui.getFileName(), "XYZ");
+    ui.setFileName(null);
+    harness.check(ui.getFileName(), "");
+  }
+  
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]