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: New javax.swing tests


This patch (committed) adds some new tests:

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

* gnu/testlet/javax/swing/AbstractButton/setHorizontalTextPosition.java: New file,
* gnu/testlet/javax/swing/AbstractButton/setVerticalTextPosition.java: New file,
* gnu/testlet/javax/swing/Timer/setDelay.java: New file,
* gnu/testlet/javax/swing/Timer/setInitialDelay.java: New file,
* gnu/testlet/javax/swing/ToolTipManager/setDismissDelay.java: New file,
* gnu/testlet/javax/swing/ToolTipManager/setInitialDelay.java: New file,
* gnu/testlet/javax/swing/ToolTipManager/setReshowDelay.java: New file.


Regards,

Dave
Index: gnu/testlet/javax/swing/AbstractButton/setHorizontalTextPosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/AbstractButton/setHorizontalTextPosition.java
diff -N gnu/testlet/javax/swing/AbstractButton/setHorizontalTextPosition.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/AbstractButton/setHorizontalTextPosition.java	10 Jul 2006 05:10:18 -0000
@@ -0,0 +1,79 @@
+/* setHorizontalTextPosition.java -- some checks for the 
+       setHorizontalTextPosition() method in the AbstractButton class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.AbstractButton;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.AbstractButton;
+import javax.swing.JButton;
+import javax.swing.SwingConstants;
+
+public class setHorizontalTextPosition 
+  implements Testlet, PropertyChangeListener
+{
+  List events = new java.util.ArrayList();
+  
+  public void propertyChange(PropertyChangeEvent e) 
+  {
+    events.add(e);
+  }
+
+  public void test(TestHarness harness) 
+  {
+    AbstractButton b = new JButton("ABC");
+    b.addPropertyChangeListener(this);
+    b.setHorizontalTextPosition(SwingConstants.LEFT);
+    harness.check(b.getHorizontalTextPosition(), SwingConstants.LEFT);
+    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
+    harness.check(e.getSource(), b);
+    harness.check(e.getPropertyName(), "horizontalTextPosition");
+    harness.check(e.getOldValue(), new Integer(SwingConstants.TRAILING));
+    harness.check(e.getNewValue(), new Integer(SwingConstants.LEFT));
+    
+    // setting the same value should generate no event
+    events.clear();
+    b.setHorizontalTextPosition(SwingConstants.LEFT);
+    harness.check(events.size(), 0);
+    
+    // try an illegal argument
+    boolean pass = false;
+    try
+      {
+        b.setHorizontalTextPosition(SwingConstants.NORTH);
+      }
+    catch (IllegalArgumentException ex)
+      {
+        pass = true;  
+      }
+    harness.check(pass);
+       
+  }
+  
+}
Index: gnu/testlet/javax/swing/AbstractButton/setVerticalTextPosition.java
===================================================================
RCS file: gnu/testlet/javax/swing/AbstractButton/setVerticalTextPosition.java
diff -N gnu/testlet/javax/swing/AbstractButton/setVerticalTextPosition.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/AbstractButton/setVerticalTextPosition.java	10 Jul 2006 05:10:18 -0000
@@ -0,0 +1,79 @@
+/* setVerticalTextPosition.java -- some checks for the 
+       setVerticalTextPosition() method in the AbstractButton class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.AbstractButton;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.AbstractButton;
+import javax.swing.JButton;
+import javax.swing.SwingConstants;
+
+public class setVerticalTextPosition 
+  implements Testlet, PropertyChangeListener
+{
+  List events = new java.util.ArrayList();
+  
+  public void propertyChange(PropertyChangeEvent e) 
+  {
+    events.add(e);
+  }
+
+  public void test(TestHarness harness) 
+  {
+    AbstractButton b = new JButton("ABC");
+    b.addPropertyChangeListener(this);
+    b.setVerticalTextPosition(SwingConstants.TOP);
+    harness.check(b.getVerticalTextPosition(), SwingConstants.TOP);
+    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
+    harness.check(e.getSource(), b);
+    harness.check(e.getPropertyName(), "verticalTextPosition");
+    harness.check(e.getOldValue(), new Integer(SwingConstants.CENTER));
+    harness.check(e.getNewValue(), new Integer(SwingConstants.TOP));
+    
+    // setting the same value should generate no event
+    events.clear();
+    b.setVerticalTextPosition(SwingConstants.TOP);
+    harness.check(events.size(), 0);
+    
+    // try an illegal argument
+    boolean pass = false;
+    try
+      {
+        b.setVerticalTextPosition(SwingConstants.LEFT);
+      }
+    catch (IllegalArgumentException ex)
+      {
+        pass = true;  
+      }
+    harness.check(pass);
+       
+  }
+  
+}
Index: gnu/testlet/javax/swing/Timer/setDelay.java
===================================================================
RCS file: gnu/testlet/javax/swing/Timer/setDelay.java
diff -N gnu/testlet/javax/swing/Timer/setDelay.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/Timer/setDelay.java	10 Jul 2006 05:10:19 -0000
@@ -0,0 +1,64 @@
+/* setDelay.java -- some checks for the setDelay() method in the Timer class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.Timer;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Timer;
+
+public class setDelay implements Testlet, ActionListener 
+{
+
+  public void actionPerformed(ActionEvent event) 
+  {
+    // ignore      
+  }
+
+  public void test(TestHarness harness)
+  {
+    Timer t = new Timer(100, this);
+    t.setDelay(123);
+    harness.check(t.getDelay(), 123);
+     
+    // try zero
+    t.setDelay(0);
+    harness.check(t.getDelay(), 0);
+      
+    // try negative
+    boolean pass = false;
+    try
+    {
+      t.setDelay(-1);
+    }
+    catch (IllegalArgumentException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/javax/swing/Timer/setInitialDelay.java
===================================================================
RCS file: gnu/testlet/javax/swing/Timer/setInitialDelay.java
diff -N gnu/testlet/javax/swing/Timer/setInitialDelay.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/Timer/setInitialDelay.java	10 Jul 2006 05:10:19 -0000
@@ -0,0 +1,65 @@
+/* setInitialDelay.java -- some checks for the setInitialDelay() method in the
+       Timer class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.Timer;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Timer;
+
+public class setInitialDelay implements Testlet, ActionListener 
+{
+
+  public void actionPerformed(ActionEvent event) 
+  {
+    // ignore      
+  }
+
+  public void test(TestHarness harness)
+  {
+    Timer t = new Timer(100, this);
+    t.setInitialDelay(123);
+    harness.check(t.getInitialDelay(), 123);
+     
+    // try zero
+    t.setInitialDelay(0);
+    harness.check(t.getInitialDelay(), 0);
+      
+    // try negative
+    boolean pass = false;
+    try
+    {
+      t.setInitialDelay(-1);
+    }
+    catch (IllegalArgumentException e)
+    {
+      pass = true;
+    }
+    harness.check(pass);
+  }
+}
Index: gnu/testlet/javax/swing/ToolTipManager/setDismissDelay.java
===================================================================
RCS file: gnu/testlet/javax/swing/ToolTipManager/setDismissDelay.java
diff -N gnu/testlet/javax/swing/ToolTipManager/setDismissDelay.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/ToolTipManager/setDismissDelay.java	10 Jul 2006 05:10:19 -0000
@@ -0,0 +1,56 @@
+/* setDismissDelay.java -- some checks for the setDismissDelay() method in the
+       ToolTipManager class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.ToolTipManager;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.ToolTipManager;
+
+public class setDismissDelay implements Testlet {
+
+    public void test(TestHarness harness)
+    {
+      ToolTipManager m = ToolTipManager.sharedInstance();
+      m.setDismissDelay(123);
+      harness.check(m.getDismissDelay(), 123);
+      
+      // try zero
+      m.setDismissDelay(0);
+      harness.check(m.getDismissDelay(), 0);
+      
+      // try negative
+      boolean pass = false;
+      try
+      {
+        m.setDismissDelay(-1);
+      }
+      catch (IllegalArgumentException e)
+      {
+        pass = true;
+      }
+      harness.check(pass);
+    }
+}
Index: gnu/testlet/javax/swing/ToolTipManager/setInitialDelay.java
===================================================================
RCS file: gnu/testlet/javax/swing/ToolTipManager/setInitialDelay.java
diff -N gnu/testlet/javax/swing/ToolTipManager/setInitialDelay.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/ToolTipManager/setInitialDelay.java	10 Jul 2006 05:10:19 -0000
@@ -0,0 +1,56 @@
+/* setInitialDelay.java -- some checks for the setInitialDelay() method in the
+       ToolTipManager class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.ToolTipManager;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.ToolTipManager;
+
+public class setInitialDelay implements Testlet {
+
+    public void test(TestHarness harness)
+    {
+      ToolTipManager m = ToolTipManager.sharedInstance();
+      m.setInitialDelay(123);
+      harness.check(m.getInitialDelay(), 123);
+      
+      // try zero
+      m.setInitialDelay(0);
+      harness.check(m.getInitialDelay(), 0);
+      
+      // try negative
+      boolean pass = false;
+      try
+      {
+        m.setInitialDelay(-1);
+      }
+      catch (IllegalArgumentException e)
+      {
+        pass = true;
+      }
+      harness.check(pass);
+    }
+}
Index: gnu/testlet/javax/swing/ToolTipManager/setReshowDelay.java
===================================================================
RCS file: gnu/testlet/javax/swing/ToolTipManager/setReshowDelay.java
diff -N gnu/testlet/javax/swing/ToolTipManager/setReshowDelay.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/ToolTipManager/setReshowDelay.java	10 Jul 2006 05:10:19 -0000
@@ -0,0 +1,58 @@
+/* setReshowDelay.java -- some checks for the setReshowDelay() method in the
+       ToolTipManager class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.com>
+This file is part of Mauve.
+
+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.
+
+*/
+
+// Tags: JDK1.5
+
+package gnu.testlet.javax.swing.ToolTipManager;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.ToolTipManager;
+
+public class setReshowDelay implements Testlet {
+
+    public void test(TestHarness harness)
+    {
+      ToolTipManager m = ToolTipManager.sharedInstance();
+      m.setInitialDelay(20);
+      m.setReshowDelay(123);
+      harness.check(m.getReshowDelay(), 123);
+      harness.check(m.getInitialDelay(), 20);
+      
+      // try zero
+      m.setReshowDelay(0);
+      harness.check(m.getReshowDelay(), 0);
+      
+      // try negative
+      boolean pass = false;
+      try
+      {
+        m.setReshowDelay(-1);
+      }
+      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]