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: TableColumn.setResizable test enhanced


This patch (committed) extends the test for the TableColumn.setResizable() method to check for the required PropertyChangeEvent:

2006-03-14 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/javax/swing/table/TableColumn/setResizable.java
   (lastEvent): New field,
   (propertyChange): New method,
   (test): Extended to check PropertyChangeEvent.

This currently fails with GNU Classpath - I will supply a patch to fix it soon.

Regards,

Dave
Index: gnu/testlet/javax/swing/table/TableColumn/setResizable.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/table/TableColumn/setResizable.java,v
retrieving revision 1.1
diff -u -r1.1 setResizable.java
--- gnu/testlet/javax/swing/table/TableColumn/setResizable.java	9 Jan 2005 23:06:43 -0000	1.1
+++ gnu/testlet/javax/swing/table/TableColumn/setResizable.java	14 Mar 2006 15:43:50 -0000
@@ -1,6 +1,6 @@
 // Tags: JDK1.2
 
-// Copyright (C) 2005 David Gilbert <david.gilbert@object-refinery.com>
+// Copyright (C) 2005, 2006, 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
@@ -14,21 +14,30 @@
 
 // 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, 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.  */
+// the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+// Boston, MA 02110-1301 USA.
 
 package gnu.testlet.javax.swing.table.TableColumn;
 
 import gnu.testlet.TestHarness;
 import gnu.testlet.Testlet;
 
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
 import javax.swing.table.TableColumn;
 
 /**
  * Some tests for the setResizable() method in the {@link TableColumn} class.
  */
-public class setResizable implements Testlet 
+public class setResizable implements Testlet, PropertyChangeListener 
 {
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent e)
+  {
+    this.lastEvent = e;
+  }
 
   /**
    * Runs the test using the specified harness.
@@ -38,11 +47,26 @@
   public void test(TestHarness harness)      
   {
     TableColumn c = new TableColumn();
+    harness.check(c.getResizable(), true);
+    
+    c.addPropertyChangeListener(this);
     c.setResizable(false);
     harness.check(c.getResizable(), false);
+    harness.check(lastEvent.getPropertyName(), "isResizable");
+    harness.check(lastEvent.getOldValue(), Boolean.TRUE);
+    harness.check(lastEvent.getNewValue(), Boolean.FALSE);
+
+    // check that setting to the same value doesn't generate an event
+    lastEvent = null;
+    c.setResizable(false);
+    harness.check(lastEvent == null);
     
+    // now flip to true
     c.setResizable(true);
     harness.check(c.getResizable(), true);
+    harness.check(lastEvent.getPropertyName(), "isResizable");
+    harness.check(lastEvent.getOldValue(), Boolean.FALSE);
+    harness.check(lastEvent.getNewValue(), Boolean.TRUE);
   }
 
 }

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