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: JComboBox.setEditor() test fix


This patch (committed) restores the MetalLookAndFeel as the installed LAF at the end of the test - this is a sane default for subsequent tests and fixes a problem I am seeing running the test suite against Sun's reference implementation:

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

   * gnu/testlet/javax/swing/JComboBox/setEditor.java
   (test): Restore MetalLookAndFeel at the end of the test.

Regards,

Dave

Index: gnu/testlet/javax/swing/JComboBox/setEditor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JComboBox/setEditor.java,v
retrieving revision 1.2
diff -u -r1.2 setEditor.java
--- gnu/testlet/javax/swing/JComboBox/setEditor.java	21 Oct 2005 09:08:16 -0000	1.2
+++ gnu/testlet/javax/swing/JComboBox/setEditor.java	31 Jan 2006 16:49:56 -0000
@@ -1,6 +1,6 @@
 // Tags: JDK1.4
 
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006 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
@@ -32,6 +32,7 @@
 import javax.swing.UIManager;
 import javax.swing.plaf.basic.BasicComboBoxEditor;
 import javax.swing.plaf.metal.MetalComboBoxEditor;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the setEditor() method in the {@link JComponent} class.
@@ -50,7 +51,7 @@
     // use a known look and feel
     try
       {
-        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
       }
     catch (Exception e)
       {
@@ -81,6 +82,16 @@
     harness.check(c1.getEditor(), editor);
     harness.check(c2.getEditor() instanceof BasicComboBoxEditor.UIResource);
     
+    // restore MetalLookAndFeel so as not to interfere with other tests
+    try
+      {
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (Exception e)
+      {
+        harness.fail("Problem restoring MetalLookAndFeel");
+      }
+    
     // try a null setting - no exceptions are thrown
     c1.setEditor(null);
     harness.check(c1.getEditor(), null);

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