summaryrefslogtreecommitdiffstats
path: root/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'uitest')
-rw-r--r--uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java66
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.html178
-rw-r--r--uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java181
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html179
-rw-r--r--uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java84
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.html57
-rw-r--r--uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java80
8 files changed, 796 insertions, 31 deletions
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java
new file mode 100644
index 0000000000..3c1e8a27d6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java
@@ -0,0 +1,66 @@
+package com.vaadin.tests.components.combobox;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.tests.util.Person;
+import com.vaadin.ui.AbstractSelect.ItemCaptionMode;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.ComboBox;
+
+public class ComboBoxDuplicateCaption extends TestBase {
+
+ private Log log = new Log(5);
+
+ @Override
+ protected void setup() {
+ List<Person> list = new ArrayList<Person>();
+ Person p1 = new Person();
+ p1.setFirstName("John");
+ p1.setLastName("Doe");
+ list.add(p1);
+
+ Person p2 = new Person();
+ p2.setFirstName("Jane");
+ p2.setLastName("Doe");
+ list.add(p2);
+
+ BeanItemContainer<Person> container = new BeanItemContainer<Person>(
+ Person.class);
+ container.addAll(list);
+
+ ComboBox box = new ComboBox("Duplicate captions test Box");
+ box.setId("ComboBox");
+ box.setImmediate(true);
+ box.addValueChangeListener(new ValueChangeListener() {
+
+ public void valueChange(
+ com.vaadin.data.Property.ValueChangeEvent event) {
+ Person p = (Person) event.getProperty().getValue();
+ log.log("Person = " + p.getFirstName() + " " + p.getLastName());
+ }
+ });
+ box.setContainerDataSource(container);
+ box.setItemCaptionMode(ItemCaptionMode.PROPERTY);
+ box.setItemCaptionPropertyId("lastName");
+
+ addComponent(log);
+
+ addComponent(box);
+ addComponent(new Button("Focus this"));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "VFilterSelects with duplicate item captions should not try to do a select (exact match search) for onBlur if not waitingForFilteringResponse";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10766;
+ }
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.html b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.html
new file mode 100644
index 0000000000..c2481e6be6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.html
@@ -0,0 +1,178 @@
+<?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:9999/" />
+<title>TableWithBrokenGeneratorAndContainer</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TableWithBrokenGeneratorAndContainer</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.TableWithBrokenGeneratorAndContainer?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td>item1/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
+ <td>item2/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>item3/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>Generated item1/Gen</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[4]/domChild[0]</td>
+ <td>Generated item2/Gen</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[4]/domChild[0]</td>
+ <td>Generated item3/Gen</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]</td>
+ <td>12,6</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<!--error indicator should be present-->
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>v-errorindicator</td>
+</tr>
+<!--error notification should not be present-->
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::Root/VNotification[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
+ <td>item2/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>item3/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td>Generated item1/Gen</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[4]/domChild[0]</td>
+ <td>Generated item2/Gen</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[4]/domChild[0]</td>
+ <td>Generated item3/Gen</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]</td>
+ <td>9,6</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<!--error indicator should be present-->
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td>v-errorindicator</td>
+</tr>
+<!--error notification should not be present-->
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::Root/VNotification[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td>
+ <td>item2/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>item3/prop1</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[4]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[4]/domChild[0]</td>
+ <td>Generated item2/Gen</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[4]/domChild[0]</td>
+ <td>Generated item3/Gen</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]</td>
+ <td>9,8</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[1]</td>
+ <td></td>
+</tr>
+<!--error notification-->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::Root/VNotification[0]/HTML[0]/domChild[0]</td>
+ <td>Problem updating table. Please try again later</td>
+</tr>
+<!--table should be empty-->
+<tr>
+ <td>assertElementNotPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableWithBrokenGeneratorAndContainer::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[4]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
new file mode 100644
index 0000000000..9c5ce9dc0c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.table;
+
+import java.lang.reflect.InvocationTargetException;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.event.ListenerMethod.MethodException;
+import com.vaadin.server.ErrorEvent;
+import com.vaadin.server.ErrorHandler;
+import com.vaadin.server.ServerRpcManager.RpcInvocationException;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.CacheUpdateException;
+import com.vaadin.ui.Table.ColumnGenerator;
+
+public class TableWithBrokenGeneratorAndContainer extends TestBase {
+
+ private CheckBox brokenContainer = new CheckBox("Broken container");
+ private CheckBox brokenGenerator = new CheckBox("Broken generator");
+ private CheckBox clearTableOnError = new CheckBox("Clear Table on Error");
+
+ /**
+ * Container which throws an exception on every fifth call to
+ * {@link #getContainerProperty(Object, Object)}.
+ *
+ * @author Vaadin Ltd
+ * @version @VERSION@
+ * @since 7.0
+ *
+ */
+ public class BrokenContainer extends IndexedContainer {
+ private int counter = 0;
+
+ public BrokenContainer() {
+ super();
+ }
+
+ @Override
+ public Property getContainerProperty(Object itemId, Object propertyId) {
+ if (counter++ % 5 == 0
+ && Boolean.TRUE.equals(brokenContainer.getValue())) {
+ throw new RuntimeException(getClass().getSimpleName()
+ + " cannot fetch the property for " + itemId + "/"
+ + propertyId + " right now");
+ }
+ return super.getContainerProperty(itemId, propertyId);
+ }
+ }
+
+ public class BrokenColumnGenerator implements ColumnGenerator {
+ private int brokenInterval;
+ private int counter = 0;
+
+ public BrokenColumnGenerator(int brokenInterval) {
+ this.brokenInterval = brokenInterval;
+ }
+
+ public Object generateCell(Table source, Object itemId, Object columnId) {
+ if (counter++ % brokenInterval == 0
+ && Boolean.TRUE.equals(brokenGenerator.getValue())) {
+ throw new IllegalArgumentException("Broken generator for "
+ + itemId + "/" + columnId);
+ } else {
+ return "Generated " + itemId + "/" + columnId;
+ }
+ }
+
+ }
+
+ @Override
+ protected void setup() {
+ brokenContainer.setImmediate(true);
+ brokenGenerator.setImmediate(true);
+ clearTableOnError.setImmediate(true);
+ clearTableOnError.addValueChangeListener(new ValueChangeListener() {
+
+ public void valueChange(ValueChangeEvent event) {
+ Boolean value = clearTableOnError.getValue();
+ setErrorHandler(value != null ? value : false);
+ }
+ });
+ final Table table = new Table("Semi-broken table");
+ table.setContainerDataSource(createBrokenContainer(10, 4));
+ table.addGeneratedColumn("Gen", new BrokenColumnGenerator(4));
+ table.setPageLength(20);
+
+ Button refreshTableCache = new Button("Refresh table cache",
+ new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ table.markAsDirty();
+ table.refreshRowCache();
+ }
+ });
+ addComponent(refreshTableCache);
+ addComponent(brokenContainer);
+ addComponent(brokenGenerator);
+ addComponent(clearTableOnError);
+ addComponent(table);
+ }
+
+ protected void setErrorHandler(boolean enabled) {
+ if (enabled) {
+ VaadinSession.getCurrent().setErrorHandler(new ErrorHandler() {
+
+ @Override
+ public void error(ErrorEvent event) {
+ Throwable t = event.getThrowable();
+ if (t instanceof RpcInvocationException) {
+ t = t.getCause();
+ if (t instanceof InvocationTargetException) {
+ t = t.getCause();
+ if (t instanceof MethodException) {
+ t = t.getCause();
+ if (t instanceof CacheUpdateException) {
+ Table table = ((CacheUpdateException) t)
+ .getTable();
+ table.removeAllItems();
+ Notification
+ .show("Problem updating table. Please try again later",
+ Notification.Type.ERROR_MESSAGE);
+ }
+ }
+ }
+ }
+ }
+ });
+ } else {
+ VaadinSession.getCurrent().setErrorHandler(this);
+ }
+ }
+
+ private BrokenContainer createBrokenContainer(int rows, int cols) {
+ BrokenContainer container = new BrokenContainer();
+ for (int j = 1; j <= cols; j++) {
+ container.addContainerProperty("prop" + j, String.class, null);
+ }
+ for (int i = 1; i <= rows; i++) {
+ Item item = container.addItem("item" + i);
+ for (int j = 1; j <= cols; j++) {
+ item.getItemProperty("prop" + j).setValue(
+ "item" + i + "/prop" + j);
+ }
+ }
+ return container;
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 10312;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A Table should not show 'Internal Error' just because a column generator or container throws an exception during filling of the cache";
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html
new file mode 100644
index 0000000000..3aecf8bf97
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.html
@@ -0,0 +1,179 @@
+<?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>ValueAfterClearingContainer</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ValueAfterClearingContainer</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.ValueAfterClearingContainer?restartApplication</td>
+ <td></td>
+</tr>
+<!-- add items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<!-- verify selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>1. Value changed to 2</td>
+</tr>
+<!-- remove items from table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromTableButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>2. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>3. Value changed to 2</td>
+</tr>
+<!-- remove items from container -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>4. Table selection: 2</td>
+</tr>
+<!-- replace the items -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that selection still exists -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>5. Table selection: 2</td>
+</tr>
+<!-- remove items from container and sanitize the table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerAndSanitizeButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that sanitizing cleared the value -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>6. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>7. Value changed to 2</td>
+</tr>
+<!-- remove selected item from the table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromTableButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>8. Value changed to null</td>
+</tr>
+<!-- select new item and remove it from the container -->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>9. Value changed to 3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromContainer/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>10. Table selection: 3</td>
+</tr>
+<!-- verify the item has been removed -->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>11. Value changed to 4</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
index 93e7cafa99..f378c146ea 100644
--- a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
+++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
@@ -19,6 +19,8 @@ public class ValueAfterClearingContainer extends TestBase {
@Override
protected void setup() {
+ log.setId("log");
+ table.setId("table");
table.setSelectable(true);
table.addContainerProperty(PROPERTY_ID, Integer.class, null);
table.setImmediate(true);
@@ -33,6 +35,7 @@ public class ValueAfterClearingContainer extends TestBase {
addComponent(table);
final CheckBox multiselect = new CheckBox("Multiselect");
multiselect.setImmediate(true);
+ multiselect.setId("multiselect");
multiselect.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
@@ -41,48 +44,64 @@ public class ValueAfterClearingContainer extends TestBase {
}
});
addComponent(multiselect);
- addComponent(new Button("Add table items", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (!table.getItemIds().isEmpty()) {
- Notification.show("Only possible when the table is empty");
- return;
- } else {
- for (int i = 0; i < 5; i++) {
- table.addItem(new Object[] { Integer.valueOf(i) },
- Integer.valueOf(i));
+ Button addItemsButton = new Button("Add table items",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (!table.getItemIds().isEmpty()) {
+ Notification
+ .show("Only possible when the table is empty");
+ return;
+ } else {
+ for (int i = 0; i < 5; i++) {
+ table.addItem(
+ new Object[] { Integer.valueOf(i) },
+ Integer.valueOf(i));
+ }
+ }
}
- }
- }
- }));
+ });
+ addItemsButton.setId("addItemsButton");
+ addComponent(addItemsButton);
- addComponent(new Button("Show value", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- log.log("Table selection: " + table.getValue());
- }
- }));
-
- addComponent(new Button("Remove items from table",
+ Button showValueButton = new Button("Show value",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
+ log.log("Table selection: " + table.getValue());
+ }
+ });
+ showValueButton.setId("showValueButton");
+ addComponent(showValueButton);
+
+ Button removeItemsFromTableButton = new Button(
+ "Remove items from table", new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
table.removeAllItems();
}
- }));
+ });
+ removeItemsFromTableButton.setId("removeItemsFromTableButton");
+ addComponent(removeItemsFromTableButton);
- addComponent(new Button("Remove items from container",
- new Button.ClickListener() {
+ Button removeItemsFromContainerButton = new Button(
+ "Remove items from container", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
table.getContainerDataSource().removeAllItems();
}
- }));
- addComponent(new Button("Remove items from container and sanitize",
+ });
+ removeItemsFromContainerButton.setId("removeItemsFromContainerButton");
+ addComponent(removeItemsFromContainerButton);
+ Button removeItemsFromContainerAndSanitizeButton = new Button(
+ "Remove items from container and sanitize",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
table.getContainerDataSource().removeAllItems();
table.sanitizeSelection();
}
- }));
- addComponent(new Button("Remove selected item from table",
- new Button.ClickListener() {
+ });
+ removeItemsFromContainerAndSanitizeButton
+ .setId("removeItemsFromContainerAndSanitizeButton");
+ addComponent(removeItemsFromContainerAndSanitizeButton);
+ Button removeSelectedFromTableButton = new Button(
+ "Remove selected item from table", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Object selection = table.getValue();
if (selection == null) {
@@ -92,8 +111,11 @@ public class ValueAfterClearingContainer extends TestBase {
table.removeItem(selection);
}
}
- }));
- addComponent(new Button("Remove selected item from container",
+ });
+ removeSelectedFromTableButton.setId("removeSelectedFromTableButton");
+ addComponent(removeSelectedFromTableButton);
+ Button removeSelectedFromContainer = new Button(
+ "Remove selected item from container",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Object selection = table.getValue();
@@ -105,7 +127,9 @@ public class ValueAfterClearingContainer extends TestBase {
.removeItem(selection);
}
}
- }));
+ });
+ removeSelectedFromContainer.setId("removeSelectedFromContainer");
+ addComponent(removeSelectedFromContainer);
}
@Override
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.html b/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.html
new file mode 100644
index 0000000000..f1a54df714
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.html
@@ -0,0 +1,57 @@
+<?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>WrapTabSheetInTabSheet</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">WrapTabSheetInTabSheet</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.tabsheet.WrapTabSheetInTabSheet?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>verifyElementPresent</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstabsheetWrapTabSheetInTabSheet::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VTabsheet[0]/VTabsheetPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html> \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
index 7a676c63fb..1e56aa49a7 100644
--- a/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
@@ -16,7 +16,7 @@ public class WrapTabSheetInTabSheet extends TestBase {
addComponent(mainLayout);
Button b = new Button("Wrap main layout in a TabSheet");
- b.addListener(new Button.ClickListener() {
+ b.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
TabSheet tabsheet = new TabSheet();
diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java
new file mode 100644
index 0000000000..32f5c93bfd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java
@@ -0,0 +1,80 @@
+package com.vaadin.tests.components.upload;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Upload;
+import com.vaadin.ui.Upload.FinishedEvent;
+import com.vaadin.ui.Upload.Receiver;
+import com.vaadin.ui.Upload.StartedEvent;
+
+public class TestFileUploadSize extends TestBase implements Receiver {
+
+ private Label label = new Label("No finished uploads.");
+ private Label receivedSize = new Label("-");
+ private Label expectedSize = new Label("-");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ @Override
+ protected void setup() {
+ getLayout().setMargin(new MarginInfo(true, false, false, false));
+ getLayout().setSpacing(true);
+
+ Upload u = new Upload("Upload", new Upload.Receiver() {
+
+ public OutputStream receiveUpload(String filename, String mimeType) {
+ return baos;
+ }
+ });
+ u.setId("UPL");
+ u.addStartedListener(new Upload.StartedListener() {
+
+ public void uploadStarted(StartedEvent event) {
+ expectedSize.setValue(String.valueOf(event.getContentLength()));
+ }
+ });
+ u.addFinishedListener(new Upload.FinishedListener() {
+
+ public void uploadFinished(FinishedEvent event) {
+ label.setValue("Upload finished. Name: " + event.getFilename());
+ receivedSize.setValue(String.valueOf(baos.size()));
+ baos.reset();
+ }
+ });
+
+ expectedSize.setId("expected");
+ receivedSize.setId("received");
+
+ GridLayout grid = new GridLayout(2, 2);
+ grid.addComponent(new Label("Expected size:"), 0, 0);
+ grid.addComponent(new Label("Received size:"), 0, 1);
+ grid.addComponent(expectedSize, 1, 0);
+ grid.addComponent(receivedSize, 1, 1);
+
+ addComponent(label);
+ addComponent(grid);
+ addComponent(u);
+ }
+
+ public OutputStream receiveUpload(String filename, String MIMEType) {
+ Notification.show("Receiving upload");
+ return new ByteArrayOutputStream();
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9548;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Multibyte characters in filenames should not cause the upload size to be computed incorrectly";
+ }
+
+}