From f066b248ad306277b30eacde0a29c200e6d9c010 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Mon, 12 Sep 2011 12:10:37 +0000 Subject: Test for client side solution to #7393 svn changeset:20959/svn branch:6.7 --- .../table/TableColumnResizeContentsWidth.html | 41 ++++++++++++++++ .../table/TableColumnResizeContentsWidth.java | 56 ++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html create mode 100644 tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java (limited to 'tests') diff --git a/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html b/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html new file mode 100644 index 0000000000..701adeac34 --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.html @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
open/run/com.vaadin.tests.components.table.TableColumnResizeContentsWidth?restartApplication&debug
dragAndDropvaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]-20,+0
assertElementWidthvaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]80
dragAndDropvaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]+40,+0
assertElementWidthvaadin=runcomvaadintestscomponentstableTableColumnResizeContentsWidth::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VTextField[0]120
+ + diff --git a/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java b/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java new file mode 100644 index 0000000000..fbe7ed88ef --- /dev/null +++ b/tests/src/com/vaadin/tests/components/table/TableColumnResizeContentsWidth.java @@ -0,0 +1,56 @@ +package com.vaadin.tests.components.table; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Table; +import com.vaadin.ui.Table.ColumnGenerator; +import com.vaadin.ui.TextField; + +public class TableColumnResizeContentsWidth extends TestBase { + + private static final String COL1 = "COL1"; + + @Override + protected void setup() { + final Table table = new Table(); + table.addGeneratedColumn(COL1, new ColumnGenerator() { + public Object generateCell(Table source, Object itemId, + Object columnId) { + TextField textField = new TextField(); + textField.setWidth("100%"); + return textField; + } + }); + + table.addItem(); + + table.setWidth("200px"); + table.setColumnWidth(COL1, 100); + + addComponent(table); + addComponent(new Button("Increase width", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnWidth(COL1, table.getColumnWidth(COL1) + 20); + table.requestRepaint(); + } + })); + addComponent(new Button("Decrease width", new Button.ClickListener() { + public void buttonClick(ClickEvent event) { + table.setColumnWidth(COL1, table.getColumnWidth(COL1) - 40); + table.requestRepaint(); + } + })); + } + + @Override + protected String getDescription() { + return "When a column is resized, it's contents should update to match the new size"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(7393); + } + +} -- cgit v1.2.3