From 25fd9b1e5252330bc3c237da752d6254009bc3e5 Mon Sep 17 00:00:00 2001 From: John Alhroos Date: Tue, 16 Nov 2010 09:39:07 +0000 Subject: [PATCH] Added testbench test for #5789, #2428 and #5792 svn changeset:15998/svn branch:6.5 --- .../components/table/TableUndefinedSize.html | 132 ++++++++++++++ .../components/table/TableUndefinedSize.java | 165 ++++++++++++++++++ 2 files changed, 297 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/table/TableUndefinedSize.html create mode 100644 tests/src/com/vaadin/tests/components/table/TableUndefinedSize.java diff --git a/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.html b/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.html new file mode 100644 index 0000000000..6c1e64a0d4 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.html @@ -0,0 +1,132 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/vaadin65/run/com.vaadin.tests.components.table.TableUndefinedSize?restartApplication
screenCaptureUndefinedSizeTable
clickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]
verifyTextPresentexact:1: Size 200x200 pixels
screenCaptureFixedSize200x200Table
clickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]
verifyTextPresentexact:2: Size 600x200 pixels
1: Size 200x200 pixels
screenCaptureFixedSize600x200Table
clickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]
verifyTextPresentexact:3: Size undefined
2: Size 600x200 pixels
1: Size 200x200 pixels
screenCaptureUndefinedSizeTable
selectvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VNativeSelect[0]/domChild[0]label=4
verifyTextPresentexact:4: Page length: 4
3: Size undefined
2: Size 600x200 pixels
1: Size 200x200 pixels
screenCapturePageLength4
selectvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VHorizontalLayout[0]/ChildComponentContainer[3]/VNativeSelect[0]/domChild[0]label=10
screenCapturePageLength10
mouseClickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/domChild[0]/domChild[3]1102,215
mouseClickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]3,6
verifyTextPresentColumn 2
verifyTextPresentColumn 3
screenCaptureColumn1Hidden
mouseClickvaadin=vaadin65runcomvaadintestscomponentstableTableUndefinedSize::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VCheckBox[0]/domChild[0]3,3
screenCaptureAllColumnsShown
+ + diff --git a/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.java b/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.java new file mode 100644 index 0000000000..2b3204953b --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableUndefinedSize.java @@ -0,0 +1,165 @@ +package com.vaadin.tests.components.table; + +import java.util.Arrays; + +import com.vaadin.data.Container; +import com.vaadin.data.Property; +import com.vaadin.data.Property.ValueChangeEvent; +import com.vaadin.data.util.IndexedContainer; +import com.vaadin.data.util.ObjectProperty; +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.CheckBox; +import com.vaadin.ui.HorizontalLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.NativeSelect; +import com.vaadin.ui.Table; + +public class TableUndefinedSize extends TestBase { + + private ObjectProperty output = new ObjectProperty(""); + + private int counter = 1; + + @Override + protected void setup() { + + HorizontalLayout controls = new HorizontalLayout(); + controls.setSpacing(true); + addComponent(controls); + + HorizontalLayout visibilities = new HorizontalLayout(); + visibilities.setSpacing(true); + addComponent(visibilities); + + final Table tbl = new Table("", createDataSource()); + tbl.setImmediate(true); + tbl.setColumnCollapsingAllowed(true); + + Label output = new Label(this.output); + output.setWidth("400px"); + output.setHeight("100px"); + output.setContentMode(Label.CONTENT_XHTML); + + controls.addComponent(new Button("Fixed size (200x200)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setWidth("200px"); + tbl.setHeight("200px"); + print("Size 200x200 pixels"); + } + })); + + controls.addComponent(new Button("Fixed size (600x200)", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setWidth("600px"); + tbl.setHeight("200px"); + print("Size 600x200 pixels"); + } + })); + + controls.addComponent(new Button("Undefined size", + new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setSizeUndefined(); + print("Size undefined"); + } + })); + + NativeSelect pageLength = new NativeSelect("PageLength", Arrays.asList( + 0, 1, 2, 4, 8, 10)); + pageLength.setImmediate(true); + pageLength.setNullSelectionAllowed(false); + pageLength.addListener(new Property.ValueChangeListener() { + public void valueChange(ValueChangeEvent event) { + int pageLength = Integer.valueOf(event.getProperty().getValue() + .toString()); + tbl.setPageLength(pageLength); + print("Page length: " + pageLength); + } + }); + controls.addComponent(pageLength); + + CheckBox cb = new CheckBox("Column 1", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setColumnCollapsed("Column 1", !event.getButton() + .booleanValue()); + if (event.getButton().booleanValue()) { + print("Column 1 visible"); + } else { + print("Column 1 hidden"); + } + } + }); + cb.setImmediate(true); + cb.setValue(true); + visibilities.addComponent(cb); + + cb = new CheckBox("Column 2", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setColumnCollapsed("Column 2", !event.getButton() + .booleanValue()); + + if (event.getButton().booleanValue()) { + print("Column 2 visible"); + } else { + print("Column 2 hidden"); + } + } + }); + cb.setImmediate(true); + cb.setValue(true); + visibilities.addComponent(cb); + + cb = new CheckBox("Column 3", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + tbl.setColumnCollapsed("Column 3", !event.getButton() + .booleanValue()); + + if (event.getButton().booleanValue()) { + print("Column 3 visible"); + } else { + print("Column 3 hidden"); + } + } + }); + cb.setImmediate(true); + cb.setValue(true); + visibilities.addComponent(cb); + + addComponent(output); + addComponent(tbl); + + } + + protected void print(String message) { + output.setValue(counter + ": " + message + "
" + output.getValue()); + counter++; + } + + protected Container createDataSource() { + IndexedContainer c = new IndexedContainer(); + c.addContainerProperty("Column 1", String.class, "Column 1"); + c.addContainerProperty("Column 2", String.class, "Column 2"); + c.addContainerProperty("Column 3", String.class, "Column 3"); + + for (int i = 0; i < 50; i++) { + c.addItem(); + } + + return c; + } + + @Override + protected String getDescription() { + return ""; + } + + @Override + protected Integer getTicketNumber() { + return 5789; + } + +} -- 2.39.5