diff options
author | Artur Signell <artur@vaadin.com> | 2012-08-30 17:24:36 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-08-30 17:24:36 +0300 |
commit | 7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch) | |
tree | 0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/textarea | |
parent | 8941056349e302e687e40e94c13709e75f256d73 (diff) | |
download | vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.tar.gz vaadin-framework-7b25b3886ea95bc6495506fbe9472e45fcbde684.zip |
Renamed tests -> uitest and tests/testbench -> uitest/src (#9299)
Diffstat (limited to 'uitest/src/com/vaadin/tests/components/textarea')
7 files changed, 508 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaBasicStates.html b/uitest/src/com/vaadin/tests/components/textarea/TextAreaBasicStates.html new file mode 100644 index 0000000000..3d44192506 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaBasicStates.html @@ -0,0 +1,128 @@ +<?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>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.TextAreaTest?restartApplication</td> + <td></td> +</tr> +<!--Write "content" --> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>content</td> +</tr> +<!--Disable event log--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item1</td> + <td>26,2</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>20,8</td> +</tr> +<!-- Enabled state --> +<tr> + <td>screenCapture</td> + <td></td> + <td>enabled</td> +</tr> +<!--Disable--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>38,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>31,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>57,13</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>disabled</td> +</tr> +<!--Set readonly--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>6,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>20,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>51,10</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>disabled-readonly</td> +</tr> +<!--Enable--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>43,5</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>42,1</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>53,5</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>readonly</td> +</tr> +<!--Set read-write--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>6,6</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item0</td> + <td>20,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>51,10</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>enabled</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/uitest/src/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java new file mode 100644 index 0000000000..992f20843b --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.textarea; + +import com.vaadin.event.FieldEvents.TextChangeEvent; +import com.vaadin.event.FieldEvents.TextChangeListener; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.AbstractField; +import com.vaadin.ui.AbstractTextField; +import com.vaadin.ui.AbstractTextField.TextChangeEventMode; +import com.vaadin.ui.Button; +import com.vaadin.ui.Label; +import com.vaadin.ui.TextArea; +import com.vaadin.ui.TextField; + +public class TextAreaCursorPosition extends TestBase { + + private TextField cursorPosition = new TextField("Cursor position"); + + @Override + public void setup() { + Label label = new Label( + "Test of calculation of cursor position of TextArea"); + TextArea textArea = new TextArea(); + addListener(textArea); + addComponent(label); + addComponent(textArea); + addComponent(cursorPosition); + cursorPosition.setValue("?"); + addComponent(new Button("Force position update")); + } + + public void addListener(AbstractField newField) { + AbstractTextField newTextField = (AbstractTextField) newField; + newTextField.setTextChangeEventMode(TextChangeEventMode.EAGER); + + newTextField.addListener(new TextChangeListener() { + @Override + public void textChange(TextChangeEvent event) { + AbstractTextField component = (AbstractTextField) event + .getComponent(); + cursorPosition.setValue(component.getCursorPosition()); + } + }); + } + + @Override + protected String getDescription() { + return "Writing something in the field updates the cursor position field. The position field can also be updated using the button."; + } + + @Override + protected Integer getTicketNumber() { + return 7726; + } + +} diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaMaxLength.html b/uitest/src/com/vaadin/tests/components/textarea/TextAreaMaxLength.html new file mode 100755 index 0000000000..5fe43b7b7a --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaMaxLength.html @@ -0,0 +1,53 @@ +<?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://arturwin.office.itmill.com:9999/" /> +<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.TextAreaTest?debug&restartApplication</td> + <td></td> +</tr> +<!--max length 5--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>20,9</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item5</td> + <td>43,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>70,13</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[2]/VMenuBar[0]#item5</td> + <td>40,9</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>0123456789</td> +</tr> +<tr> + <td>assertValue</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>01234</td> +</tr> + +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaNullRepresentation.html b/uitest/src/com/vaadin/tests/components/textarea/TextAreaNullRepresentation.html new file mode 100644 index 0000000000..6b29b634db --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaNullRepresentation.html @@ -0,0 +1,111 @@ +<?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://artur-laptop.office.itmill.com: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.TextAreaTest?restartApplication</td> + <td></td> +</tr> +<!--ValueChangeListener--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>35,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item3</td> + <td>37,10</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item2</td> + <td>42,9</td> +</tr> +<!--Null representation--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_Smenu#item0</td> + <td>22,7</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[0]/VMenuBar[0]#item5</td> + <td>32,4</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[1]/VMenuBar[0]#item1</td> + <td>52,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::Root/VOverlay[2]/VMenuBar[0]#item2</td> + <td>17,7</td> +</tr> +<!--Type null representation--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>This is empty</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]</td> + <td>176,130</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td> + <td>2. ValueChangeEvent, new value: null</td> +</tr> +<!--Enter text--> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>44,10</td> +</tr> +<tr> + <td>enterCharacter</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>abc</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td> + <td>3. ValueChangeEvent, new value: 'abc'</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>74,14</td> +</tr> +<!--Type null representation--> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_StestComponent</td> + <td>This is empty</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]</td> + <td>176,130</td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runcomvaadintestscomponentstextareaTextAreaTest::PID_SLog/ChildComponentContainer[0]/VLabel[0]</td> + <td>4. ValueChangeEvent, new value: null</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaTest.java b/uitest/src/com/vaadin/tests/components/textarea/TextAreaTest.java new file mode 100644 index 0000000000..e071bdd8fb --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaTest.java @@ -0,0 +1,45 @@ +package com.vaadin.tests.components.textarea; + +import java.util.LinkedHashMap; + +import com.vaadin.tests.components.abstractfield.AbstractTextFieldTest; +import com.vaadin.ui.TextArea; + +public class TextAreaTest extends AbstractTextFieldTest<TextArea> { + + private Command<TextArea, Boolean> wordwrapCommand = new Command<TextArea, Boolean>() { + @Override + public void execute(TextArea c, Boolean value, Object data) { + c.setWordwrap(value); + } + }; + + private Command<TextArea, Integer> rowsCommand = new Command<TextArea, Integer>() { + @Override + public void execute(TextArea c, Integer value, Object data) { + c.setRows(value); + } + }; + + @Override + protected Class<TextArea> getTestClass() { + return TextArea.class; + } + + @Override + protected void createActions() { + super.createActions(); + createWordwrapAction(CATEGORY_FEATURES); + createRowsAction(CATEGORY_FEATURES); + } + + private void createRowsAction(String category) { + LinkedHashMap<String, Integer> options = createIntegerOptions(20); + createSelectAction("Rows", category, options, "3", rowsCommand); + } + + private void createWordwrapAction(String category) { + createBooleanAction("Wordwrap", category, false, wordwrapCommand); + } + +} diff --git a/uitest/src/com/vaadin/tests/components/textarea/TextAreaWordwrap.html b/uitest/src/com/vaadin/tests/components/textarea/TextAreaWordwrap.html new file mode 100644 index 0000000000..43bb52b3e7 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/TextAreaWordwrap.html @@ -0,0 +1,56 @@ +<?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://artur-laptop.office.itmill.com: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.Wordwrap?restartApplication</td> + <td></td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-nowrap</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaWordwrap::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td> + <td>98,2</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaWordwrap::</td> + <td>396,331</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-wrap</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaWordwrap::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td> + <td>98,2</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runcomvaadintestscomponentstextareaWordwrap::/VVerticalLayout[0]/domChild[0]/domChild[0]</td> + <td>387,96</td> +</tr> +<tr> + <td>screenCapture</td> + <td></td> + <td>wrap-nowrap</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/textarea/Wordwrap.java b/uitest/src/com/vaadin/tests/components/textarea/Wordwrap.java new file mode 100644 index 0000000000..8672d4019e --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/textarea/Wordwrap.java @@ -0,0 +1,60 @@ +package com.vaadin.tests.components.textarea; + +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.tests.components.TestBase; +import com.vaadin.tests.util.LoremIpsum; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.TextArea; + +public class Wordwrap extends TestBase { + + @Override + public void setup() { + HorizontalLayout layout = new HorizontalLayout(); + + TextArea area1 = new TextArea("Wrapping"); + area1.setWordwrap(true); // The default + area1.setValue(LoremIpsum.get(50) + "\n" + "Another row"); + + final TextArea area2 = new TextArea("Nonwrapping"); + area2.setWordwrap(false); + area2.setValue(LoremIpsum.get(50) + "\n" + "Another row"); + + layout.addComponent(area1); + layout.addComponent(area2); + layout.setSpacing(true); + + addComponent(layout); + + CheckBox onoff = new CheckBox("Wrap state for the right field"); + onoff.setValue(false); + onoff.addListener(new Property.ValueChangeListener() { + @Override + public void valueChange(ValueChangeEvent event) { + boolean wrap = (Boolean) event.getProperty().getValue(); + area2.setWordwrap(wrap); + if (wrap) { + area2.setCaption("Wrapping"); + } else { + area2.setCaption("Nonwrapping"); + } + + } + }); + onoff.setImmediate(true); + + addComponent(onoff); + } + + @Override + protected String getDescription() { + return ""; + } + + @Override + protected Integer getTicketNumber() { + return 6003; + } +} |