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 test fixes


This patch tidies up some of the tests for the MetalFileChooserUI class which were failing when running on JDK 1.5:

2006-02-01 David Gilbert <david.gilbert@object-refinery.com>

* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getActionMap.java:
Removed,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java
(test): Set theme and removed fixed size test,
* gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getActionMap.java
(test): Likewise.


Regards,

Dave
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
--- gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/createActionMap.java	6 Dec 2005 14:04:24 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,60 +0,0 @@
-// 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/getMinimumSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java,v
retrieving revision 1.1
diff -u -r1.1 getMinimumSize.java
--- gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java	6 Dec 2005 14:04:24 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getMinimumSize.java	1 Feb 2006 13:48:20 -0000
@@ -27,7 +27,11 @@
 import gnu.testlet.Testlet;
 
 import javax.swing.JFileChooser;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.metal.DefaultMetalTheme;
 import javax.swing.plaf.metal.MetalFileChooserUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getMinimumSize() method in the 
@@ -43,13 +47,21 @@
    */
   public void test(TestHarness harness)  
   {
+    // test with DefaultMetalTheme
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e)
+      {
+        e.printStackTrace();  
+      }
     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 d1 = ui.getPreferredSize(fc);
     Dimension d2 = ui.getPreferredSize(fc);
     harness.check(d1 != d2);
     
Index: gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java,v
retrieving revision 1.1
diff -u -r1.1 getPreferredSize.java
--- gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java	6 Dec 2005 14:04:24 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/metal/MetalFileChooserUI/getPreferredSize.java	1 Feb 2006 13:48:20 -0000
@@ -1,6 +1,6 @@
 // Tags: JDK1.2
 
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 David Gilbert <david.gilbert@object-refinery.com>
 
 // This file is part of Mauve.
 
@@ -27,7 +27,11 @@
 import java.awt.Dimension;
 
 import javax.swing.JFileChooser;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.metal.DefaultMetalTheme;
 import javax.swing.plaf.metal.MetalFileChooserUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getPreferredSize() method in the 
@@ -43,9 +47,19 @@
    */
   public void test(TestHarness harness)  
   {
+    // test with DefaultMetalTheme
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e)
+      {
+        e.printStackTrace();  
+      }
     JFileChooser fc = new JFileChooser();
     MetalFileChooserUI ui = new MetalFileChooserUI(fc);
-    Dimension expected = new Dimension(506, 326);
+    Dimension expected = ui.getMinimumSize(fc);
     Dimension d1 = ui.getPreferredSize(fc);
     harness.check(d1, expected);
     

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