From 671292a04b0a9b52299f3e289a975d7a8212b5e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Mon, 5 Dec 2011 15:37:05 +0000 Subject: [PATCH] Test case for #8041 svn changeset:22237/svn branch:6.7 --- .../treetable/AddNodesOnExpand.html | 37 +++++++++++++ .../treetable/AddNodesOnExpand.java | 55 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html create mode 100644 tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html new file mode 100644 index 0000000000..efcbded1d5 --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.html @@ -0,0 +1,37 @@ + + + + + + +New Test + + + + + + + + + + + + + + + + + + + + + + + + + + + +
New Test
open/run/com.vaadin.tests.components.treetable.AddNodesOnExpand?restartApplication
mouseClickvaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]11,7
mouseClickvaadin=runcomvaadintestscomponentstreetableAddNodesOnExpand::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VTreeTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]11,7
screenCapturecollapsed
+ + diff --git a/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java new file mode 100644 index 0000000000..5bf0370bab --- /dev/null +++ b/tests/testbench/com/vaadin/tests/components/treetable/AddNodesOnExpand.java @@ -0,0 +1,55 @@ +package com.vaadin.tests.components.treetable; + +import com.vaadin.tests.components.TestBase; +import com.vaadin.ui.Tree; +import com.vaadin.ui.Tree.CollapseEvent; +import com.vaadin.ui.Tree.ExpandEvent; +import com.vaadin.ui.TreeTable; + +public class AddNodesOnExpand extends TestBase { + private TreeTable treetable; + + @Override + public void setup() { + treetable = new TreeTable(); + treetable.setImmediate(true); + treetable.setWidth("100%"); + treetable.setHeight(null); + treetable.setPageLength(0); + treetable.addContainerProperty("foo", String.class, ""); + treetable.addListener(new Tree.ExpandListener() { + public void nodeExpand(ExpandEvent event) { + Object openedItemId = event.getItemId(); + if (!treetable.hasChildren(openedItemId)) { + for (int j = 0; j < 3; j++) { + treetable.addItem(openedItemId + "-" + j); + treetable.setParent(openedItemId + "-" + j, + openedItemId); + } + } + } + }); + treetable.addListener(new Tree.CollapseListener() { + public void nodeCollapse(CollapseEvent event) { + /* Uncomment this to "fix" the TreeTable */ + // orgTree.refreshRowCache(); + } + }); + + for (int i = 0; i < 3; i++) { + treetable.addItem(Integer.valueOf(i)); + } + + addComponent(treetable); + } + + @Override + protected String getDescription() { + return "Expanding a node and then collapsing it should not cause scrollbars to appear"; + } + + @Override + protected Integer getTicketNumber() { + return Integer.valueOf(8041); + } +} \ No newline at end of file -- 2.39.5