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: AbstractButton.setRolloverEnabled()


This patch (committed) sets a known theme for the look-and-feel at the start of the test, to ensure that the expected results are actually obtained (the test was broken when running with the OceanTheme installed):

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

   * gnu/testlet/javax/swing/AbstractButton.java
   (test): Set the look and feel theme to DefaultMetalTheme.

Regards,

Dave
Index: gnu/testlet/javax/swing/AbstractButton/setRolloverEnabled.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/AbstractButton/setRolloverEnabled.java,v
retrieving revision 1.1
diff -u -r1.1 setRolloverEnabled.java
--- gnu/testlet/javax/swing/AbstractButton/setRolloverEnabled.java	2 Oct 2005 04:56:35 -0000	1.1
+++ gnu/testlet/javax/swing/AbstractButton/setRolloverEnabled.java	31 Jan 2006 14:55:22 -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
@@ -27,6 +27,10 @@
 
 import javax.swing.AbstractButton;
 import javax.swing.JButton;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the setRolloverEnabled() method in the 
@@ -48,8 +52,19 @@
    * @param harness  the test harness (<code>null</code> not permitted).
    */
   public void test(TestHarness harness)      
-  {   
+  { 
+    // this test is theme-dependent
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e) 
+      {
+        // ignore 
+      }
     AbstractButton b = new JButton("Test");
+    harness.check(b.isRolloverEnabled(), false);
     b.addPropertyChangeListener(this);    
     b.setRolloverEnabled(true);
     harness.check(b.isRolloverEnabled(), true);

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