public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: MetalRadioButtonUI test fixes
@ 2006-01-31 16:46 David Gilbert
  0 siblings, 0 replies; only message in thread
From: David Gilbert @ 2006-01-31 16:46 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 652 bytes --]

The expected results in the tests for the MetalRadioButtonUI class 
assumed the MetalLookAndFeel/DefaultMetalTheme is installed.  This patch 
(committed) explicitly sets the laf/theme, because sometimes this isn't 
the default:

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

    * 
gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getDisabledTextColor.java
    (test): Set known theme in MetalLookAndFeel,
    * 
gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getFocusColor.java:
    (test): Likewise,
    * 
gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getSelectColor.java:
    (test): Likewise.

Regards,

Dave

[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 4237 bytes --]

Index: gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getDisabledTextColor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getDisabledTextColor.java,v
retrieving revision 1.1
diff -u -r1.1 getDisabledTextColor.java
--- gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getDisabledTextColor.java	6 Sep 2005 20:43:10 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getDisabledTextColor.java	31 Jan 2006 16:38:38 -0000
@@ -25,7 +25,11 @@
 import gnu.testlet.Testlet;
 
 import javax.swing.JRadioButton;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getDisabledTextColor() method.
@@ -40,6 +44,16 @@
    */
   public void test(TestHarness harness) 
   {
+    // test with a known theme
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e)
+      {
+        e.printStackTrace();   
+      }
     // a new instance has no select color yet
     MyMetalRadioButtonUI ui = new MyMetalRadioButtonUI();
     harness.check(ui.getDisabledTextColor(), null);
Index: gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getFocusColor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getFocusColor.java,v
retrieving revision 1.1
diff -u -r1.1 getFocusColor.java
--- gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getFocusColor.java	6 Sep 2005 20:43:10 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getFocusColor.java	31 Jan 2006 16:38:38 -0000
@@ -26,7 +26,11 @@
 import gnu.testlet.Testlet;
 
 import javax.swing.JRadioButton;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getFocusColor() method.
@@ -41,6 +45,17 @@
    */
   public void test(TestHarness harness) 
   {
+    // test with a known theme
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e)
+      {
+        e.printStackTrace();   
+      }
+    
     // a new instance has no select color yet
     MyMetalRadioButtonUI ui = new MyMetalRadioButtonUI();
     harness.check(ui.getFocusColor(), null);
Index: gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getSelectColor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getSelectColor.java,v
retrieving revision 1.1
diff -u -r1.1 getSelectColor.java
--- gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getSelectColor.java	6 Sep 2005 20:43:10 -0000	1.1
+++ gnu/testlet/javax/swing/plaf/metal/MetalRadioButtonUI/getSelectColor.java	31 Jan 2006 16:38:38 -0000
@@ -26,7 +26,11 @@
 import gnu.testlet.Testlet;
 
 import javax.swing.JRadioButton;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
 import javax.swing.plaf.ColorUIResource;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Some checks for the getSelectColor() method.
@@ -41,6 +45,17 @@
    */
   public void test(TestHarness harness) 
   {
+    // test with a known theme
+    try
+      {
+        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+        UIManager.setLookAndFeel(new MetalLookAndFeel());
+      }
+    catch (UnsupportedLookAndFeelException e)
+      {
+        e.printStackTrace();   
+      }
+
     // a new instance has no select color yet
     MyMetalRadioButtonUI ui = new MyMetalRadioButtonUI();
     harness.check(ui.getSelectColor(), null);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-01-31 16:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31 16:46 FYI: MetalRadioButtonUI test fixes David Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).