This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: MetalRadioButtonUI test fixes
- From: David Gilbert <david dot gilbert at object-refinery dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Tue, 31 Jan 2006 16:45:51 +0000
- Subject: FYI: MetalRadioButtonUI test fixes
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
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);