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: JToolTip - new tests


This patch (committed) adds some tests for the JToolTip class:

2006-05-31 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/javax/swing/JToolTip/getAccessibleContext.java: New file,
   * gnu/testlet/javax/swing/JToolTip/getComponent.java: New file,
   * gnu/testlet/javax/swing/JToolTip/getTipText.java: New file,
   * gnu/testlet/javax/swing/JToolTip/getUIClassID.java: New file,
   * gnu/testlet/javax/swing/JToolTip/paramString.java: New file,
   * gnu/testlet/javax/swing/JToolTip/setComponent.java: New file,
   * gnu/testlet/javax/swing/JToolTip/setTipText.java: New file.

Regards,

Dave
Index: gnu/testlet/javax/swing/JToolTip/MyJToolTip.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/MyJToolTip.java
diff -N gnu/testlet/javax/swing/JToolTip/MyJToolTip.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/MyJToolTip.java	31 May 2006 11:04:08 -0000
@@ -0,0 +1,40 @@
+/* MyJToolTip.java -- provides access to protected stuff in the 
+       JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import javax.swing.JToolTip;
+
+public class MyJToolTip extends JToolTip
+{
+  public MyJToolTip() 
+  {
+    super();
+  }
+  
+  public String paramString()
+  {
+    return super.paramString();
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/getAccessibleContext.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/getAccessibleContext.java
diff -N gnu/testlet/javax/swing/JToolTip/getAccessibleContext.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/getAccessibleContext.java	31 May 2006 11:04:08 -0000
@@ -0,0 +1,72 @@
+/* getAccessibleContext.java -- some checks for the getAccessibleContext()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.JToolTip;
+
+public class getAccessibleContext 
+  implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    JToolTip tt = new JToolTip();
+    AccessibleContext att = tt.getAccessibleContext();
+    
+    // check the default values
+    harness.check(att.getAccessibleName(), null);
+    harness.check(att.getAccessibleDescription(), null);
+    harness.check(att.getAccessibleComponent(), att);    
+    harness.check(att.getAccessibleRole(), AccessibleRole.TOOL_TIP);
+
+    // setting the tip text on the tool tip updates the accessible description
+    tt.setTipText("XYZ");
+    harness.check(att.getAccessibleDescription(), "XYZ");
+    tt.setTipText(null);
+    harness.check(att.getAccessibleDescription(), null);
+    
+    // setting the accessible description doesn't update the tip text
+    att.setAccessibleDescription("ABC");
+    harness.check(att.getAccessibleDescription(), "ABC");
+    harness.check(tt.getTipText(), null);
+    
+    // ...and once an explicit description is set, it isn't changed by setting
+    // the tip text
+    tt.setTipText("DEF");
+    harness.check(att.getAccessibleDescription(), "ABC");
+    
+    // TODO: the following should fire a property change event
+    att.setAccessibleName("X");
+    harness.check(att.getAccessibleName(), "X");
+
+    // does getAccessibleContext() always return the same instance?
+    AccessibleContext att2 = tt.getAccessibleContext();
+    harness.check(att == att2);
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/getComponent.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/getComponent.java
diff -N gnu/testlet/javax/swing/JToolTip/getComponent.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/getComponent.java	31 May 2006 11:04:08 -0000
@@ -0,0 +1,45 @@
+/* getComponent.java -- some checks for the getComponent()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JButton;
+import javax.swing.JToolTip;
+
+public class getComponent 
+  implements Testlet
+{
+  
+  public void test(TestHarness harness)
+  {
+    JButton component = new JButton("Button");
+    JToolTip tt = new JToolTip();
+    harness.check(tt.getComponent(), null);
+    tt.setComponent(component);
+    harness.check(tt.getComponent(), component);
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/getTipText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/getTipText.java
diff -N gnu/testlet/javax/swing/JToolTip/getTipText.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/getTipText.java	31 May 2006 11:04:09 -0000
@@ -0,0 +1,43 @@
+/* getTipText.java -- some checks for the getTipText()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JToolTip;
+
+public class getTipText 
+  implements Testlet
+{
+  
+  public void test(TestHarness harness)
+  {
+    JToolTip tt = new JToolTip();
+    harness.check(tt.getTipText(), null);
+    tt.setTipText("ABC");
+    harness.check(tt.getTipText(), "ABC");
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/getUIClassID.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/getUIClassID.java
diff -N gnu/testlet/javax/swing/JToolTip/getUIClassID.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/getUIClassID.java	31 May 2006 11:04:09 -0000
@@ -0,0 +1,39 @@
+/* getUIClassID.java -- some checks for the getUIClassID()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JToolTip;
+
+public class getUIClassID implements Testlet 
+{
+  public void test(TestHarness harness)
+  {
+    JToolTip tt = new JToolTip();
+    harness.check(tt.getUIClassID(), "ToolTipUI");
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/paramString.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/paramString.java
diff -N gnu/testlet/javax/swing/JToolTip/paramString.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/paramString.java	31 May 2006 11:04:09 -0000
@@ -0,0 +1,40 @@
+/* paramString.java -- some checks for the paramString()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class paramString implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    MyJToolTip tt = new MyJToolTip();
+    
+    // according to the spec, the string format is implementation
+    // dependent but cannot be null...
+    harness.check(tt.paramString() != null);
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/setComponent.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/setComponent.java
diff -N gnu/testlet/javax/swing/JToolTip/setComponent.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/setComponent.java	31 May 2006 11:04:09 -0000
@@ -0,0 +1,73 @@
+/* setComponent.java -- some checks for the setComponent()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JToolTip;
+
+public class setComponent 
+  implements Testlet, PropertyChangeListener
+{
+  List events = new java.util.ArrayList();
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    events.add(event);
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JButton component = new JButton("Button");
+    JToolTip tt = new JToolTip();
+    tt.addPropertyChangeListener(this);
+    tt.setComponent(component);
+    harness.check(tt.getComponent(), component);
+
+    // check the generated event...
+    harness.check(events.size(), 1);
+    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
+    harness.check(e.getPropertyName(), "component");
+    harness.check(e.getSource(), tt);
+    harness.check(e.getOldValue(), null);
+    harness.check(e.getNewValue(), component);
+    
+    // check that the component can be set to null
+    events.clear();
+    tt.setComponent(null);
+    harness.check(events.size(), 1);
+    e = (PropertyChangeEvent) events.get(0);
+    harness.check(e.getPropertyName(), "component");
+    harness.check(e.getSource(), tt);
+    harness.check(e.getOldValue(), component);
+    harness.check(e.getNewValue(), null);
+  }
+}
Index: gnu/testlet/javax/swing/JToolTip/setTipText.java
===================================================================
RCS file: gnu/testlet/javax/swing/JToolTip/setTipText.java
diff -N gnu/testlet/javax/swing/JToolTip/setTipText.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JToolTip/setTipText.java	31 May 2006 11:04:09 -0000
@@ -0,0 +1,60 @@
+/* setTipText.java -- some checks for the setTipText()
+       method in the JToolTip 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.2
+
+package gnu.testlet.javax.swing.JToolTip;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+import javax.swing.JToolTip;
+
+public class setTipText implements Testlet, PropertyChangeListener
+{
+  List events = new java.util.ArrayList();
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    events.add(event);
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JToolTip tt = new JToolTip();
+    tt.addPropertyChangeListener(this);
+    tt.setTipText("XYZ");
+    harness.check(tt.getTipText(), "XYZ");
+
+    // check the generated event...
+    harness.check(events.size(), 1);
+    PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
+    harness.check(e.getPropertyName(), "tiptext");
+    harness.check(e.getSource(), tt);
+    harness.check(e.getOldValue(), null);
+    harness.check(e.getNewValue(), "XYZ");
+  }
+}

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