summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2009-11-02 14:22:47 +0000
committerArtur Signell <artur.signell@itmill.com>2009-11-02 14:22:47 +0000
commitb15f3930c15356abc607658baf78bc8759578887 (patch)
tree915a590e008453046c35412343babe7c3473be06
parent34a1a6f8ca690efc293b999bda9b6c2700cd3f39 (diff)
downloadvaadin-framework-b15f3930c15356abc607658baf78bc8759578887.tar.gz
vaadin-framework-b15f3930c15356abc607658baf78bc8759578887.zip
Merged (partly by hand) [9399]
svn changeset:9575/svn branch:6.2
-rw-r--r--tests/src/com/vaadin/tests/components/loginform/LoginFormTest.html142
-rw-r--r--tests/src/com/vaadin/tests/components/loginform/LoginFormTest.java76
2 files changed, 207 insertions, 11 deletions
diff --git a/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.html b/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.html
new file mode 100644
index 0000000000..281e587abf
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.html
@@ -0,0 +1,142 @@
+<?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>LoginFormTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">LoginFormTest</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.loginform.LoginFormTest?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>undefinedsize</td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>username</td>
+ <td>username</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>enterCharacter</td>
+ <td>password</td>
+ <td>password</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>clickAndWait</td>
+ <td>//form[@id='loginf']/div[5]/div/span/span</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td>
+ <td>User 'username', password='password' logged in</td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>loggedin</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>undefinedsize</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>fixed-height</td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>fixed-size</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsloginformLoginFormTest::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>waitForVaadin</td>
+ <td></td>
+ <td></td>
+</tr>
+<tr>
+ <td>screenCapture</td>
+ <td></td>
+ <td>fixed-width</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.java b/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.java
index f8e8b96f62..38dea89515 100644
--- a/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.java
+++ b/tests/src/com/vaadin/tests/components/loginform/LoginFormTest.java
@@ -2,8 +2,10 @@ package com.vaadin.tests.components.loginform;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.LoginForm;
+import com.vaadin.ui.VerticalLayout;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.LoginForm.LoginEvent;
@@ -11,12 +13,17 @@ import com.vaadin.ui.LoginForm.LoginListener;
public class LoginFormTest extends TestBase {
+ private HorizontalLayout loginFormLayout;
private LoginForm loginForm;
@Override
protected void setup() {
+ loginFormLayout = new HorizontalLayout();
+
loginForm = new LoginForm();
- getLayout().setSizeFull();
+ loginForm.setSizeUndefined();
+
+ updateCaption();
loginForm.addListener(new LoginListener() {
/**
@@ -25,34 +32,81 @@ public class LoginFormTest extends TestBase {
private static final long serialVersionUID = 1L;
public void onLogin(LoginEvent event) {
- login(event.getLoginParameter("user"), event
+ login((LoginForm) event.getSource(), event
+ .getLoginParameter("username"), event
.getLoginParameter("password"));
}
});
- addComponent(loginForm);
+
+ loginFormLayout.addComponent(loginForm);
+
+ Button changeWidth = new Button("Change width", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ if (loginForm.getWidth() < 0) {
+ loginForm.setWidth("300px");
+ } else {
+ loginForm.setWidth(null);
+ }
+ updateCaption();
+ }
+ });
+
+ Button changeHeight = new Button("Change height", new ClickListener() {
+
+ public void buttonClick(ClickEvent event) {
+ if (loginForm.getHeight() < 0) {
+ loginForm.setHeight("200px");
+ } else {
+ loginForm.setHeight(null);
+ }
+ updateCaption();
+ }
+ });
+
+ addComponent(loginFormLayout);
+ addComponent(changeWidth);
+ addComponent(changeHeight);
}
- protected void login(String user, String password) {
+ protected void updateCaption() {
+ float width = loginForm.getWidth();
+ float height = loginForm.getHeight();
+
+ String w = width < 0 ? "auto" : (int) width + "px";
+ String h = height < 0 ? "auto" : (int) height + "px";
+
+ loginForm.setCaption("LoginForm (" + w + "/" + h + ")");
+ }
+
+ protected void login(LoginForm loginForm, String user, String password) {
+ VerticalLayout infoLayout = new VerticalLayout();
+
Label info = new Label("User '" + user + "', password='" + password
+ "' logged in");
- getLayout().removeAllComponents();
- getLayout().addComponent(info);
- getLayout().addComponent(new Button("Log out", new ClickListener() {
+ Button logoutButton = new Button("Log out", new ClickListener() {
public void buttonClick(ClickEvent event) {
- getLayout().removeAllComponents();
- getLayout().addComponent(loginForm);
+ Button b = event.getButton();
+ loginFormLayout.replaceComponent(b.getParent(), (LoginForm) b
+ .getData());
}
- }));
+ });
+ logoutButton.setData(loginForm);
+
+ infoLayout.addComponent(info);
+ infoLayout.addComponent(logoutButton);
+
+ loginFormLayout.replaceComponent(loginForm, infoLayout);
}
@Override
protected String getDescription() {
- return "Basic test for the LoginForm component. The login form should be visible. Entering a username+password and clicking 'login' should replace the login form with a label telling the user name as password. Also a logout button should then be shown and pressing that takes the user back to the original screen with the LoginForm";
+ return "Basic test for the LoginForm component. Three login forms should be visible (undefined height, undefined width, defined height and width). Entering a username+password in a login form and clicking 'login' should replace the login form with a label telling the user name as password. Also a logout button should then be shown and pressing that takes the user back to the original screen with the LoginForm";
}
@Override