Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8254040

[testbug] Need additional regressions tests for ObservableList removeAll / retainAll

XMLWordPrintable

      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));
      }

            fastegal Jeanette Winzenburg
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: