changeset 6499:2f2379857779

RT-35891: TreeTableView cells are not in parameterised CellTest class This changeset adds the TreeTableRow and TreeTableCell classes to the CellTest parameterised test class, enabling these two classes to have the ~41 unit tests run against each of them.
author jgiles
date Tue, 18 Mar 2014 14:17:09 +1300
parents 10d656e22fbd
children a50800b8372c 16300af5f9f5
files modules/controls/src/main/java/javafx/scene/control/TreeTableCell.java modules/controls/src/test/java/javafx/scene/control/CellTest.java
diffstat 2 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/modules/controls/src/main/java/javafx/scene/control/TreeTableCell.java	Mon Mar 17 15:29:56 2014 -0700
+++ b/modules/controls/src/main/java/javafx/scene/control/TreeTableCell.java	Tue Mar 18 14:17:09 2014 +1300
@@ -90,6 +90,17 @@
 
     /***************************************************************************
      *                                                                         *
+     * Private fields                                                          *
+     *                                                                         *
+     **************************************************************************/
+
+    // package for testing
+    boolean lockItemOnEdit = false;
+
+
+
+    /***************************************************************************
+     *                                                                         *
      * Callbacks and Events                                                    *
      *                                                                         *
      **************************************************************************/
@@ -291,20 +302,22 @@
             return;
         }
 
-        updateItem();
+        // We check the boolean lockItemOnEdit field here, as whilst we want to
+        // updateItem normally, when it comes to unit tests we can't have the
+        // item change in all circumstances.
+        if (! lockItemOnEdit) {
+            updateItem();
+        }
 
         // it makes sense to get the cell into its editing state before firing
         // the event to listeners below, so that's what we're doing here
         // by calling super.startEdit().
         super.startEdit();
         
-        @SuppressWarnings("unchecked")
-        TreeTablePosition<S,T> editingCell = (TreeTablePosition<S,T>) table.getEditingCell();
-        
         if (column != null) {
-            CellEditEvent<S,T> editEvent = new CellEditEvent<S,T>(
+            CellEditEvent editEvent = new CellEditEvent(
                 table,
-                editingCell,
+                table.getEditingCell(),
                 TreeTableColumn.<S,T>editStartEvent(),
                 null
             );
--- a/modules/controls/src/test/java/javafx/scene/control/CellTest.java	Mon Mar 17 15:29:56 2014 -0700
+++ b/modules/controls/src/test/java/javafx/scene/control/CellTest.java	Tue Mar 18 14:17:09 2014 +1300
@@ -55,8 +55,8 @@
                 {TableRow.class},
                 {TableCell.class},
                 {TreeCell.class},
-//                {TreeTableRow.class},
-//                {TreeTableCell.class}
+                {TreeTableRow.class},
+                {TreeTableCell.class}
         });
     }
 
@@ -82,7 +82,7 @@
             TreeTableRow tableRow = new TreeTableRow();
             tableRow.updateItem("TableRow", false);
             ((TreeTableCell)cell).updateTreeTableRow(tableRow);
-//            ((TreeTableCell)cell).lockItemOnEdit = true;
+            ((TreeTableCell)cell).lockItemOnEdit = true;
         }
     }