diff options
author | John Ahlroos <john@vaadin.com> | 2013-02-21 16:46:07 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-02-22 09:01:01 +0000 |
commit | 7af5b3fceb75b6f505a9a6d0a843b788bb06d9a7 (patch) | |
tree | 4b57a86e982d792c7f6b32ecfaac5af43027ee1c /server/tests | |
parent | daf34986db58e1c4b6a7da40581697079b434c07 (diff) | |
download | vaadin-framework-7af5b3fceb75b6f505a9a6d0a843b788bb06d9a7.tar.gz vaadin-framework-7af5b3fceb75b6f505a9a6d0a843b788bb06d9a7.zip |
Fixed another memory leak in Tree #11053
Change-Id: Idf45309b83dfe718fe6e58b6cf57b211eeb9e811
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java index f467a42339..c1d7653c01 100644 --- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java +++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java @@ -112,4 +112,25 @@ public class TreeTest extends TestCase { assertEquals(0, expanded.size()); assertNull(expandedItemId); } + + public void testRemoveExpandedItemsOnContainerChange() throws Exception { + tree.expandItem("parent"); + tree.expandItem("child"); + + tree.setContainerDataSource(new HierarchicalContainer()); + + Field expandedField = tree.getClass().getDeclaredField("expanded"); + Field expandedItemIdField = tree.getClass().getDeclaredField( + "expandedItemId"); + + expandedField.setAccessible(true); + expandedItemIdField.setAccessible(true); + + HashSet<Object> expanded = (HashSet<Object>) expandedField.get(tree); + assertEquals(0, expanded.size()); + + Object expandedItemId = expandedItemIdField.get(tree); + assertNull(expandedItemId); + } + } |