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 ToolTipManager regression test


This is a new visual test that tests the ToolTipManager dynamic tooltip
facility. This is a regression test for:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27957

2006-10-14  Roman Kennke <kennke@aicas.com>

        *
gnu/testlet/javax/swing/ToolTipManager/DynamicToolTipTest.java:
        New test. This is a regression test
        for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27957 .

/Roman

Index: gnu/testlet/javax/swing/ToolTipManager/DynamicToolTipTest.java
===================================================================
RCS file: gnu/testlet/javax/swing/ToolTipManager/DynamicToolTipTest.java
diff -N gnu/testlet/javax/swing/ToolTipManager/DynamicToolTipTest.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/ToolTipManager/DynamicToolTipTest.java	14 Oct 2006 12:53:11 -0000
@@ -0,0 +1,76 @@
+/* DynamicToolTipTest.java -- Tests dynamically updated tooltips
+   Copyright (C) 2006 Roman Kennke (kennke@aicas.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.ToolTipManager;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.event.MouseEvent;
+
+import javax.swing.JPanel;
+import javax.swing.ToolTipManager;
+
+import gnu.testlet.VisualTestlet;
+
+/**
+ * Tests if dynamic tooltips {@link JComponent.getToolTipText(MouseEvent)}
+ * work correctly.
+ *
+ * This is a regression test for bug:
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27957
+ */
+public class DynamicToolTipTest extends VisualTestlet
+{
+
+  public String getInstructions()
+  {
+    return "Move the mouse pointer over the empty panel. Wait for 1-2 seconds"
+           + " until the tooltip appears. Moving the mouse should update "
+           + "the tooltip text with the current mouse coordinates.";
+  }
+
+  public String getExpectedResults()
+  {
+    return "A tooltip should appear after 1-2 seconds. When the mouse is moved"
+           + " further, the tooltip text is updated with the mouse coordinates"
+           + " and the tooltip location follows the mouse pointer";
+  }
+
+  public Component getTestComponent()
+  {
+    JPanel p = new JPanel()
+    {
+      public Dimension getPreferredSize()
+      {
+        return new Dimension(200, 200);
+      }
+      public String getToolTipText(MouseEvent ev)
+      {
+        return "" + ev.getX() + ", " + ev.getY(); 
+      }
+    };
+    ToolTipManager.sharedInstance().registerComponent(p);
+    return p;
+  }
+
+}

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