Relates :
|
|
Relates :
|
|
Relates :
|
To reproduce: - add items "a","b","c","d" - select item "b" - remove items "b","c" using removeAll method expected: - getSelectedItem() returns "a", getSelectedIndex() returns 0 - getSelectedItems().get(0) returns "a", getSelectedIndices().get(0) returns 0 actual: - getSelectedItem() returns "b", getSelectedIndex() returns 1 - getSelectedItems().get(0) returns null, getSelectedIndices().get(0) returns -1 Test case to reproduce: @Test public void testListViewSelectionChanges() throws Exception { new JFXPanel(); ListView<String> stringListView = new ListView<>(); stringListView.getItems().addAll("a","b","c","d"); stringListView.getSelectionModel().select("b"); stringListView.getItems().removeAll("b","c"); Assert.assertEquals(0, stringListView.getSelectionModel().getSelectedIndex()); Assert.assertEquals(Integer.valueOf(0), stringListView.getSelectionModel().getSelectedIndices().get(0)); Assert.assertEquals("a", stringListView.getSelectionModel().getSelectedItem()); Assert.assertEquals("a", stringListView.getSelectionModel().getSelectedItems().get(0)); }
|