From: Artur Signell Date: Thu, 11 Mar 2010 09:09:40 +0000 (+0000) Subject: Test case for #3554 X-Git-Tag: 6.7.0.beta1~1953 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4d167bfa0ffab87eb551b2d0125cb8222ca7da15;p=vaadin-framework.git Test case for #3554 svn changeset:11771/svn branch:6.3 --- 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(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; + } + +}