From: Artur Signell Date: Fri, 23 Oct 2009 10:55:53 +0000 (+0000) Subject: Merged test changes from 6.1 branch X-Git-Tag: 6.7.0.beta1~2394 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a10ad63144b9b76e9874c183941f02e5d992a548;p=vaadin-framework.git Merged test changes from 6.1 branch svn changeset:9332/svn branch:6.2 --- diff --git a/src/com/vaadin/tests/components/textfield/TextFields.html b/src/com/vaadin/tests/components/textfield/TextFields.html new file mode 100644 index 0000000000..4b6f845b7c --- /dev/null +++ b/src/com/vaadin/tests/components/textfield/TextFields.html @@ -0,0 +1,122 @@ + + + + + + +TextFields + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TextFields
open/run/com.vaadin.tests.components.textfield.TextFields
screenCaptureenabled
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[1]3,12
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[1]31,13
waitForVaadin
screenCapturerequired-and-error
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[0]17,8
waitForVaadin
screenCapturerequired-error-readonly
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VCheckBox[0]/domChild[0]16,8
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[1]32,8
waitForVaadin
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VCheckBox[0]/domChild[0]23,4
waitForVaadin
screenCapturereadonly-disabled
mouseClickvaadin=runcomvaadintestscomponentstextfieldTextFields::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VCheckBox[0]/domChild[1]30,11
waitForVaadin
screenCapturedisabled
+ + diff --git a/src/com/vaadin/tests/components/textfield/TextFields.java b/src/com/vaadin/tests/components/textfield/TextFields.java new file mode 100644 index 0000000000..7b7c3b3415 --- /dev/null +++ b/src/com/vaadin/tests/components/textfield/TextFields.java @@ -0,0 +1,198 @@ +package com.vaadin.tests.components.textfield; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.terminal.UserError; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.Component; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.TextField; +import com.vaadin.ui.Button.ClickEvent; + +public class TextFields extends TestBase { + + private TextField textFields[] = new TextField[20]; + + @Override + protected void setup() { + HorizontalLayout actionLayout = new HorizontalLayout(); + actionLayout.setSpacing(true); + actionLayout.setMargin(true); + for (Component c : createActions()) { + actionLayout.addComponent(c); + } + addComponent(actionLayout); + + int index = 0; + + textFields[index] = createTextField("TextField 100% wide"); + textFields[index].setWidth("100%"); + addComponent(textFields[index++]); + + textFields[index] = createTextField(null, + "TextField 100% wide, no caption"); + textFields[index].setWidth("100%"); + addComponent(textFields[index++]); + + textFields[index] = createTextField("TextField auto wide"); + addComponent(textFields[index++]); + + textFields[index] = createTextField("TextField with input prompt"); + textFields[index].setInputPrompt("Please enter a value"); + addComponent(textFields[index++]); + + textFields[index] = createTextField("100px wide textfield"); + textFields[index].setWidth("100px"); + addComponent(textFields[index++]); + + textFields[index] = createTextField("150px wide, 120px high textfield"); + textFields[index].setWidth("150px"); + textFields[index].setHeight("120px"); + addComponent(textFields[index++]); + + textFields[index] = createTextField("50px high textfield"); + textFields[index].setHeight("50px"); + addComponent(textFields[index++]); + + textFields[index] = createTextField(null, "No caption"); + addComponent(textFields[index++]); + + textFields[index] = createTextField(null, "No caption and input prompt"); + textFields[index].setInputPrompt("Enter a value"); + addComponent(textFields[index++]); + + } + + private TextField createTextField(String caption, String value) { + TextField tf = new TextField(caption); + tf.setValue(value); + + return tf; + } + + private TextField createTextField(String caption) { + return createTextField(caption, ""); + } + + @Override + protected String getDescription() { + return "A generic test for TextFields in different configurations"; + } + + @Override + protected Integer getTicketNumber() { + // TODO Auto-generated method stub + return null; + } + + protected List createActions() { + ArrayList actions = new ArrayList(); + + CheckBox errorIndicators = new CheckBox("Error indicators", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setErrorIndicators(enabled); + + } + }); + + CheckBox required = new CheckBox("Required", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setRequired(enabled); + } + }); + + CheckBox enabled = new CheckBox("Enabled", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setEnabled(enabled); + } + }); + + CheckBox readonly = new CheckBox("Readonly", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + Button b = event.getButton(); + boolean enabled = (Boolean) b.getValue(); + setReadOnly(enabled); + } + }); + + errorIndicators.setValue(new Boolean(false)); + required.setValue(new Boolean(false)); + readonly.setValue(new Boolean(false)); + enabled.setValue(new Boolean(true)); + + errorIndicators.setImmediate(true); + required.setImmediate(true); + readonly.setImmediate(true); + enabled.setImmediate(true); + + actions.add(errorIndicators); + actions.add(required); + actions.add(readonly); + actions.add(enabled); + + return actions; + } + + protected void setRequired(boolean on) { + + for (TextField tf : textFields) { + if (tf == null) { + continue; + } + + tf.setRequired(on); + } + + } + + protected void setErrorIndicators(boolean on) { + for (TextField tf : textFields) { + if (tf == null) { + continue; + } + + if (on) { + tf.setComponentError(new UserError("It failed!")); + } else { + tf.setComponentError(null); + + } + } + + } + + protected void setEnabled(boolean on) { + for (TextField tf : textFields) { + if (tf == null) { + continue; + } + + tf.setEnabled(on); + } + + } + + protected void setReadOnly(boolean on) { + for (TextField tf : textFields) { + if (tf == null) { + continue; + } + + tf.setReadOnly(on); + } + + } + +} diff --git a/tests/Run selected test (all browsers).launch b/tests/Run selected test (all browsers).launch new file mode 100644 index 0000000000..6bd7c95378 --- /dev/null +++ b/tests/Run selected test (all browsers).launch @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/test.xml b/tests/test.xml index d3c499beb5..20d7649e96 100644 --- a/tests/test.xml +++ b/tests/test.xml @@ -1,15 +1,23 @@ - - - + + + + + - - + + + + + + + + @@ -46,56 +54,61 @@ - - - - - - - - - - Package name: ${package.name} - Package filename: ${package.filename} - Testing area: ${testing.testarea} - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + Package name: ${package.name} + Package filename: ${package.filename} + Testing area: ${testing.testarea} + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + - + + + + + + + + + - + @@ -113,9 +126,7 @@ - - - + @@ -130,27 +141,27 @@ - + - + - - - + + + - + - - - - + + + +