diff options
author | Artur Signell <artur.signell@itmill.com> | 2010-06-21 08:23:39 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2010-06-21 08:23:39 +0000 |
commit | e9b730ddc0a44529a26520b8e0206ca2586a24d4 (patch) | |
tree | b55452f4f21e590468ab8981e3a9ce0a623a593f /tests/src | |
parent | 729bba0313ae90747e2670b7e0afe09114ab87b7 (diff) | |
download | vaadin-framework-e9b730ddc0a44529a26520b8e0206ca2586a24d4.tar.gz vaadin-framework-e9b730ddc0a44529a26520b8e0206ca2586a24d4.zip |
Merged and slightly modified fix for #4652 - MouseEventDetails and ClickEvent should provide coordinates relative to component
svn changeset:13800/svn branch:6.4
Diffstat (limited to 'tests/src')
5 files changed, 170 insertions, 1 deletions
diff --git a/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.html b/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.html new file mode 100644 index 0000000000..4def1f5d14 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.html @@ -0,0 +1,47 @@ +<?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="" /> +<title>EmbeddedClickListenerRelativeCoordinates</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">EmbeddedClickListenerRelativeCoordinates</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/EmbeddedClickListenerRelativeCoordinates</td> + <td></td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=vaadinrunEmbeddedClickListenerRelativeCoordinates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VEmbedded[0]/domChild[0]</td> + <td>41,22</td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java b/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java new file mode 100644 index 0000000000..96b1d36901 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/embedded/EmbeddedClickListenerRelativeCoordinates.java @@ -0,0 +1,37 @@ +package com.vaadin.tests.components.embedded; + +import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.terminal.ThemeResource; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Embedded; + +public class EmbeddedClickListenerRelativeCoordinates extends TestBase { + + @Override + protected void setup() { + Embedded e = new Embedded("Embedded caption", new ThemeResource( + "../runo/icons/64/ok.png")); + e.addListener(new ClickListener() { + + public void click(ClickEvent event) { + getMainWindow() + .showNotification( + "" + event.getRelativeX() + ", " + + event.getRelativeY()); + } + }); + addComponent(e); + } + + @Override + protected String getDescription() { + return "Click the image to get coordinates relative to the top-left corder of the embedded image."; + } + + @Override + protected Integer getTicketNumber() { + return null; + } + +} diff --git a/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.html b/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.html new file mode 100644 index 0000000000..1088c4eeb9 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.html @@ -0,0 +1,47 @@ +<?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.60:8080/" /> +<title>PanelClickListenerRelativeCoordinates</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">PanelClickListenerRelativeCoordinates</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/vaadin/run/PanelClickListenerRelativeCoordinates</td> + <td></td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=vaadinrunPanelClickListenerRelativeCoordinates::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPanel[0]/VVerticalLayout[0]</td> + <td>287,25</td> +</tr> +<tr> + <td>waitForVaadin</td> + <td></td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td></td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java b/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java new file mode 100644 index 0000000000..65a185b160 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/panel/PanelClickListenerRelativeCoordinates.java @@ -0,0 +1,36 @@ +package com.vaadin.tests.components.panel; + +import com.vaadin.event.MouseEvents.ClickEvent; +import com.vaadin.event.MouseEvents.ClickListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Panel; + +public class PanelClickListenerRelativeCoordinates extends TestBase { + + @Override + protected void setup() { + Panel panel = new Panel("Panel's caption"); + panel.addListener(new ClickListener() { + + public void click(ClickEvent event) { + getMainWindow() + .showNotification( + "" + event.getRelativeX() + ", " + + event.getRelativeY()); + } + }); + addComponent(panel); + + } + + @Override + protected String getDescription() { + return "Click the panel to get coordinates relative to the top-left corder of the panel."; + } + + @Override + protected Integer getTicketNumber() { + return null; + } + +} diff --git a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java index 386608f01f..68f001baea 100644 --- a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java +++ b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java @@ -150,7 +150,9 @@ public class TestLayoutClickListeners extends AbstractTestCase { if (event.isDoubleClick()) { type = "double-click"; } - log.log(layout + ": " + button + " " + type + " on " + target); + log.log(layout + ": " + button + " " + type + " on " + target + + ", coordinates relative to the layout (" + + event.getRelativeX() + ", " + event.getRelativeY() + ")"); } |