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: JLabel constructor


I added some checks to the test for the JLabel constructor:

2005-10-18 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/javax/swing/JLabel/constructor.java
   (test): set MetalLookAndFeel and check default colors.

Regards,

Dave
Index: gnu/testlet/javax/swing/JLabel/constructor.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JLabel/constructor.java,v
retrieving revision 1.1
diff -u -r1.1 constructor.java
--- gnu/testlet/javax/swing/JLabel/constructor.java	6 Oct 2005 19:35:11 -0000	1.1
+++ gnu/testlet/javax/swing/JLabel/constructor.java	18 Oct 2005 20:53:37 -0000
@@ -21,10 +21,16 @@
 
 package gnu.testlet.javax.swing.JLabel;
 
-import gnu.testlet.Testlet;
 import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+import java.awt.Font;
+
 import javax.swing.JLabel;
 import javax.swing.SwingConstants;
+import javax.swing.UIManager;
+import javax.swing.plaf.metal.MetalLookAndFeel;
 
 /**
  * Tests if the constructor sets the default values for the JLabel's properties
@@ -36,7 +42,24 @@
 {
   public void test(TestHarness harness)
   {
+    try
+    {
+      UIManager.setLookAndFeel(new MetalLookAndFeel());
+    }
+    catch (Exception e)
+    {
+      e.printStackTrace();
+    }
+    
+    // use this to check that the defaults are those for a Label
+    UIManager.put("Label.font", new Font("Dialog", Font.PLAIN, 21));
+    UIManager.put("Label.foreground", Color.green);
+    UIManager.put("Label.background", Color.yellow);
+    
     JLabel l = new JLabel();
+    harness.check(l.getFont(), new Font("Dialog", Font.PLAIN, 21));
+    harness.check(l.getForeground(), Color.green);
+    harness.check(l.getBackground(), Color.yellow);
     harness.check(l.getAlignmentX(), 0.0F, "alignmentX");
     harness.check(l.getAlignmentY(), 0.5F, "alignmentY");
     harness.check(l.getHorizontalAlignment(), SwingConstants.LEADING,

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