changeset 2846:7fad68376811

Unit tests for RT-28819
author jgiles
date Thu, 07 Mar 2013 09:16:16 +1300
parents 0251aa01fc7c
children 90ee146e03e5
files javafx-ui-controls/test/javafx/scene/control/ListViewTest.java
diffstat 1 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Thu Mar 07 09:13:53 2013 +1300
+++ b/javafx-ui-controls/test/javafx/scene/control/ListViewTest.java	Thu Mar 07 09:16:16 2013 +1300
@@ -498,4 +498,34 @@
         assertEquals("String2", listView.getSelectionModel().getSelectedItems().get(0));
         assertEquals(0, listView.getSelectionModel().getSelectedIndex());
     }
+    
+    @Test public void test_rt28819_1() {
+        ObservableList<String> emptyModel = FXCollections.observableArrayList();
+        
+        final ListView<String> listView = new ListView<String>();
+        listView.setItems(emptyModel);
+        ControlAsserts.assertRowsEmpty(listView, 0, 5);
+        
+        ObservableList<String> mod = FXCollections.observableArrayList();
+        String value = System.currentTimeMillis()+"";
+        mod.add(value);
+        listView.setItems(mod);
+        ControlAsserts.assertCellCount(listView, 1);
+        ControlAsserts.assertCellTextEquals(listView, 0, value);
+    }
+    
+    @Test public void test_rt28819_2() {
+        ObservableList<String> emptyModel = FXCollections.observableArrayList();
+        
+        final ListView<String> listView = new ListView<String>();
+        listView.setItems(emptyModel);
+        ControlAsserts.assertRowsEmpty(listView, 0, 5);
+        
+        ObservableList<String> mod1 = FXCollections.observableArrayList();
+        String value1 = System.currentTimeMillis()+"";
+        mod1.add(value1);
+        listView.getItems().setAll(mod1);
+        ControlAsserts.assertCellCount(listView, 1);
+        ControlAsserts.assertCellTextEquals(listView, 0, value1);
+    }
 }