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

ChoiceBox: selectPrevious doesn't move selection if previous is separator

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8u20, 8u40
    • Fix Version/s: 9
    • Component/s: javafx
    • Environment:

      u40 is current public ea 8u40b7

      Description

      Below is a failing test case: a selection one below the separator isn't changed on selectPrevious - would expect the new selection one above the separator.

      Culprit is an incorrect override of select(int): it may reject the new index if that would select a separator, but it must not select an arbitrary index instead. That's the task of navigation methods selectNext et al.


          @Test
          public void testSeparatorSelectPrevious() {
              int index = 2;
              items.set(index, new Separator());
              getSelectionModel().select(index + 1);
              getSelectionModel().selectPrevious();
              assertEquals("selecting previous must move over separator",
                      index - 1, getSelectionModel().getSelectedIndex());
          }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jgiles Jonathan Giles
                Reporter:
                fastegal Jeanette Winzenburg
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: