Details
-
Bug
-
Resolution: Fixed
-
P4
-
jfx11
-
b03
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8304076 | jfx17.0.7 | Johan Vos | P4 | Resolved | Fixed |
Description
failing test (for TableViewSelectionModelImplTest)
/**
* Analysing failing tests when fixing JDK-8219720.
*
* Suspect: isSelected(int row) violates contract.
*
* @see #selectRowWhenInSingleCellSelectionMode()
* @see #selectRowWhenInSingleCellSelectionMode2()
*/
@Test
public void testSelectRowWhenInSingleCellSelectionModeIsSelected() {
model.setSelectionMode(SelectionMode.SINGLE);
model.setCellSelectionEnabled(true);
model.select(3);
// test against contract
assertEquals("selected index", 3, model.getSelectedIndex());
assertTrue("contained in selected indices", model.getSelectedIndices().contains(3));
// test against spec
assertEquals("is selected index", model.getSelectedIndices().contains(3), model.isSelected(3)); }
The spec for selectionModel.isSelected(int):
"Convenience method to inform if the given index is currently selected in this SelectionModel. Is functionally equivalent to calling getSelectedIndices().contains(index)"
(ignoring the obvious doc error, getSelectedIndices is declared in subclass ;)
Technical reason is that isSelected(int) delegates to isSelect(int, TableColumn) with null as second parameter. Given the spec of the latter method:
"If the table control is in its 'cell selection' mode (where individual cells can be selected, rather than entire rows), and if the column argument is null, this method should return true only if all cells in the given row are selected"
the latter must (and does) return false always in single mode and columns.size() > 1.
Attachments
Issue Links
- backported by
-
JDK-8304076 Tree/TableView: implementation of isSelected(int) violates contract
- Resolved
- blocks
-
JDK-8219720 Tree/TableView: incorrect cell selected after initial navigation into table
- Open
- csr for
-
JDK-8290741 Tree/TableView: implementation of isSelected(int) violates contract
- Closed
- relates to
-
JDK-8292143 Tree/TableView: selection of cells hidden from view
- Open
-
JDK-8292353 TableRow vs. TreeTableRow: inconsistent visuals in cell selection mode
- Resolved
- links to
-
Commit openjdk/jfx17u/14c998c4
-
Commit openjdk/jfx/7cb8d679
-
Review openjdk/jfx17u/121
-
Review openjdk/jfx/839