]> source.dussan.org Git - vaadin-framework.git/commitdiff
#8454 Fixes miscalculated tooltip sizes when tooltips opens at browser edges.
authorJens Jansson <jens.jansson@vaadin.com>
Fri, 9 Mar 2012 11:22:43 +0000 (11:22 +0000)
committerJens Jansson <jens.jansson@vaadin.com>
Fri, 9 Mar 2012 11:22:43 +0000 (11:22 +0000)
svn changeset:23208/svn branch:6.8

src/com/vaadin/terminal/gwt/client/VTooltip.java
tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.html [new file with mode: 0644]
tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.java [new file with mode: 0644]

index ed8bd2eedde167798ae3e7931acde5332a3e5125..974e2f1f32b93a9bd4880f0079bba2ab1cecfab5 100644 (file)
@@ -72,6 +72,11 @@ public class VTooltip extends VOverlay {
             DOM.setStyleAttribute(description, "display", "none");
         }
         if (hasContent) {
+            // Issue #8454: With IE7 the tooltips size is calculated based on
+            // the last tooltip's position, causing problems if the last one was
+            // in the right or bottom edge. For this reason the tooltip is moved
+            // first to 0,0 position so that the calculation goes correctly.
+            setPopupPosition(0, 0);
             setPopupPositionAndShow(new PositionCallback() {
                 public void setPosition(int offsetWidth, int offsetHeight) {
 
diff --git a/tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.html b/tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.html
new file mode 100644 (file)
index 0000000..13fdf52
--- /dev/null
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://192.168.2.168:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+       <td>open</td>
+       <td>/run/com.vaadin.tests.components.button.ButtonTooltips?restartApplication</td>
+       <td></td>
+</tr>
+<tr>
+       <td>showTooltip</td>
+       <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>showTooltip</td>
+       <td>vaadin=runcomvaadintestscomponentsbuttonButtonTooltips::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+       <td>0,0</td>
+</tr>
+<tr>
+       <td>screenCapture</td>
+       <td></td>
+       <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.java b/tests/testbench/com/vaadin/tests/components/button/ButtonTooltips.java
new file mode 100644 (file)
index 0000000..fa63991
--- /dev/null
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.VerticalLayout;
+
+public class ButtonTooltips extends TestBase {
+
+    @Override
+    protected String getDescription() {
+        return "Button tooltip's size gets messed up if moving from one tooltip to another before a timer expires.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8454;
+    }
+
+    @Override
+    protected void setup() {
+        VerticalLayout vl = new VerticalLayout();
+        Button button = new Button("One");
+        button.setDescription("long descidescidescpription");
+        Button button2 = new Button("Two");
+        button2.setDescription("Another");
+        Button button3 = new Button("One");
+        button3.setDescription("long descidescidescpription");
+        Button button4 = new Button("Two");
+        button4.setDescription("Another");
+        vl.addComponent(button);
+        vl.addComponent(button2);
+        vl.addComponent(button3);
+        vl.addComponent(button4);
+        vl.setComponentAlignment(button, Alignment.TOP_RIGHT);
+        vl.setComponentAlignment(button2, Alignment.TOP_RIGHT);
+        addComponent(vl);
+
+    }
+}