diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-03-12 18:34:18 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-03-20 09:43:35 +0000 |
commit | 5ea677d377c96c60fbc546eb2381bb88f2d4b478 (patch) | |
tree | 36b3fefd6b1481c4f39f182f09e88b00d77d5818 /uitest | |
parent | 17f64543bcc74f74017a3d1c13e5db83c7a4ec41 (diff) | |
download | vaadin-framework-5ea677d377c96c60fbc546eb2381bb88f2d4b478.tar.gz vaadin-framework-5ea677d377c96c60fbc546eb2381bb88f2d4b478.zip |
Make TextArea.setCursorPosition work in all browsers (#8769)
svn changeset:25579/svn branch:6.8
Conflicts:
client/src/com/vaadin/client/ui/VTextField.java
Change-Id: I3b53be8df4ce0564f34d8aa9bc1ce1c34648eadd
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.html | 169 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java | 89 |
2 files changed, 258 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.html b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.html new file mode 100644 index 0000000000..9eaa1ceada --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.html @@ -0,0 +1,169 @@ +<?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://localhost: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.textarea.ScrollCursor?restartApplication</td> + <td></td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[0]</td> + <td>191,94</td> +</tr> +<tr> +<!-- set begin position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position--> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-start</td> +</tr> +<tr> +<!-- set middle position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position--> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-middle</td> +</tr> +<tr> +<!-- set end position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position--> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-end</td> +</tr> +<tr> +<!-- set start position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position : check that scrolling works from the end to the beginning--> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-end-start</td> +</tr> +<tr> +<!-- set no wrap --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set start position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>nowrap-start</td> +</tr> +<tr> +<!-- set middle position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>nowrap-middle</td> +</tr> +<tr> +<!-- set end position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>nowrap-end</td> +</tr> +<tr> +<!-- set start position value --> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> +<!-- set cursor position : check scrolling from the end to the beginning--> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentstextareaScrollCursor::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>nowrap-end-start</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java new file mode 100644 index 0000000000..c95731d94f --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java @@ -0,0 +1,89 @@ +package com.vaadin.tests.components.textarea; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.TextArea; + +/** + * @author denis + * + */ +public class ScrollCursor extends TestBase { + + private TextArea textArea; + private int position; + + @Override + protected void setup() { + textArea = new TextArea(); + textArea.setValue("saddddddddddd fdgdfgfdgfd\n" + + "aasddddddddddd\n" + "dsaffffffdsf\n" + "sdf\n" + + "dsfsdfsdfsdfsd\n\n" + "ffffffffffffffffffff\n" + + "sdfdsfdsfsdfsdfsd xxxxxxxxxxxxxxxx\n" + "sdgfsd\n" + + "dsf\n" + "ds\n" + "fds\n" + "fds\nfs"); + addComponent(textArea); + Button button = new Button("Scroll"); + button.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + textArea.setCursorPosition(getPosition()); + } + }); + Button wrap = new Button("Set wrap"); + wrap.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + textArea.setWordwrap(false); + } + }); + + Button toBegin = new Button("To begin"); + toBegin.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + position = 3; + } + }); + + Button toMiddle = new Button("To middle"); + toMiddle.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + position = 130; + } + }); + + Button toEnd = new Button("To end"); + toEnd.addListener(new ClickListener() { + + public void buttonClick(ClickEvent event) { + position = textArea.getValue().toString().length(); + } + }); + + addComponent(button); + addComponent(wrap); + addComponent(toBegin); + addComponent(toMiddle); + addComponent(toEnd); + } + + @Override + protected String getDescription() { + return "Tests scrolling for TextArea with different word wrapping settings. " + + "Sets cursor position at the beginning, middle and the end " + + "of text and checks textarea is scrolled."; + } + + @Override + protected Integer getTicketNumber() { + return 8769; + } + + private int getPosition() { + return position; + } + +} |