changeset 2118:5a8bfca33b50

[TEST ONLY] adding a test for TreeView getRow()
author jgiles
date Thu, 03 Jan 2013 09:45:55 +1300
parents f055b709caa5
children e250d9838c53
files javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Wed Dec 19 20:43:04 2012 +1300
+++ b/javafx-ui-controls/test/javafx/scene/control/TreeViewTest.java	Thu Jan 03 09:45:55 2013 +1300
@@ -210,7 +210,7 @@
         assertEquals(0, treeView.getRow(root));
     }
     
-    @Test public void ensureRootIndexIsNegativeOne1WhenRootIsNotShowing() {
+    @Test public void ensureRootIndexIsNegativeOneWhenRootIsNotShowing() {
         installChildren();
         treeView.setShowRoot(false);
         assertEquals(-1, treeView.getRow(root));
@@ -241,6 +241,18 @@
         assertEquals(-1, treeView.getRow(child3));
     }
     
+    @Test public void ensureCorrectIndexWhenRootTreeItemIsCollapsed() {
+        installChildren();
+        root.setExpanded(false);
+        assertEquals(0, treeView.getRow(root));
+        
+        // note that the indices are still positive, representing what the values
+        // would be if this row is visible
+        assertEquals(1, treeView.getRow(child1));
+        assertEquals(2, treeView.getRow(child2));
+        assertEquals(3, treeView.getRow(child3));
+    }
+    
     @Test public void removingLastTest() {
         TreeView tree_view = new TreeView();
         MultipleSelectionModel sm = tree_view.getSelectionModel();