summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur.signell@itmill.com>2010-03-11 09:09:40 +0000
committerArtur Signell <artur.signell@itmill.com>2010-03-11 09:09:40 +0000
commit4d167bfa0ffab87eb551b2d0125cb8222ca7da15 (patch)
tree5ef383624c3dabfde3c0db755b9a9f9d57f33fcf
parent509d10779bcb5c1c0f3f304eac87688421417415 (diff)
downloadvaadin-framework-4d167bfa0ffab87eb551b2d0125cb8222ca7da15.tar.gz
vaadin-framework-4d167bfa0ffab87eb551b2d0125cb8222ca7da15.zip
Test case for #3554
svn changeset:11771/svn branch:6.3
-rw-r--r--tests/src/com/vaadin/tests/components/form/FormFieldCaptions.java88
1 files changed, 88 insertions, 0 deletions
diff --git a/tests/src/com/vaadin/tests/components/form/FormFieldCaptions.java b/tests/src/com/vaadin/tests/components/form/FormFieldCaptions.java
new file mode 100644
index 0000000000..f4bc0635c3
--- /dev/null
+++ b/tests/src/com/vaadin/tests/components/form/FormFieldCaptions.java
@@ -0,0 +1,88 @@
+package com.vaadin.tests.components.form;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Form;
+import com.vaadin.ui.HorizontalLayout;
+
+public class FormFieldCaptions extends TestBase {
+
+ @Override
+ protected void setup() {
+ // Method 1
+ Form form1 = new Form();
+ Item item1 = createItem();
+ for (Object propertyId : item1.getItemPropertyIds()) {
+ form1
+ .addItemProperty(propertyId, item1
+ .getItemProperty(propertyId));
+ }
+
+ // Method 2
+
+ Form form2 = new Form();
+ Item item2 = createItem();
+ form2.setItemDataSource(item2);
+
+ // Layout
+ HorizontalLayout hl = new HorizontalLayout();
+ hl.addComponent(form1);
+ hl.addComponent(form2);
+
+ addComponent(hl);
+ }
+
+ private Item createItem() {
+ return new BeanItem<Person>(new Person("John", "Doe", 38));
+ }
+
+ public class Person {
+ private String firstName;
+ private String lastName;
+
+ public Person(String firstName, String lastName, int age) {
+ super();
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ }
+
+ public String getFirstName() {
+ return firstName;
+ }
+
+ public void setFirstName(String firstName) {
+ this.firstName = firstName;
+ }
+
+ public String getLastName() {
+ return lastName;
+ }
+
+ public void setLastName(String lastName) {
+ this.lastName = lastName;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ private int age;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "The two forms generated using different methods should have the same captions for all fields";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 3554;
+ }
+
+}