summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2012-01-27 15:00:22 +0200
committerArtur Signell <artur@vaadin.com>2012-01-27 15:00:22 +0200
commitabaf86ae9baeae094687cc289990ddeec4979c94 (patch)
tree25a44d44d7c22e9e46e8afb41831099c4ad061e5 /tests
parentcf138e29f13358a70c9b58c2f11728387f6747e1 (diff)
parent8cc1ee0aa018012e6644723860a353d41d6af7f8 (diff)
downloadvaadin-framework-abaf86ae9baeae094687cc289990ddeec4979c94.tar.gz
vaadin-framework-abaf86ae9baeae094687cc289990ddeec4979c94.zip
Merge branch 'master' into contrib
Diffstat (limited to 'tests')
-rw-r--r--tests/integration_base_files/lock_age.sh2
-rw-r--r--tests/integration_tests.xml190
-rw-r--r--tests/server-side/com/vaadin/tests/VaadinClasses.java (renamed from tests/testbench/com/vaadin/tests/VaadinClasses.java)9
-rw-r--r--tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java84
-rw-r--r--tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java34
-rw-r--r--tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java34
-rw-r--r--tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java34
-rw-r--r--tests/test.xml2
-rw-r--r--tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java127
-rw-r--r--tests/testbench/com/vaadin/tests/Components.java17
-rw-r--r--tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html6
-rw-r--r--tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html32
-rw-r--r--tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java33
-rw-r--r--tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html51
-rw-r--r--tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java44
-rw-r--r--tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html46
-rw-r--r--tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java55
-rw-r--r--tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html102
-rw-r--r--tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java179
-rw-r--r--tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html211
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java88
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java10
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisibile.java43
-rw-r--r--tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisible.html42
-rw-r--r--tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java42
-rw-r--r--tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java54
-rw-r--r--tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java59
27 files changed, 1513 insertions, 117 deletions
diff --git a/tests/integration_base_files/lock_age.sh b/tests/integration_base_files/lock_age.sh
index 6b78acb590..115a8fef79 100644
--- a/tests/integration_base_files/lock_age.sh
+++ b/tests/integration_base_files/lock_age.sh
@@ -8,7 +8,7 @@ if lockfile -r0 -! /home/integration/deploy/lock.file &> /dev/null
AGE=$[($DATE - $LOCK_AGE)/60]
- if [ "$AGE" -gt "15" ]
+ if [ "$AGE" -gt "20" ]
then
echo lock.file is $AGE min old.
./cleanup.sh
diff --git a/tests/integration_tests.xml b/tests/integration_tests.xml
index 60e4882044..1b37347ddd 100644
--- a/tests/integration_tests.xml
+++ b/tests/integration_tests.xml
@@ -7,20 +7,20 @@
<import file="../build/common.xml" />
<!-- Target deploying demo.war -->
- <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run"/>
-
- <fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run"/>
- <fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run"/>
+ <fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" />
+
+ <fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" />
+ <fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" />
<!-- Test with these browsers -->
<property name="test_browsers" value="winxp-firefox9" />
<!-- Path to key file. Default value -->
<property name="sshkey.file" value="id_dsa" />
-
+
<!-- path and name for demo.war to be deployed -->
- <property name="demo.war" value="demo.war"/>
-
+ <property name="demo.war" value="demo.war" />
+
<!-- Host running Testbench RC or Testbench Hub. Default value -->
<property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />
@@ -36,7 +36,7 @@
<target name="integration-test-upload-demo">
<scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
</target>
-
+
<!-- Run basic integration test test -->
<target name="integration-test-servlet">
<fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-servlet.html" />
@@ -50,11 +50,11 @@
<property name="testfiles" value="${testfiles}" />
<property name="test-output-dir" value="../build/integration-test-output/${server-name}" />
<property name="retries" value="0" />
-
+
<fileset dir="." includes="test.xml" />
</subant>
</target>
-
+
<target name="integration-test-theme">
<subant target="run-tests" failonerror="false" antfile="test.xml">
<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
@@ -63,16 +63,16 @@
<property name="server.start.succeeded" value="1" />
<property name="testfiles" value="${testfiles-theme}" />
<property name="test-output-dir" value="../build/integration-test-output/${server-name}" />
-
+
<fileset dir="." includes="test.xml" />
</subant>
</target>
-
+
<!-- Run integration test on GAE -->
<target name="integration-test-test-GAE">
<fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" />
<pathconvert pathsep=" " property="test-GAE" refid="html-test-files" />
-
+
<subant target="run-tests" failonerror="false" antfile="test.xml">
<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
@@ -81,119 +81,123 @@
<property name="browsers" value="${test_browsers}" />
<property name="testfiles" value="${test-GAE}" />
<property name="test-output-dir" value="../build/integration-test-gae-output" />
-
+
<fileset dir="." includes="test.xml" />
</subant>
</target>
-
+
<target name="integration-test-deploy-to-GAE">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
</target>
-
-
+
+
<target name="integration-test-tomcat7">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="tomcat7" />
</antcall>
</target>
-
<target name="integration-test-tomcat5">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="tomcat5" />
</antcall>
- </target>
-
+ </target>
+
<target name="integration-test-tomcat6">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="tomcat6" />
</antcall>
- </target>
-
+ </target>
+
<target name="integration-test-jetty5">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
<param name="target-server" value="jetty5" />
</antcall>
</target>
-
+
<target name="integration-test-jetty6">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
<param name="target-server" value="jetty6" />
</antcall>
</target>
-
+
<target name="integration-test-jetty7">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
<param name="target-server" value="jetty7" />
</antcall>
</target>
-
+
+ <target name="integration-test-jetty8">
+ <antcall target="run-generic-integration-test">
+ <param name="target-server" value="jetty8" />
+ </antcall>
+ </target>
+
<target name="integration-test-jboss4">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="jboss4" />
</antcall>
</target>
-
+
<target name="integration-test-jboss5">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="jboss5" />
</antcall>
</target>
-
+
<target name="integration-test-jboss6">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="jboss6" />
</antcall>
</target>
-
+
<target name="integration-test-jboss7">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="jboss7" />
</antcall>
</target>
-
+
<target name="integration-test-glassfish2">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="glassfish2" />
</antcall>
</target>
-
+
<target name="integration-test-glassfish3">
<antcall target="run-generic-integration-test">
- <param name="startDelay" value="300" />
+ <param name="startDelay" value="10" />
<param name="target-server" value="glassfish3" />
</antcall>
</target>
-
-
+
+
<target name="integration-test-liferay6">
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
+
<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
-
-
+
+
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-server" value="liferay6" />
</antcall>
</target>
-
+
<target name="integration-test-liferay5">
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
+
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-server" value="liferay5" />
</antcall>
</target>
@@ -201,65 +205,77 @@
<target name="integration-test-liferay6ee">
<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
+
<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" />
<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
-
+
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-server" value="liferay6ee" />
- </antcall>
+ </antcall>
</target>
-
+
<target name="integration-test-gatein3">
<fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="test_browsers" value="winxp-firefox36" />
<param name="target-server" value="gatein3" />
</antcall>
</target>
-
+
<target name="integration-test-exo3">
<fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="test_browsers" value="winxp-firefox36" />
<param name="target-server" value="exo3" />
</antcall>
</target>
-
+
<target name="integration-test-weblogic9">
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-port" value="7001" />
<param name="target-server" value="weblogic9" />
</antcall>
</target>
-
+
<target name="integration-test-weblogic10">
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-port" value="7001" />
<param name="target-server" value="weblogic10" />
</antcall>
</target>
-
-
+
+ <target name="integration-test-weblogic12">
+ <antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
+ <param name="target-port" value="7001" />
+ <param name="target-server" value="weblogic12" />
+ </antcall>
+ </target>
+
<target name="integration-test-weblogicPortal">
<fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
<antcall target="run-generic-integration-test">
+ <param name="startDelay" value="600" />
<param name="target-port" value="7001" />
<param name="target-server" value="weblogicportal" />
</antcall>
</target>
-
+
<target name="integration-test-GAE">
- <antcall target="integration-test-deploy-to-GAE"/>
+ <antcall target="integration-test-deploy-to-GAE" />
<antcall target="integration-test-test-GAE" />
</target>
-
+
<!-- Upload demo, clean error screenshots and test deployment on all servers -->
<target name="integration-test-all" depends="common.init-deps">
-
<parallel>
<antcontrib:trycatch property="tried">
<try>
@@ -268,22 +284,21 @@
<antcall target="integration-test-get-lock" />
<echo message="Got lock" />
<antcall target="integration-test-upload-demo" />
-
+
<antcall target="run-integration-test">
- <param name="target-server" value="GAE"/>
+ <param name="target-server" value="GAE" />
</antcall>
-
+
<antcall target="integration-test-clean" />
<echo message="Getting lock" />
<antcall target="integration-test-release-lock" />
<echo message="Lock released" />
-
+
</try>
<catch>
<echo message="Uploading of demo.war failed. ${tried}" />
</catch>
</antcontrib:trycatch>
-
<antcall target="integration-test-liferay6" />
<antcall target="integration-test-liferay6ee" />
<antcall target="integration-test-exo3" />
@@ -291,6 +306,7 @@
<antcall target="integration-test-liferay5" />
<antcall target="integration-test-weblogic9" />
<antcall target="integration-test-weblogic10" />
+ <antcall target="integration-test-weblogic12" />
<antcall target="integration-test-gatein3" />
<antcall target="integration-test-glassfish2" />
<antcall target="integration-test-glassfish3" />
@@ -301,26 +317,26 @@
<antcall target="integration-test-jetty5" />
<antcall target="integration-test-jetty6" />
<antcall target="integration-test-jetty7" />
+ <antcall target="integration-test-jetty8" />
<antcall target="integration-test-tomcat5" />
<antcall target="integration-test-tomcat6" />
<antcall target="integration-test-tomcat7" />
-
+
</parallel>
-
+
</target>
-
+
<target name="do-run-generic-test">
<property name="target-host" value="${target-server}.devnet.vaadin.com" />
<property name="target-port" value="8080" />
-
<antcontrib:if>
<isset property="startDelay" />
<then>
<antcontrib:math result="sleepTime" datatype="int">
<op op="rint">
<op op="*">
- <num value="${startDelay}"/>
- <op op="random"/>
+ <num value="${startDelay}" />
+ <op op="random" />
</op>
</op>
</antcontrib:math>
@@ -334,7 +350,7 @@
<include name="*" />
</fileset>
</scp>
-
+
<!-- trycatch probably not needed any more as it just fails with the original message and doesn't do anything in the finally block -->
<antcontrib:trycatch property="error_message">
<try>
@@ -346,14 +362,14 @@
</antcall>
<scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
-
+
<!-- timeout in 15 minutes -->
<sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" />
<antcall target="echo-prefix">
<param name="prefix" value="${target-server}: " />
<param name="message" value="${start-output}" />
</antcall>
-
+
<fail message="${start-output}">
<condition>
<not>
@@ -367,7 +383,7 @@
<param name="server-name" value="${target-server}" />
<param name="deployment.url" value="http://${target-host}:${target-port}" />
</antcall>
-
+
<!-- Run theme tests in all browsers if there's a property with the test files -->
<antcontrib:if>
<isset property="testfiles-theme" />
@@ -380,7 +396,7 @@
</antcontrib:if>
<!-- timeout in five minutes -->
- <sshexec host="${target-host}" outputproperty="stop-output" timeout="300000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" />
+ <sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" />
<antcall target="echo-prefix">
<param name="prefix" value="${target-server}: " />
<param name="message" value="${stop-output}" />
@@ -391,12 +407,12 @@
</catch>
</antcontrib:trycatch>
</target>
-
+
<target name="echo-prefix">
<antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
<echo message="${message-prefixed}" />
</target>
-
+
<target name="run-generic-integration-test">
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
<antcontrib:trycatch property="tried">
@@ -412,20 +428,20 @@
</catch>
</antcontrib:trycatch>
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
- </target>
+ </target>
<target name="teamcity-escape">
<property name="returnTo" value="return" />
-
+
<!-- Should also perform other escaping (\u0085, \u2028 and \u2029) - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
<!-- Immutable properties -> needs to create a new one every time -->
<antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
<antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
<antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
-
+
<property name="${returnTo}" value="${details-escaped3}" />
</target>
-
+
<target name="run-integration-test">
<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
<antcontrib:trycatch property="tried">
@@ -442,15 +458,15 @@
</antcontrib:trycatch>
<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
</target>
-
+
<target name="integration-test-get-lock">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
</target>
-
+
<target name="integration-test-release-lock">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
</target>
-
+
<!-- Remove demo.war -->
<target name="integration-test-clean">
<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
diff --git a/tests/testbench/com/vaadin/tests/VaadinClasses.java b/tests/server-side/com/vaadin/tests/VaadinClasses.java
index cb430d9e3a..707fc020b6 100644
--- a/tests/testbench/com/vaadin/tests/VaadinClasses.java
+++ b/tests/server-side/com/vaadin/tests/VaadinClasses.java
@@ -18,7 +18,6 @@ import java.util.jar.JarEntry;
import org.junit.Test;
import com.vaadin.Application;
-import com.vaadin.tests.components.AbstractComponentTest;
import com.vaadin.ui.Component;
import com.vaadin.ui.ComponentContainer;
import com.vaadin.ui.CustomComponent;
@@ -115,11 +114,13 @@ public class VaadinClasses {
}
@SuppressWarnings({ "unchecked", "rawtypes" })
- public static List<Class<? extends AbstractComponentTest<?>>> getBasicComponentTests() {
+ public static List<Class<?>> getBasicComponentTests() {
try {
- return (List) findClasses(AbstractComponentTest.class,
+ // Given as name to avoid dependencies on testbench source folder
+ return (List) findClasses(
+ Class.forName("com.vaadin.tests.components.AbstractComponentTest"),
"com.vaadin.tests.components");
- } catch (IOException e) {
+ } catch (Exception e) {
e.printStackTrace();
return null;
}
diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java
new file mode 100644
index 0000000000..9271e9f1b3
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/AbstractIndexedLayoutTest.java
@@ -0,0 +1,84 @@
+package com.vaadin.tests.server.componentcontainer;
+
+import junit.framework.TestCase;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+
+public abstract class AbstractIndexedLayoutTest extends TestCase {
+
+ private Layout layout;
+
+ protected abstract Layout createLayout();
+
+ @Override
+ protected void setUp() throws Exception {
+ layout = createLayout();
+ }
+
+ public Layout getLayout() {
+ return layout;
+ }
+
+ public void testAddRemoveComponent() {
+ Label c1 = new Label();
+ Label c2 = new Label();
+
+ layout.addComponent(c1);
+
+ assertEquals(c1, getComponent(0));
+ assertEquals(1, getComponentCount());
+ layout.addComponent(c2);
+ assertEquals(c1, getComponent(0));
+ assertEquals(c2, getComponent(1));
+ assertEquals(2, getComponentCount());
+ layout.removeComponent(c1);
+ assertEquals(c2, getComponent(0));
+ assertEquals(1, getComponentCount());
+ layout.removeComponent(c2);
+ assertEquals(0, getComponentCount());
+ }
+
+ protected abstract int getComponentCount();
+
+ protected abstract Component getComponent(int index);
+
+ protected abstract int getComponentIndex(Component c);
+
+ public void testGetComponentIndex() {
+ Label c1 = new Label();
+ Label c2 = new Label();
+
+ layout.addComponent(c1);
+ assertEquals(0, getComponentIndex(c1));
+ layout.addComponent(c2);
+ assertEquals(0, getComponentIndex(c1));
+ assertEquals(1, getComponentIndex(c2));
+ layout.removeComponent(c1);
+ assertEquals(0, getComponentIndex(c2));
+ layout.removeComponent(c2);
+ assertEquals(-1, getComponentIndex(c2));
+ assertEquals(-1, getComponentIndex(c1));
+ }
+
+ public void testGetComponent() {
+ Label c1 = new Label();
+ Label c2 = new Label();
+
+ layout.addComponent(c1);
+ assertEquals(c1, getComponent(0));
+ layout.addComponent(c2);
+ assertEquals(c1, getComponent(0));
+ assertEquals(c2, getComponent(1));
+ layout.removeComponent(c1);
+ assertEquals(c2, getComponent(0));
+ layout.removeComponent(c2);
+ try {
+ getComponent(0);
+ fail();
+ } catch (IndexOutOfBoundsException e) {
+ // Expected
+ }
+ }
+}
diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java
new file mode 100644
index 0000000000..dc9667c38e
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/CssLayoutTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.server.componentcontainer;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.Layout;
+
+public class CssLayoutTest extends AbstractIndexedLayoutTest {
+
+ @Override
+ protected Layout createLayout() {
+ return new CssLayout();
+ }
+
+ @Override
+ public CssLayout getLayout() {
+ return (CssLayout) super.getLayout();
+ }
+
+ @Override
+ protected Component getComponent(int index) {
+ return getLayout().getComponent(index);
+ }
+
+ @Override
+ protected int getComponentIndex(Component c) {
+ return getLayout().getComponentIndex(c);
+ }
+
+ @Override
+ protected int getComponentCount() {
+ return getLayout().getComponentCount();
+ }
+
+}
diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
new file mode 100644
index 0000000000..71a813d423
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/FormLayoutTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.server.componentcontainer;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.Layout;
+
+public class FormLayoutTest extends AbstractIndexedLayoutTest {
+
+ @Override
+ protected Layout createLayout() {
+ return new FormLayout();
+ }
+
+ @Override
+ public FormLayout getLayout() {
+ return (FormLayout) super.getLayout();
+ }
+
+ @Override
+ protected Component getComponent(int index) {
+ return getLayout().getComponent(index);
+ }
+
+ @Override
+ protected int getComponentIndex(Component c) {
+ return getLayout().getComponentIndex(c);
+ }
+
+ @Override
+ protected int getComponentCount() {
+ return getLayout().getComponentCount();
+ }
+
+}
diff --git a/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java b/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java
new file mode 100644
index 0000000000..0e3a1d5734
--- /dev/null
+++ b/tests/server-side/com/vaadin/tests/server/componentcontainer/VerticalLayoutTest.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.server.componentcontainer;
+
+import com.vaadin.ui.Component;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.VerticalLayout;
+
+public class VerticalLayoutTest extends AbstractIndexedLayoutTest {
+
+ @Override
+ protected Layout createLayout() {
+ return new VerticalLayout();
+ }
+
+ @Override
+ public VerticalLayout getLayout() {
+ return (VerticalLayout) super.getLayout();
+ }
+
+ @Override
+ protected Component getComponent(int index) {
+ return getLayout().getComponent(index);
+ }
+
+ @Override
+ protected int getComponentIndex(Component c) {
+ return getLayout().getComponentIndex(c);
+ }
+
+ @Override
+ protected int getComponentCount() {
+ return getLayout().getComponentCount();
+ }
+
+}
diff --git a/tests/test.xml b/tests/test.xml
index d4a8f5918c..9d060c9a29 100644
--- a/tests/test.xml
+++ b/tests/test.xml
@@ -94,7 +94,7 @@
<include name="**/**.java" />
</fileset>
- <antcontrib:for threadCount="40" parallel="true" keepgoing="true" param="target">
+ <antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target">
<path>
<fileset refid="tests-fileset" />
</path>
diff --git a/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java b/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java
new file mode 100644
index 0000000000..55692cb251
--- /dev/null
+++ b/tests/testbench/com/vaadin/launcher/util/BrowserLauncher.java
@@ -0,0 +1,127 @@
+/*
+@VaadinApache2LicenseForJavaFiles@
+ */
+
+package com.vaadin.launcher.util;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+/**
+ * This class opens default browser for DemoLauncher class. Default browser is
+ * detected by the operating system.
+ *
+ */
+public class BrowserLauncher {
+
+ /**
+ * Open browser on specified URL.
+ *
+ * @param url
+ */
+ public static void openBrowser(String url) {
+
+ final Runtime runtime = Runtime.getRuntime();
+ boolean started = false;
+
+ final String os = System.getProperty("os.name", "windows")
+ .toLowerCase();
+
+ // Linux
+ if (os.indexOf("linux") >= 0) {
+ // See if the default browser is Konqueror by resolving the symlink.
+ boolean isDefaultKonqueror = false;
+ try {
+ // Find out the location of the x-www-browser link from path.
+ Process process = runtime.exec("which x-www-browser");
+ BufferedInputStream ins = new BufferedInputStream(
+ process.getInputStream());
+ BufferedReader bufreader = new BufferedReader(
+ new InputStreamReader(ins));
+ String defaultLinkPath = bufreader.readLine();
+ ins.close();
+
+ // The path is null if the link did not exist.
+ if (defaultLinkPath != null) {
+ // See if the default browser is Konqueror.
+ File file = new File(defaultLinkPath);
+ String canonical = file.getCanonicalPath();
+ if (canonical.indexOf("konqueror") != -1) {
+ isDefaultKonqueror = true;
+ }
+ }
+ } catch (IOException e1) {
+ // The symlink was probably not found, so this is ok.
+ }
+
+ // Try x-www-browser, which is symlink to the default browser,
+ // except if we found that it is Konqueror.
+ if (!started && !isDefaultKonqueror) {
+ try {
+ runtime.exec("x-www-browser " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+
+ // Try firefox
+ if (!started) {
+ try {
+ runtime.exec("firefox " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+
+ // Try mozilla
+ if (!started) {
+ try {
+ runtime.exec("mozilla " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+
+ // Try konqueror
+ if (!started) {
+ try {
+ runtime.exec("konqueror " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+ }
+
+ // OS X
+ if (os.indexOf("mac os x") >= 0) {
+
+ // Try open
+ if (!started) {
+ try {
+ runtime.exec("open " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+ }
+
+ // Try cmd /start command on windows
+ if (os.indexOf("win") >= 0) {
+ if (!started) {
+ try {
+ runtime.exec("cmd /c start " + url);
+ started = true;
+ } catch (final IOException e) {
+ }
+ }
+ }
+
+ if (!started) {
+ System.out.println("Failed to open browser. Please go to " + url);
+ }
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/Components.java b/tests/testbench/com/vaadin/tests/Components.java
index 414c97c951..6bc6860607 100644
--- a/tests/testbench/com/vaadin/tests/Components.java
+++ b/tests/testbench/com/vaadin/tests/Components.java
@@ -33,7 +33,7 @@ import com.vaadin.ui.VerticalLayout;
public class Components extends Application.LegacyApplication {
private static final Object CAPTION = "c";
- private Map<Class<? extends AbstractComponentTest<?>>, String> tests = new HashMap<Class<? extends AbstractComponentTest<?>>, String>();
+ private Map<Class<? extends AbstractComponentTest>, String> tests = new HashMap<Class<? extends AbstractComponentTest>, String>();
private Tree naviTree;
private HorizontalSplitPanel sp;
private LegacyWindow mainWindow;
@@ -42,10 +42,9 @@ public class Components extends Application.LegacyApplication {
private List<Class<? extends Component>> componentsWithoutTests = new ArrayList<Class<? extends Component>>();
{
- for (Class<? extends AbstractComponentTest<?>> c : VaadinClasses
- .getBasicComponentTests()) {
+ for (Class<?> c : VaadinClasses.getBasicComponentTests()) {
String testClass = c.getSimpleName();
- tests.put(c, testClass);
+ tests.put((Class<? extends AbstractComponentTest>) c, testClass);
}
List<Class<? extends Component>> componentsWithoutTest = VaadinClasses
@@ -172,7 +171,7 @@ public class Components extends Application.LegacyApplication {
hc.setItemSorter(sorter);
naviTree.addContainerProperty(CAPTION, String.class, "");
naviTree.setItemCaptionPropertyId(CAPTION);
- for (Class<? extends AbstractComponentTest<?>> cls : tests.keySet()) {
+ for (Class<? extends AbstractComponentTest> cls : tests.keySet()) {
addTreeItem(cls);
}
hc.sort(new Object[] { CAPTION }, new boolean[] { true });
@@ -227,13 +226,13 @@ public class Components extends Application.LegacyApplication {
}
@SuppressWarnings("unchecked")
- private void addTreeItem(Class<? extends AbstractComponentTest<?>> cls) {
+ private void addTreeItem(Class<? extends AbstractComponentTest> cls) {
String name = tests.get(cls);
if (name == null) {
name = cls.getSimpleName();
}
- Class<? extends AbstractComponentTest<?>> superClass = (Class<? extends AbstractComponentTest<?>>) cls
+ Class<? extends AbstractComponentTest> superClass = (Class<? extends AbstractComponentTest>) cls
.getSuperclass();
// This cast is needed only to make compilation through Ant work ..
@@ -250,9 +249,9 @@ public class Components extends Application.LegacyApplication {
}
protected Component createTestComponent(
- Class<? extends AbstractComponentTest<?>> cls) {
+ Class<? extends AbstractComponentTest> cls) {
try {
- AbstractComponentTest<?> t = cls.newInstance();
+ AbstractComponentTest t = cls.newInstance();
t.init();
ComponentContainer c = t.getMainWindow().getContent();
t.getMainWindow().setContent(null);
diff --git a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html
index 6d18c60038..3ad7d62a09 100644
--- a/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html
+++ b/tests/testbench/com/vaadin/tests/components/combobox/ComboBoxIdenticalItems.html
@@ -102,11 +102,15 @@
<td>enter</td>
</tr>
<tr>
+ <td>pause</td>
+ <td>100</td>
+ <td></td>
+</tr>
+<tr>
<td>assertText</td>
<td>vaadin=runcomvaadintestscomponentscomboboxComboBoxIdenticalItems::PID_SLog_row_0</td>
<td>4. Item one-1 selected</td>
</tr>
-
</tbody></table>
</body>
</html>
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.html
new file mode 100644
index 0000000000..f367fc383b
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.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>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.datefield.DatePopupStyleName?&amp;restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDatePopupStyleName::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VPopupCalendar[0]#popupButton</td>
+ <td>4,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>styled-popup</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java
new file mode 100644
index 0000000000..ba4e324dc1
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/datefield/DatePopupStyleName.java
@@ -0,0 +1,33 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.terminal.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.DateField;
+
+public class DatePopupStyleName extends TestBase {
+ @Override
+ public void setup() {
+ setTheme("reindeer-tests");
+
+ final DateField df = new DateField();
+ df.setValue(new Date(1203910239L));
+ df.setWidth("200px");
+ df.setRequired(true);
+ df.setComponentError(new UserError("abc"));
+ df.addStyleName("popup-style");
+ addComponent(df);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The DateField is given a style name 'test', but that style isn't applied on the calendar popup element.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8083;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.html
new file mode 100644
index 0000000000..70441efd9f
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.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="" />
+<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.datefield.WidthRecalculationOnEnableStateChange?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/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>disabled</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/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>enabled</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldWidthRecalculationOnEnableStateChange::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>readonly</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java
new file mode 100644
index 0000000000..f25a9f0350
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/datefield/WidthRecalculationOnEnableStateChange.java
@@ -0,0 +1,44 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+
+public class WidthRecalculationOnEnableStateChange extends TestBase {
+ @Override
+ public void setup() {
+ setTheme("reindeer-tests");
+
+ final DateField df = new DateField();
+ df.setValue(new Date(1203910239L));
+ df.setWidth("200px");
+ df.addStyleName("enabled-readonly-styled");
+ addComponent(df);
+ addComponent(new Button("Toggle disabled for date field",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.setEnabled(!df.isEnabled());
+ }
+ }));
+ addComponent(new Button("Toggle read only for date field",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ df.setReadOnly(!df.isReadOnly());
+ }
+ }));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Setting the disabled state doesn't recalculate the input element width. Setting the read-only state instead recalculates the width. In both cases, the popup button is hidden using CSS.<br><br>The DateField is also given a style name 'test', but that style isn't applied on the calendar popup element.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8085;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html
new file mode 100644
index 0000000000..14b5cc4c53
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.html
@@ -0,0 +1,46 @@
+<?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.formlayout.FormLayoutCaptionStyles?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>v-caption-bold</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td>
+ <td>bold</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td>
+ <td>bold</td>
+</tr>
+<tr>
+ <td>assertNotCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsformlayoutFormLayoutCaptionStyles::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VFormLayout[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>v-caption-bold</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java
new file mode 100644
index 0000000000..e74969f637
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/formlayout/FormLayoutCaptionStyles.java
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.formlayout;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.TextField;
+
+public class FormLayoutCaptionStyles extends TestBase {
+
+ @Override
+ protected void setup() {
+ setTheme("reindeer-tests");
+ FormLayout fl = new FormLayout();
+
+ TextField f1 = createTextField("Text field 1", "");
+ final TextField f2 = createTextField("Text field 2", "bold");
+
+ fl.addComponent(f1);
+ fl.addComponent(new Button("Toggle Text field 2 bold style",
+ new Button.ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ if ("bold".equals(f2.getStyleName())) {
+ f2.setStyleName("");
+ } else {
+ f2.setStyleName("bold");
+ }
+
+ }
+
+ }));
+ fl.addComponent(f2);
+
+ addComponent(fl);
+
+ }
+
+ private TextField createTextField(String caption, String style) {
+ TextField tf = new TextField(caption);
+ tf.setStyleName(style);
+ return tf;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The component style should be copied to the caption element. Changing the component style should update the caption style also";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 5982;
+ }
+
+}
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html
new file mode 100644
index 0000000000..9e1400521b
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.html
@@ -0,0 +1,102 @@
+<?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.orderedlayout.OrderedLayoutCases?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>1-undefined-without-relative</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>2-undefined-with-relative</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>3-fixed-with-overflow</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>4-fixed-with-extra-space</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[7]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- Going in the reverse direction from here to avoid some bugs where state is not properly updated -->
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>8-undefined-relative-height</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[6]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>7-fixed-relative-height</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[5]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>6-multiple-expands</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutOrderedLayoutCases::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[4]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>5-expand-with-alignment</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
index 85cc6ca5e1..447b5b4be6 100644
--- a/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/OrderedLayoutCases.java
@@ -12,17 +12,21 @@ import com.vaadin.tests.components.AbstractTestRoot;
import com.vaadin.tests.util.TestUtils;
import com.vaadin.ui.AbstractOrderedLayout;
import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Component;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.NativeSelect;
import com.vaadin.ui.VerticalLayout;
public class OrderedLayoutCases extends AbstractTestRoot {
- private static final String[] dimensionValues = { "-1px", "5px", "300px",
+ private static final String[] dimensionValues = { "-1px", "5px", "350px",
"800px", "100%", "50%" };
private static class SampleChild extends VerticalLayout {
public SampleChild() {
- setStyleName("showBorders");
+ setStyleName("sampleChild");
addComponent(createSimpleSelector("Child width",
new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
@@ -102,18 +106,24 @@ public class OrderedLayoutCases extends AbstractTestRoot {
}
private AbstractOrderedLayout currentLayout;
+ private HorizontalLayout sizeBar;
@Override
protected void setup(WrappedRequest request) {
- TestUtils.injectCSS(getRoot(),
- ".showBorders {border: 1px solid black};");
+ TestUtils
+ .injectCSS(
+ getRoot(),
+ ".sampleChild, .theLayout {border: 1px solid black;}"
+ + ".theLayout > div > div:first-child {background: aqua;}"
+ + ".theLayout > div > div:first-child + div {background: yellow;}"
+ + ".theLayout > div > div:first-child + div + div {background: lightgrey;}");
currentLayout = new HorizontalLayout();
for (int i = 0; i < 3; i++) {
currentLayout.addComponent(new SampleChild());
}
- HorizontalLayout sizeBar = new HorizontalLayout();
+ sizeBar = new HorizontalLayout();
sizeBar.setSpacing(true);
sizeBar.addComponent(createSimpleSelector("Layout width",
@@ -130,6 +140,20 @@ public class OrderedLayoutCases extends AbstractTestRoot {
.toString());
}
}, dimensionValues));
+ sizeBar.addComponent(createSimpleSelector("Spacing",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ currentLayout.setSpacing(Boolean.parseBoolean(event
+ .getProperty().getValue().toString()));
+ }
+ }, "false", "true"));
+ sizeBar.addComponent(createSimpleSelector("Margin",
+ new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ currentLayout.setMargin(Boolean.parseBoolean(event
+ .getProperty().getValue().toString()));
+ }
+ }, "false", "true"));
sizeBar.addComponent(createSimpleSelector("Direction",
new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
@@ -146,7 +170,7 @@ public class OrderedLayoutCases extends AbstractTestRoot {
newLayout.addComponent(currentLayout
.getComponent(0));
}
- newLayout.setStyleName("showBorders");
+ newLayout.setStyleName("theLayout");
newLayout.setHeight(currentLayout.getHeight(),
currentLayout.getHeightUnits());
@@ -158,6 +182,112 @@ public class OrderedLayoutCases extends AbstractTestRoot {
}
}, "Horizontal", "Vertical"));
+ HorizontalLayout caseBar = new HorizontalLayout();
+ caseBar.addComponent(new Button("Undefined without relative",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // width: 350px to middle child
+ setChildState(1, 0, 2);
+ }
+ }));
+ caseBar.addComponent(new Button("Undefined with relative",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // width: 100% to middle child
+ setChildState(1, 0, 4);
+ }
+ }));
+ caseBar.addComponent(new Button("Fixed with overflow",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // layout width: 350px
+ setState(sizeBar, 0, 2);
+ // layout margin enabled
+ setState(sizeBar, 3, 1);
+ }
+ }));
+ caseBar.addComponent(new Button("Fixed with extra space",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // Layout width: 800px
+ setState(sizeBar, 0, 3);
+ // layout margin enabled
+ setState(sizeBar, 3, 1);
+ // width: 350px to middle child
+ setChildState(1, 0, 2);
+ }
+ }));
+
+ caseBar.addComponent(new Button("Expand with alignment",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // Layout width: 800px
+ setState(sizeBar, 0, 3);
+ // Layout height: 350px
+ setState(sizeBar, 1, 2);
+ // Expand: 1 to middle child
+ setChildState(1, 3, 1);
+ // Align bottom left to middle child
+ setChildState(1, 4, 6);
+ }
+ }));
+
+ caseBar.addComponent(new Button("Multiple expands",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // Layout width: 800px
+ setState(sizeBar, 0, 3);
+ // Layout height: 350px
+ setState(sizeBar, 1, 2);
+ // Width 350px to middle child
+ setChildState(1, 0, 2);
+ // Apply to left and middle child
+ for (int i = 0; i < 2; i++) {
+ // Expand: 1
+ setChildState(i, 3, 1);
+ // Align: middle center
+ setChildState(i, 4, 5);
+ }
+ }
+ }));
+
+ caseBar.addComponent(new Button("Fixed + relative height",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // Layout height: 100%
+ setState(sizeBar, 1, 4);
+ // Height: 350px to left child
+ setChildState(0, 1, 2);
+ // Height: 100% to middle child
+ setChildState(1, 1, 4);
+ // Alignment: bottom left to right child
+ setChildState(2, 4, 7);
+ }
+ }));
+
+ caseBar.addComponent(new Button("Undefined + relative height",
+ new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ resetState();
+ // Height: 350px to left child
+ setChildState(0, 1, 2);
+ // Height: 100% to middle child
+ setChildState(1, 1, 4);
+ // Alignment: bottom left to right child
+ setChildState(2, 4, 7);
+ }
+ }));
+
+ caseBar.setSpacing(true);
+
+ addComponent(caseBar);
addComponent(sizeBar);
addComponent(currentLayout);
@@ -167,6 +297,34 @@ public class OrderedLayoutCases extends AbstractTestRoot {
getLayout().setExpandRatio(currentLayout, 1);
}
+ private void resetState() {
+ for (int i = 0; i < sizeBar.getComponentCount(); i++) {
+ setState(sizeBar, i, 0);
+ }
+ for (int i = 0; i < 3; i++) {
+ // Child width and height -> -1px
+ SampleChild child = (SampleChild) currentLayout.getComponent(i);
+ for (int j = 0; j < child.getComponentCount(); j++) {
+ if (j == 4) {
+ setState(child, j, 1);
+ } else {
+ setState(child, j, 0);
+ }
+ }
+ }
+ }
+
+ private void setChildState(int childIndex, int selectIndex, int valueIndex) {
+ Component child = currentLayout.getComponent(childIndex);
+ setState(child, selectIndex, valueIndex);
+ }
+
+ private static void setState(Component container, int selectIndex, int value) {
+ NativeSelect select = (NativeSelect) ((AbstractOrderedLayout) container)
+ .getComponent(selectIndex);
+ select.setValue(new ArrayList<Object>(select.getItemIds()).get(value));
+ }
+
private static NativeSelect createSimpleSelector(String caption,
ValueChangeListener listener, String... values) {
return createSimpleSelector(caption, listener, Arrays.asList(values),
@@ -185,14 +343,13 @@ public class OrderedLayoutCases extends AbstractTestRoot {
}
@Override
- protected String getTestDescription() {
- return "Tester application for exploring how Horizontal/VerticalLayout reacts to various settings ";
+ protected Integer getTicketNumber() {
+ return null;
}
@Override
- protected Integer getTicketNumber() {
- // TODO Auto-generated method stub
- return null;
+ protected String getTestDescription() {
+ return "Tester application for exploring how Horizontal/VerticalLayout reacts to various settings ";
}
}
diff --git a/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html
new file mode 100644
index 0000000000..edcf60176d
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/orderedlayout/VerticalLayoutChangingChildrenSizes.html
@@ -0,0 +1,211 @@
+<?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.orderedlayout.VerticalLayoutTest?restartApplication</td>
+ <td></td>
+</tr>
+<!--Hide event log-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item1</td>
+ <td>28,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item0</td>
+ <td>30,8</td>
+</tr>
+<!--Add components-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>41,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>84,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>43,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>68,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>30,11</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-one-button</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>35,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>85,5</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item0</td>
+ <td>83,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>28,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item1</td>
+ <td>40,10</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons</td>
+</tr>
+<!--Component 0 -> 100%-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>42,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>77,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>115,7</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>72,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item4</td>
+ <td>14,2</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons-equal-width</td>
+</tr>
+<!--Component 1 -> 200px height-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>22,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>117,9</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>104,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>74,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item2</td>
+ <td>23,8</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons-lower-higher</td>
+</tr>
+<!--Back to what we had before-->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>24,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>104,12</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item2</td>
+ <td>114,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+ <td>87,11</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>17,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::PID_Smenu#item0</td>
+ <td>28,3</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[0]/VMenuBar[0]#item3</td>
+ <td>77,8</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[1]/VMenuBar[0]#item3</td>
+ <td>96,6</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[2]/VMenuBar[0]#item1</td>
+ <td>75,10</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsorderedlayoutVerticalLayoutTest::Root/VOverlay[3]/VMenuBar[0]#item0</td>
+ <td>19,3</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>auto-auto-two-buttons</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java b/tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java
new file mode 100644
index 0000000000..3b0234d805
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/table/ScrollDetachSynchronization.java
@@ -0,0 +1,88 @@
+package com.vaadin.tests.components.table;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+public class ScrollDetachSynchronization extends TestBase {
+
+ @Override
+ public void setup() {
+ getMainWindow().setContent(buildLayout());
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Scrolling, then detaching, a table causes out of sync on IE";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 6970;
+ }
+
+ private Layout buildLayout() {
+ final VerticalLayout mainLayout = new VerticalLayout();
+ mainLayout.setSizeFull();
+
+ HorizontalLayout buttonBar = new HorizontalLayout();
+ buttonBar.setSizeUndefined();
+ Button first = new Button("First layout");
+ Button second = new Button("Second layout");
+ first.setDebugId("FirstButton");
+ second.setDebugId("SecondButton");
+ buttonBar.addComponent(first);
+ buttonBar.addComponent(second);
+ mainLayout.addComponent(buttonBar);
+
+ final HorizontalLayout firstLayout = buildTestLayout(true);
+ final HorizontalLayout secondLayout = buildTestLayout(false);
+
+ mainLayout.addComponent(firstLayout);
+ mainLayout.setExpandRatio(firstLayout, 1);
+
+ first.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (mainLayout.getComponent(1).equals(secondLayout)) {
+ mainLayout.replaceComponent(secondLayout, firstLayout);
+ mainLayout.setExpandRatio(firstLayout, 1);
+ }
+ }
+ });
+ second.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (mainLayout.getComponent(1).equals(firstLayout)) {
+ mainLayout.replaceComponent(firstLayout, secondLayout);
+ mainLayout.setExpandRatio(secondLayout, 1);
+ }
+ }
+ });
+ return mainLayout;
+ }
+
+ private HorizontalLayout buildTestLayout(boolean first) {
+ String which = first ? "First" : "Second";
+
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.setSizeFull();
+ hl.setDebugId(which + "Layout");
+
+ Table t = new Table();
+ t.addContainerProperty("name", String.class, null);
+ for (int i = 0; i < 10; i++) {
+ String id = which + " " + i;
+ t.addItem(new String[] { id }, id);
+ }
+ t.setDebugId(which + "Table");
+ t.setItemCaptionPropertyId("name");
+ t.setSizeFull();
+
+ hl.addComponent(t);
+
+ return hl;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java
index 8540e39c8c..bce96ebced 100644
--- a/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java
+++ b/tests/testbench/com/vaadin/tests/components/table/TableHeaderZoom.java
@@ -10,10 +10,14 @@ public class TableHeaderZoom extends TestBase {
@Override
protected void setup() {
Table table = new Table();
- table.setHeight("100px");
- table.setWidth("200px");
- table.setEnabled(false);
+ table.setHeight("400px");
+ table.setWidth("400px");
table.addContainerProperty("Column 1", String.class, "");
+ table.addContainerProperty("Column 2", String.class, "");
+
+ for (int i = 0; i < 100; ++i) {
+ table.addItem(new Object[] { "" + i, "foo" }, i);
+ }
LegacyWindow main = getMainWindow();
main.setContent(new CssLayout());
diff --git a/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisibile.java b/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisibile.java
new file mode 100644
index 0000000000..a536303061
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisibile.java
@@ -0,0 +1,43 @@
+package com.vaadin.tests.components.table;
+
+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.Table;
+
+public class TableRepaintWhenMadeVisibile extends TestBase {
+
+ @Override
+ public void setup() {
+ final Table table = new Table();
+ table.addContainerProperty("sth", String.class, null);
+ table.addItem(new Object[] { "something" }, 1);
+ addComponent(table);
+
+ Button show = new Button("show", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ table.setVisible(true);
+ }
+ });
+ addComponent(show);
+ Button hide = new Button("hide", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ table.setVisible(false);
+ }
+ });
+ addComponent(hide);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "A Table should be rendered correctly when made visible again after being initially rendered invisible. Click 'hide', refresh the application and then click 'show'";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 7986;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisible.html b/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisible.html
new file mode 100644
index 0000000000..0563acd4a5
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/table/TableRepaintWhenMadeVisible.html
@@ -0,0 +1,42 @@
+<?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.table.TableRepaintWhenMadeVisibile?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.TableRepaintWhenMadeVisibile</td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableTableRepaintWhenMadeVisibile::/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>hidden-then-shown</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java b/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
new file mode 100644
index 0000000000..e5947576a2
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/tabsheet/WrapTabSheetInTabSheet.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.tabsheet;
+
+import com.vaadin.Application;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TabSheet;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+public class WrapTabSheetInTabSheet extends TestBase {
+ @Override
+ protected void setup() {
+ final VerticalLayout mainLayout = new VerticalLayout();
+ mainLayout.addComponent(new Label("This is main layout"));
+ addComponent(mainLayout);
+
+ Button b = new Button("Wrap main layout in a TabSheet");
+ b.addListener(new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ TabSheet tabsheet = new TabSheet();
+ ComponentContainer mainParent = (ComponentContainer) mainLayout
+ .getParent();
+ mainParent.replaceComponent(mainLayout, tabsheet);
+ tabsheet.addTab(mainLayout, "Default tab");
+ }
+ });
+ mainLayout.addComponent(b);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Click the button to add a TabSheet and move the window content into the TabSheet. Every click should wrap the contents with a new TabSheet and the contents should remain visible.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8238;
+ }
+}
diff --git a/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java b/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
new file mode 100644
index 0000000000..0fc63860e1
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/textarea/TextAreaCursorPosition.java
@@ -0,0 +1,54 @@
+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() {
+ 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/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
new file mode 100644
index 0000000000..c04c9d6c13
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/textfield/TextFieldInputPromptAndClickShortcut.java
@@ -0,0 +1,59 @@
+package com.vaadin.tests.components.textfield;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.TextField;
+
+public class TextFieldInputPromptAndClickShortcut extends TestBase {
+
+ @Override
+ protected void setup() {
+ final Log log = new Log(5);
+
+ final TextField textField = new TextField();
+ Button button = new Button("Show Text", new ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ log.log("Field value: " + textField.getValue());
+ }
+ });
+ button.setClickShortcut(KeyCode.ESCAPE);
+
+ final CheckBox inputPromptSelection = new CheckBox("Input prompt");
+ inputPromptSelection.setImmediate(true);
+ inputPromptSelection.addListener(new ValueChangeListener() {
+ public void valueChange(ValueChangeEvent event) {
+ if (event.getProperty().getValue() == Boolean.TRUE) {
+ textField.setInputPrompt("Input prompt");
+ } else {
+ textField.setInputPrompt(null);
+ }
+ log.log("Set input prompt: " + textField.getInputPrompt());
+ }
+ });
+ inputPromptSelection.setImmediate(true);
+
+ addComponent(textField);
+ addComponent(button);
+ addComponent(inputPromptSelection);
+ addComponent(log);
+ }
+
+ @Override
+ protected String getDescription() {
+ return "With the input propmpt enabled, enter something into the field, press enter, remove the entered text and press the button. The previous text is still reported as the value. Without the input prompt, the new value is instead reported as blank.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}