diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-10-26 15:27:04 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2009-10-26 15:27:04 +0000 |
commit | b4906f7c204040f80cb8270a3d770cb28c982d99 (patch) | |
tree | 53f35352c793575902d8864133148e03e03bf7c4 /src/com/vaadin/tests | |
parent | ecef9d970e05e17a281a579d37ab043b6a2a07e8 (diff) | |
download | vaadin-framework-b4906f7c204040f80cb8270a3d770cb28c982d99.tar.gz vaadin-framework-b4906f7c204040f80cb8270a3d770cb28c982d99.zip |
merged #3597 related changes from 6.1 branch
svn changeset:9379/svn branch:6.2
Diffstat (limited to 'src/com/vaadin/tests')
-rw-r--r-- | src/com/vaadin/tests/components/loginform/LoginFormTest.java | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/com/vaadin/tests/components/loginform/LoginFormTest.java b/src/com/vaadin/tests/components/loginform/LoginFormTest.java new file mode 100644 index 0000000000..f8e8b96f62 --- /dev/null +++ b/src/com/vaadin/tests/components/loginform/LoginFormTest.java @@ -0,0 +1,63 @@ +package com.vaadin.tests.components.loginform; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Label; +import com.vaadin.ui.LoginForm; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Button.ClickListener; +import com.vaadin.ui.LoginForm.LoginEvent; +import com.vaadin.ui.LoginForm.LoginListener; + +public class LoginFormTest extends TestBase { + + private LoginForm loginForm; + + @Override + protected void setup() { + loginForm = new LoginForm(); + getLayout().setSizeFull(); + loginForm.addListener(new LoginListener() { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public void onLogin(LoginEvent event) { + login(event.getLoginParameter("user"), event + .getLoginParameter("password")); + + } + }); + addComponent(loginForm); + + } + + protected void login(String user, String password) { + Label info = new Label("User '" + user + "', password='" + password + + "' logged in"); + getLayout().removeAllComponents(); + getLayout().addComponent(info); + getLayout().addComponent(new Button("Log out", new ClickListener() { + + public void buttonClick(ClickEvent event) { + getLayout().removeAllComponents(); + getLayout().addComponent(loginForm); + } + + })); + + } + + @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"; + } + + @Override + protected Integer getTicketNumber() { + return 3597; + } + +} |