-
Bug
-
Resolution: Fixed
-
P4
-
8u20, 8u40
-
u40 is current public ea 8u40b7
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());
}
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());
}
- relates to
-
JDK-8242938 ChoiceBoxSelectionModel: Issues with Separator selection.
-
- Open
-