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


Some tests for the BasicComboBoxUI class are setting a look-and-feel that interferes with subsequent tests. This patch (committed) sets the look-and-feel to MetalLookAndFeel at the end of each test method:

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

* gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createArrowButton.java
(test): Set MetalLookAndFeel at end of test,
* gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createRenderer.java
(test): Likewise,
* gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/getDisplaySize.java
(testNotEditable): Likewise,
(testEditable): Likewise,
* gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/layout.java
(test): Likewise.


Regards,

Dave
? diff.txt
Index: gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createArrowButton.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createArrowButton.java,v
retrieving revision 1.2
diff -u -r1.2 createArrowButton.java
--- gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createArrowButton.java	7 Nov 2005 21:35:03 -0000	1.2
+++ gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createArrowButton.java	31 Jan 2006 17:06:19 -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.
 
@@ -32,6 +32,7 @@
 import javax.swing.plaf.BorderUIResource.CompoundBorderUIResource;
 import javax.swing.plaf.basic.BasicArrowButton;
 import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the createArrowButton() method in the 
@@ -66,6 +67,16 @@
     harness.check(insets, new Insets(4, 17, 5, 17));
     Insets margin = b.getMargin();
     harness.check(margin, new Insets(2, 14, 2, 14));
+    
+    // restore a sane look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
   }
 
 }
Index: gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createRenderer.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createRenderer.java,v
retrieving revision 1.1
diff -u -r1.1 createRenderer.java
--- gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createRenderer.java	18 Oct 2005 21:31:52 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/createRenderer.java	31 Jan 2006 17:06:19 -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.
 
@@ -32,6 +32,7 @@
 import javax.swing.ListCellRenderer;
 import javax.swing.UIManager;
 import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the createRenderer() method in the 
@@ -86,6 +87,15 @@
     ListCellRenderer renderer4 = cb.getRenderer();
     harness.check(renderer3 == renderer4);
     
+    // restore a sane look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
   }
 
 }
Index: gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/getDisplaySize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/getDisplaySize.java,v
retrieving revision 1.1
diff -u -r1.1 getDisplaySize.java
--- gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/getDisplaySize.java	7 Nov 2005 21:35:04 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/getDisplaySize.java	31 Jan 2006 17:06:19 -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.
 
@@ -33,6 +33,7 @@
 import javax.swing.UIManager;
 import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getDisplaySize() method in the 
@@ -92,6 +93,17 @@
     cb.setPrototypeDisplayValue("Prototype");
     width = fm.stringWidth("Prototype") + additionalWidth;
     harness.check(ui.getDisplaySize(), new Dimension(width, height));
+    
+    // restore MetalLookAndFeel
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (UnsupportedLookAndFeelException e)
+    {
+      e.printStackTrace();
+    }
+
   }
 
   /**
@@ -138,6 +150,17 @@
     cb.setPrototypeDisplayValue("Long Prototype Display Value");
     width = fm.stringWidth("Long Prototype Display Value") + 2;
     harness.check(ui.getDisplaySize(), new Dimension(width, height));
+
+    // restore a sane look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (UnsupportedLookAndFeelException e)
+    {
+      e.printStackTrace();
+    }
+    
   }
 
 }
Index: gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/layout.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/layout.java,v
retrieving revision 1.1
diff -u -r1.1 layout.java
--- gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/layout.java	7 Nov 2005 21:35:04 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/basic/BasicComboBoxUI/layout.java	31 Jan 2006 17:06:19 -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.
 
@@ -35,6 +35,7 @@
 import javax.swing.JTextField;
 import javax.swing.UIManager;
 import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the layout in the {@link BasicComboBoxUI} class.  
@@ -70,6 +71,15 @@
     int height = fm.getHeight() + 2;
     int width = fm.stringWidth("m") * tf.getColumns() + 1; 
     harness.check(tf.getBounds(), new Rectangle(0, 0, width, height));
+    // restore a sane look and feel
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
   }
 
 }

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