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: javax.swing.border.TitledBorder new tests


I committed these new tests for the javax.swing.border.TitledBorder class:

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

* gnu/testlet/javax/swing/border/TitledBorder/constructors.java: New test,
* gnu/testlet/javax/swing/border/TitledBorder/getBorder.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getBorderInsets.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getTitle.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getTitleColor.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getTitleFont.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getTitleJustification.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/getTitlePosition.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/isBorderOpaque.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setBorder.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setTitle.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setTitleColor.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setTitleFont.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setTitleJustification.java: Likewise,
* gnu/testlet/javax/swing/border/TitledBorder/setTitlePosition.java: Likewise.


Some of these tests fail at present with GNU Classpath - in a moment I will commit a patch to GNU Classpath that fixes the failing tests.

Regards,

Dave Gilbert
Index: gnu/testlet/javax/swing/border/TitledBorder/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/constructors.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/constructors.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,198 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+import java.awt.Font;
+
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the constructors of the {@link TitledBorder} 
+ * class.
+ */
+public class constructors implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    test1(harness);
+    test2(harness);
+    test3(harness);
+    test4(harness);
+    test5(harness);
+    test6(harness);
+  }
+  
+  public void test1(TestHarness harness)       
+  {
+    harness.checkPoint("(Border)");
+    Border b = new EmptyBorder(1, 2, 3, 4);
+    TitledBorder tb = new TitledBorder(b);
+    harness.check(tb.getBorder(), b);
+    harness.check(tb.getTitle(), "");
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(tb.getTitleColor(), c);
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.TOP);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEADING);
+    
+    tb = new TitledBorder((Border) null);
+    Border bb = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), bb);
+  }
+
+  public void test2(TestHarness harness)       
+  {
+    harness.checkPoint("(Border, String)");
+    Border b = new EmptyBorder(1, 2, 3, 4);
+    TitledBorder tb = new TitledBorder(b, "XYZ");
+    harness.check(tb.getBorder(), b);
+    harness.check(tb.getTitle(), "XYZ");
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(tb.getTitleColor(), c);
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.TOP);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEADING);
+    
+    tb = new TitledBorder((Border) null, "XYZ");
+    Border bb = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), bb);
+    
+    tb = new TitledBorder(new EmptyBorder(1, 2, 3, 4), null);
+    harness.check(tb.getTitle(), null);
+  }
+
+  public void test3(TestHarness harness)       
+  {
+    harness.checkPoint("(Border, String, int, int)");
+    Border b = new EmptyBorder(1, 2, 3, 4);
+    TitledBorder tb = new TitledBorder(b, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM);
+    harness.check(tb.getBorder(), b);
+    harness.check(tb.getTitle(), "XYZ");
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(tb.getTitleColor(), c);
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.BELOW_BOTTOM);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEFT);
+    
+    tb = new TitledBorder((Border) null, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM);
+    Border bb = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), bb);
+    
+    tb = new TitledBorder(new EmptyBorder(1, 2, 3, 4), null, TitledBorder.LEFT,
+            TitledBorder.BELOW_BOTTOM);
+    harness.check(tb.getTitle(), null);
+  }
+
+  public void test4(TestHarness harness)       
+  {
+    harness.checkPoint("(Border, String, int, int, Font)");
+    Border b = new EmptyBorder(1, 2, 3, 4);
+    Font f = new Font("Dialog", Font.BOLD, 16);
+    TitledBorder tb = new TitledBorder(b, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM, f);
+    harness.check(tb.getBorder(), b);
+    harness.check(tb.getTitle(), "XYZ");
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(tb.getTitleColor(), c);
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.BELOW_BOTTOM);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEFT);
+    
+    tb = new TitledBorder((Border) null, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM, f);
+    Border bb = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), bb);
+    
+    tb = new TitledBorder(new EmptyBorder(1, 2, 3, 4), null, TitledBorder.LEFT,
+            TitledBorder.BELOW_BOTTOM, f);
+    harness.check(tb.getTitle(), null);
+  }
+
+  public void test5(TestHarness harness)       
+  {
+    harness.checkPoint("(Border, String, int, int, Font, Color)");
+    Border b = new EmptyBorder(1, 2, 3, 4);
+    Font f = new Font("Dialog", Font.BOLD, 16);
+    TitledBorder tb = new TitledBorder(b, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM, f, Color.red);
+    harness.check(tb.getBorder(), b);
+    harness.check(tb.getTitle(), "XYZ");
+    harness.check(tb.getTitleColor(), Color.red);
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.BELOW_BOTTOM);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEFT);
+    
+    tb = new TitledBorder((Border) null, "XYZ", TitledBorder.LEFT, 
+            TitledBorder.BELOW_BOTTOM, f, Color.red);
+    Border bb = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), bb);
+    
+    tb = new TitledBorder(new EmptyBorder(1, 2, 3, 4), null, TitledBorder.LEFT,
+            TitledBorder.BELOW_BOTTOM, f, Color.red);
+    harness.check(tb.getTitle(), null);
+  }
+
+  public void test6(TestHarness harness)       
+  {
+    harness.checkPoint("(String)");
+    TitledBorder tb = new TitledBorder("XYZ");
+    harness.check(tb.getTitle(), "XYZ");
+    Border b = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(tb.getBorder(), b);
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(tb.getTitleColor(), c);
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(tb.getTitleFont(), f);
+    harness.check(tb.getTitlePosition(), TitledBorder.TOP);
+    harness.check(tb.getTitleJustification(), TitledBorder.LEADING);
+    
+    tb = new TitledBorder((String) null);
+    harness.check(tb.getTitle(), null);
+  }
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getBorder.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getBorder.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getBorder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getBorder.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,55 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getBorder() method of the {@link TitledBorder} class.
+ */
+public class getBorder implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    Border baseBorder = new EmptyBorder(1, 1, 1, 1);
+    TitledBorder b = new TitledBorder(baseBorder);
+    harness.check(b.getBorder(), baseBorder);
+    baseBorder = new EmptyBorder(1, 2, 3, 4);
+    b.setBorder(baseBorder);
+    harness.check(b.getBorder(), baseBorder);
+    b.setBorder(null);
+    baseBorder = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(b.getBorder(), baseBorder);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getBorderInsets.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getBorderInsets.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getBorderInsets.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getBorderInsets.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,103 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Insets;
+
+import javax.swing.JPanel;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getBorderInsets() methods of the {@link TitledBorder} 
+ * class.
+ */
+public class getBorderInsets implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    test1(harness);
+  }
+  
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test1(TestHarness harness)       
+  {
+    harness.checkPoint("(Component)");
+    JPanel p = new JPanel();
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 2, 3, 4));
+    p.setBorder(b);
+    p.setFont(b.getTitleFont());
+    Insets insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5, 6, 7, 8));
+    
+    FontMetrics fm = p.getFontMetrics(p.getFont());
+    int fontHeight = fm.getHeight();
+    b.setTitle("XYZ");
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5 + fontHeight, 6, 7, 8));
+    
+    b.setTitleFont(new Font("Dialog", Font.PLAIN, 24));
+    p.setFont(b.getTitleFont());
+    fm = p.getFontMetrics(p.getFont());
+    fontHeight = fm.getHeight();
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5 + fontHeight, 6, 7, 8));
+
+    b.setTitlePosition(TitledBorder.ABOVE_TOP);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5 + fontHeight + 2, 6, 7, 8));
+  
+    b.setTitlePosition(TitledBorder.TOP);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5 + fontHeight, 6, 7, 8));
+
+    b.setTitlePosition(TitledBorder.BELOW_TOP);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5 + fontHeight + 2, 6, 7, 8));
+  
+    b.setTitlePosition(TitledBorder.ABOVE_BOTTOM);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5, 6, 7 + fontHeight + 2, 8));
+  
+    b.setTitlePosition(TitledBorder.BOTTOM);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5, 6, 7 + fontHeight, 8));
+
+    b.setTitlePosition(TitledBorder.BELOW_BOTTOM);
+    insets = b.getBorderInsets(p);
+    harness.check(insets, new Insets(5, 6, 7 + fontHeight, 8));
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getTitle.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getTitle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getTitle.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,48 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getTitle() method of the {@link TitledBorder} class.
+ */
+public class getTitle implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.getTitle(), "");
+    b.setTitle("XYZ");
+    harness.check(b.getTitle(), "XYZ");
+    b.setTitle(null);
+    harness.check(b.getTitle(), null);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getTitleColor.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getTitleColor.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getTitleColor.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getTitleColor.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getTitleColor() method of the {@link TitledBorder} class.
+ */
+public class getTitleColor implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(b.getTitleColor(), c);
+    b.setTitleColor(Color.yellow);
+    harness.check(b.getTitleColor(), Color.yellow);
+    b.setTitleColor(null);
+    harness.check(b.getTitleColor(), c);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getTitleFont.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getTitleFont.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getTitleFont.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getTitleFont.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,52 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Font;
+
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getTitleFont() method of the {@link TitledBorder} class.
+ */
+public class getTitleFont implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(b.getTitleFont(), f);
+    b.setTitleFont(new Font("Dialog", Font.PLAIN, 17));
+    harness.check(b.getTitleFont(), new Font("Dialog", Font.PLAIN, 17));
+    b.setTitleFont(null);
+    harness.check(b.getTitleFont(), f);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getTitleJustification.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getTitleJustification.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getTitleJustification.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getTitleJustification.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getTitleJustification() method of the 
+ * {@link TitledBorder} class.
+ */
+public class getTitleJustification implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.getTitleJustification(), TitledBorder.LEADING);
+    b.setTitleJustification(TitledBorder.LEFT);
+    harness.check(b.getTitleJustification(), TitledBorder.LEFT);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/getTitlePosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/getTitlePosition.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/getTitlePosition.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/getTitlePosition.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the getTitlePosition() method of the 
+ * {@link TitledBorder} class.
+ */
+public class getTitlePosition implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.getTitlePosition(), TitledBorder.TOP);
+    b.setTitlePosition(TitledBorder.BELOW_TOP);
+    harness.check(b.getTitlePosition(), TitledBorder.BELOW_TOP);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/isBorderOpaque.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/isBorderOpaque.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/isBorderOpaque.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/isBorderOpaque.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,45 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the isBorderOpaque() method of the {@link TitledBorder} 
+ * class.
+ */
+public class isBorderOpaque implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.isBorderOpaque(), false);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setBorder.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setBorder.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setBorder.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setBorder.java	10 Oct 2005 08:00:05 -0000
@@ -0,0 +1,55 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setBorder() method of the {@link TitledBorder} class.
+ */
+public class setBorder implements Testlet 
+{
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    Border baseBorder = new EmptyBorder(1, 1, 1, 1);
+    TitledBorder b = new TitledBorder(baseBorder);
+    harness.check(b.getBorder(), baseBorder);
+    baseBorder = new EmptyBorder(1, 2, 3, 4);
+    b.setBorder(baseBorder);
+    harness.check(b.getBorder(), baseBorder);
+    b.setBorder(null);
+    baseBorder = UIManager.getLookAndFeelDefaults().getBorder(
+            "TitledBorder.border");
+    harness.check(b.getBorder(), baseBorder);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setTitle.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setTitle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setTitle.java	10 Oct 2005 08:00:06 -0000
@@ -0,0 +1,47 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setTitle() method of the {@link TitledBorder} class.
+ */
+public class setTitle implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    b.setTitle("XYZ");
+    harness.check(b.getTitle(), "XYZ");
+    b.setTitle(null);
+    harness.check(b.getTitle(), null);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setTitleColor.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setTitleColor.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setTitleColor.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setTitleColor.java	10 Oct 2005 08:00:06 -0000
@@ -0,0 +1,53 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Color;
+
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setTitleColor() method of the {@link TitledBorder} class.
+ */
+public class setTitleColor implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    Color c = UIManager.getLookAndFeelDefaults().getColor(
+            "TitledBorder.titleColor");
+    harness.check(b.getTitleColor(), c);
+    b.setTitleColor(Color.yellow);
+    harness.check(b.getTitleColor(), Color.yellow);
+    b.setTitleColor(null);
+    harness.check(b.getTitleColor(), c);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setTitleFont.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setTitleFont.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setTitleFont.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setTitleFont.java	10 Oct 2005 08:00:06 -0000
@@ -0,0 +1,52 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Font;
+
+import javax.swing.UIManager;
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setTitleFont() method of the {@link TitledBorder} class.
+ */
+public class setTitleFont implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    Font f = UIManager.getLookAndFeelDefaults().getFont("TitledBorder.font");
+    harness.check(b.getTitleFont(), f);
+    b.setTitleFont(new Font("Dialog", Font.PLAIN, 17));
+    harness.check(b.getTitleFont(), new Font("Dialog", Font.PLAIN, 17));
+    b.setTitleFont(null);
+    harness.check(b.getTitleFont(), f);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setTitleJustification.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setTitleJustification.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setTitleJustification.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setTitleJustification.java	10 Oct 2005 08:00:06 -0000
@@ -0,0 +1,57 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setTitleJustification() method of the 
+ * {@link TitledBorder} class.
+ */
+public class setTitleJustification implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.getTitleJustification(), TitledBorder.LEADING);
+    b.setTitleJustification(TitledBorder.LEFT);
+    harness.check(b.getTitleJustification(), TitledBorder.LEFT);
+    boolean pass = false;
+    try
+    {
+      b.setTitleJustification(99);
+    }
+    catch (IllegalArgumentException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}
Index: gnu/testlet/javax/swing/border/TitledBorder/setTitlePosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/border/TitledBorder/setTitlePosition.java
diff -N gnu/testlet/javax/swing/border/TitledBorder/setTitlePosition.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/border/TitledBorder/setTitlePosition.java	10 Oct 2005 08:00:06 -0000
@@ -0,0 +1,57 @@
+// Tags: JDK1.2
+
+// Copyright (C) 2005 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
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// Mauve is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Mauve; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
+
+package gnu.testlet.javax.swing.border.TitledBorder;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.border.EmptyBorder;
+import javax.swing.border.TitledBorder;
+
+/**
+ * Some checks for the setTitlePosition() method of the 
+ * {@link TitledBorder} class.
+ */
+public class setTitlePosition implements Testlet {
+
+  /**
+   * Runs the test using the specified harness.
+   * 
+   * @param harness  the test harness (<code>null</code> not permitted).
+   */
+  public void test(TestHarness harness)       
+  {
+    TitledBorder b = new TitledBorder(new EmptyBorder(1, 1, 1, 1));
+    harness.check(b.getTitlePosition(), TitledBorder.TOP);
+    b.setTitlePosition(TitledBorder.BELOW_BOTTOM);
+    harness.check(b.getTitlePosition(), TitledBorder.BELOW_BOTTOM);
+    boolean pass = false;
+    try
+    {
+      b.setTitlePosition(99);
+    }
+    catch (IllegalArgumentException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+
+}

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