summaryrefslogtreecommitdiffstats
path: root/uitest/src/com/vaadin/tests/components/richtextarea
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
committerArtur Signell <artur@vaadin.com>2012-08-30 17:24:36 +0300
commit7b25b3886ea95bc6495506fbe9472e45fcbde684 (patch)
tree0b93cb65dab437feb46720659a63b8f1ef48f7f4 /uitest/src/com/vaadin/tests/components/richtextarea
parent8941056349e302e687e40e94c13709e75f256d73 (diff)
downloadvaadin-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/richtextarea')
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html27
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java57
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html32
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java44
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java56
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java83
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.html51
-rw-r--r--uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.java40
8 files changed, 390 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html
new file mode 100644
index 0000000000..be1c5a2cde
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.html
@@ -0,0 +1,27 @@
+<?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>RichTextAreaScrolling</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">RichTextAreaScrolling</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.richtextarea.RichTextAreaScrolling?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java
new file mode 100644
index 0000000000..f88ed0c67c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaScrolling.java
@@ -0,0 +1,57 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
+
+public class RichTextAreaScrolling extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "A read-only RichTextArea should be (touch) scrollable";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7036;
+ }
+
+ @Override
+ protected void setup() {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < 50; ++i) {
+ sb.append("A long string with several lines<br/>");
+ }
+
+ HorizontalLayout main = new HorizontalLayout();
+ main.setSpacing(true);
+ addComponent(main);
+
+ RichTextArea first = new RichTextArea("Defined height");
+ RichTextArea second = new RichTextArea("Full height");
+ RichTextArea third = new RichTextArea("Undefined height");
+
+ first.setValue(sb);
+ second.setValue(sb);
+ third.setValue(sb);
+
+ first.setReadOnly(true);
+ second.setReadOnly(true);
+ third.setReadOnly(true);
+
+ first.setWidth("200px");
+ first.setHeight("400px");
+ second.setSizeFull();
+ third.setSizeUndefined();
+
+ VerticalLayout secondLayout = new VerticalLayout();
+ secondLayout.setWidth("200px");
+ secondLayout.setHeight("200px");
+ secondLayout.addComponent(second);
+
+ main.addComponent(first);
+ main.addComponent(secondLayout);
+ main.addComponent(third);
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html
new file mode 100644
index 0000000000..7708c88e54
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.html
@@ -0,0 +1,32 @@
+<?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>RichTextAreaSize</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">RichTextAreaSize</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.richtextarea.RichTextAreaSize</td>
+ <td></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/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java
new file mode 100644
index 0000000000..934f2ed2dd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaSize.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.VerticalLayout;
+
+public class RichTextAreaSize extends TestBase {
+
+ @Override
+ protected String getDescription() {
+ return "Test the size of a rich text area. The first area is 100px*100px wide, the second 100%*100% (of 200x200px), the third one has undefined width and height.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 2573;
+ }
+
+ @Override
+ protected void setup() {
+ HorizontalLayout main = new HorizontalLayout();
+ getMainWindow().setContent(main);
+
+ RichTextArea first = new RichTextArea();
+ RichTextArea second = new RichTextArea();
+ RichTextArea third = new RichTextArea();
+
+ first.setWidth("150px");
+ first.setHeight("400px");
+ second.setSizeFull();
+ third.setSizeUndefined();
+
+ VerticalLayout secondLayout = new VerticalLayout();
+ secondLayout.setWidth("200px");
+ secondLayout.setHeight("200px");
+ secondLayout.addComponent(second);
+
+ main.addComponent(first);
+ main.addComponent(secondLayout);
+ main.addComponent(third);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java
new file mode 100644
index 0000000000..4155dd8a07
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaTest.java
@@ -0,0 +1,56 @@
+package com.vaadin.tests.components.richtextarea;
+
+import java.util.LinkedHashMap;
+
+import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
+import com.vaadin.ui.RichTextArea;
+
+public class RichTextAreaTest extends AbstractFieldTest<RichTextArea> {
+
+ @Override
+ protected Class<RichTextArea> getTestClass() {
+ return RichTextArea.class;
+ }
+
+ private Command<RichTextArea, Boolean> nullSelectionAllowedCommand = new Command<RichTextArea, Boolean>() {
+
+ @Override
+ public void execute(RichTextArea c, Boolean value, Object data) {
+ c.setNullSettingAllowed(value);
+
+ }
+ };
+ private Command<RichTextArea, String> nullRepresentationCommand = new Command<RichTextArea, String>() {
+
+ @Override
+ public void execute(RichTextArea c, String value, Object data) {
+ c.setNullRepresentation(value);
+ }
+ };
+
+ @Override
+ protected void createActions() {
+ super.createActions();
+
+ createSetTextValueAction(CATEGORY_ACTIONS);
+
+ createNullSettingAllowedAction(CATEGORY_FEATURES);
+ createNullRepresentationAction(CATEGORY_FEATURES);
+ }
+
+ private void createNullSettingAllowedAction(String category) {
+ createBooleanAction("Null selection allowed", category, true,
+ nullSelectionAllowedCommand);
+ }
+
+ private void createNullRepresentationAction(String category) {
+ LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+ options.put("-", null);
+ options.put("null", "null");
+ options.put("This is empty", "This is empty");
+ options.put("- Nothing -", "- Nothing -");
+ createSelectAction("Null representation", category, options, "null",
+ nullRepresentationCommand);
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
new file mode 100644
index 0000000000..e775bf6aca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaWithKeyboardShortcuts.java
@@ -0,0 +1,83 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.ShortcutAction;
+import com.vaadin.server.Page;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.RichTextArea;
+import com.vaadin.ui.Window;
+
+@SuppressWarnings("serial")
+public class RichTextAreaWithKeyboardShortcuts extends TestBase {
+
+ private Handler actionHandler = new Handler() {
+
+ ShortcutAction save = new ShortcutAction("^Save");
+ private Action[] actions = new Action[] { save };
+
+ @Override
+ public void handleAction(Action action, Object sender, Object target) {
+ String msg = "Action: " + action.getCaption();
+ msg += " From : " + sender.getClass().getSimpleName() + " '"
+ + ((Component) sender).getCaption() + "'";
+
+ AbstractField<String> f = (AbstractField<String>) target;
+ msg += " Target:" + target.getClass().getSimpleName() + " '"
+ + f.getCaption() + "'";
+
+ String string = f.getValue().toString();
+
+ msg += " Value: " + string;
+ Notification notification = new Notification(msg);
+ notification.setHtmlContentAllowed(true);
+ notification.show(Page.getCurrent());
+
+ }
+
+ @Override
+ public Action[] getActions(Object target, Object sender) {
+ return actions;
+ }
+ };
+
+ @Override
+ protected void setup() {
+
+ getLayout().getUI().addActionHandler(actionHandler);
+ getLayout().addComponent(createRichTextArea("InMainLayout"));
+
+ Panel panel = new Panel("RTA Panel");
+ panel.addActionHandler(actionHandler);
+ panel.getContent().addComponent(createRichTextArea("InPanel"));
+ getLayout().addComponent(panel);
+
+ Window w = new Window("SubWindow");
+ w.addActionHandler(actionHandler);
+ w.addComponent(createRichTextArea("InSubWindow"));
+ w.getContent().setSizeUndefined();
+
+ getLayout().getUI().addWindow(w);
+
+ }
+
+ private RichTextArea createRichTextArea(String caption) {
+ RichTextArea rta = new RichTextArea(caption);
+ return rta;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "RichTextArea shouls support shortcut actions just like other components do.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 4175;
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.html
new file mode 100644
index 0000000000..7d96b4185f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.html
@@ -0,0 +1,51 @@
+<?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.richtextarea.RichTextAreas?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>enabled</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsrichtextareaRichTextAreas::PID_Scheckboxaction-Error indicators/domChild[0]</td>
+ <td>68,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsrichtextareaRichTextAreas::PID_Scheckboxaction-Required/domChild[0]</td>
+ <td>23,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>error-required</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsrichtextareaRichTextAreas::PID_Scheckboxaction-Readonly/domChild[0]</td>
+ <td>34,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>error-required-readonly</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.java
new file mode 100644
index 0000000000..8585d19bc2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreas.java
@@ -0,0 +1,40 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.tests.components.ComponentTestCase;
+import com.vaadin.ui.RichTextArea;
+
+public class RichTextAreas extends ComponentTestCase<RichTextArea> {
+
+ @Override
+ protected Class<RichTextArea> getTestClass() {
+ return RichTextArea.class;
+ }
+
+ @Override
+ protected void initializeComponents() {
+ RichTextArea rta;
+
+ rta = createRichTextArea("TextField 100% wide, 100px high");
+ rta.setWidth("100%");
+ rta.setHeight("100px");
+ addTestComponent(rta);
+
+ rta = createRichTextArea("TextField auto width, auto height");
+ addTestComponent(rta);
+
+ rta = createRichTextArea(null, "500px wide, 120px high textfield");
+ rta.setWidth("500px");
+ rta.setHeight("120px");
+ addTestComponent(rta);
+
+ }
+
+ private RichTextArea createRichTextArea(String caption, String value) {
+ return new RichTextArea(caption, value);
+ }
+
+ private RichTextArea createRichTextArea(String caption) {
+ return new RichTextArea(caption);
+ }
+
+}