-
Bug
-
Resolution: Unresolved
-
P4
-
jfx13
Doc of focusPrevious:
"If the current focus owner is the first row, or is -1 (representing that there is no current focus owner), calling this method will have no result."
mapped to a test method:
@Test
public void focusPreviousFromNoFocus() {
focusModel.focus(-1);
assertEquals("sanity", -1, focusModel.getFocusedIndex());
focusModel.focusPrevious();
assertEquals(-1, focusModel.getFocusedIndex());
}
fails for all implementations - actually, already in the abstract base class (and overriding subs more or less just copied):
public void focusPrevious() {
if (getFocusedIndex() == -1) {
focus(0);
} else if (getFocusedIndex() > 0) {
focus(getFocusedIndex() - 1);
}
}
either implementation or specification must be changed to keep in sync
"If the current focus owner is the first row, or is -1 (representing that there is no current focus owner), calling this method will have no result."
mapped to a test method:
@Test
public void focusPreviousFromNoFocus() {
focusModel.focus(-1);
assertEquals("sanity", -1, focusModel.getFocusedIndex());
focusModel.focusPrevious();
assertEquals(-1, focusModel.getFocusedIndex());
}
fails for all implementations - actually, already in the abstract base class (and overriding subs more or less just copied):
public void focusPrevious() {
if (getFocusedIndex() == -1) {
focus(0);
} else if (getFocusedIndex() > 0) {
focus(getFocusedIndex() - 1);
}
}
either implementation or specification must be changed to keep in sync