-
Bug
-
Resolution: Fixed
-
P4
-
jfx11, 8u20, jfx15
As pointed out during the review of JDK-8253086 the regressions tests for JDK-8093144 (aka RT-35857) are missing some cases. See this comment in the PR:
https://github.com/openjdk/jfx/pull/305#discussion_r499224782
This omission almost caused that bug to be reintroduced.
We should add additional tests to ensure that this doesn't happen.
At a minimum, the following test can be added to ListViewTest.java in the javafx.controls module:
@Test public void test_rt35857Back() {
ObservableList<String> fxList = FXCollections.observableArrayList("A", "B", "C");
final ListView<String> listView = new ListView<String>(fxList);
listView.getSelectionModel().select(2);
ObservableList<String> selectedItems =
listView.getSelectionModel().getSelectedItems();
assertEquals(1, selectedItems.size());
assertEquals("C", selectedItems.get(0));
listView.getItems().removeAll(selectedItems);
assertEquals(2, fxList.size());
assertEquals("A", fxList.get(0));
assertEquals("B", fxList.get(1));
}
https://github.com/openjdk/jfx/pull/305#discussion_r499224782
This omission almost caused that bug to be reintroduced.
We should add additional tests to ensure that this doesn't happen.
At a minimum, the following test can be added to ListViewTest.java in the javafx.controls module:
@Test public void test_rt35857Back() {
ObservableList<String> fxList = FXCollections.observableArrayList("A", "B", "C");
final ListView<String> listView = new ListView<String>(fxList);
listView.getSelectionModel().select(2);
ObservableList<String> selectedItems =
listView.getSelectionModel().getSelectedItems();
assertEquals(1, selectedItems.size());
assertEquals("C", selectedItems.get(0));
listView.getItems().removeAll(selectedItems);
assertEquals(2, fxList.size());
assertEquals("A", fxList.get(0));
assertEquals("B", fxList.get(1));
}
- relates to
-
JDK-8093144 Unexpected interaction between ListView's SelectionModel getSelecteditems() and removing items
- Resolved
-
JDK-8253086 Optimization of removeAll and retainAll of ObservableListWrapper
- Open