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

Tree selection: selectedIndex not updated when toggling showRoot

XMLWordPrintable

      selectedIndex (and all selectedIndices, didn't check these, though) must be increased/decreased by 1 on showing/hiding the root, but doesn't.

      Failing test snippets

          @Test
          public void testShowRootItemAtIndexOn() {
              assertFalse("sanity: test setup such that root is not showing", getView().isShowRoot());
              int index = 3;
              getSelectionModel().select(index);
              assertEquals(getSelectedItem(), getView().getTreeItem(getSelectedIndex()));
              getView().setShowRoot(true);
              assertEquals(getSelectedItem(), getView().getTreeItem(getSelectedIndex()));
          }

          @Test
          public void testShowRootIndexOn() {
              assertFalse("sanity: test setup such that root is not showing", getView().isShowRoot());
              int index = 3;
              getSelectionModel().select(index);
              getView().setShowRoot(true);
              assertEquals(index + 1, getSelectedIndex());
          }

            jgiles Jonathan Giles
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: