Merge branch 'fix_grid_deselect' of https://github.com/swt2c/wxWidgets
Fix regression in wxGrid::DeselectRow() and wxGrid::DeselectCol() and add unit tests for them. See https://github.com/wxWidgets/wxWidgets/pull/2017
This commit is contained in:
@@ -10515,7 +10515,7 @@ void wxGrid::DeselectRow(int row)
|
||||
wxCHECK_RET( row >= 0 && row < m_numRows, wxT("invalid row index") );
|
||||
|
||||
if ( m_selection )
|
||||
m_selection->DeselectBlock(wxGridBlockCoords(row, 0, row, m_numRows - 1));
|
||||
m_selection->DeselectBlock(wxGridBlockCoords(row, 0, row, m_numCols - 1));
|
||||
}
|
||||
|
||||
void wxGrid::DeselectCol(int col)
|
||||
@@ -10523,7 +10523,7 @@ void wxGrid::DeselectCol(int col)
|
||||
wxCHECK_RET( col >= 0 && col < m_numCols, wxT("invalid column index") );
|
||||
|
||||
if ( m_selection )
|
||||
m_selection->DeselectBlock(wxGridBlockCoords(0, col, m_numCols - 1, col));
|
||||
m_selection->DeselectBlock(wxGridBlockCoords(0, col, m_numRows - 1, col));
|
||||
}
|
||||
|
||||
void wxGrid::DeselectCell( int row, int col )
|
||||
|
@@ -560,11 +560,21 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Selection", "[grid]")
|
||||
CHECK(m_grid->IsInSelection(9, 1));
|
||||
CHECK(!m_grid->IsInSelection(3, 0));
|
||||
|
||||
m_grid->SelectRow(4);
|
||||
m_grid->SelectRow(4, true /* add to selection */);
|
||||
|
||||
CHECK(m_grid->IsInSelection(4, 0));
|
||||
CHECK(m_grid->IsInSelection(4, 1));
|
||||
CHECK(!m_grid->IsInSelection(3, 0));
|
||||
|
||||
// Check that deselecting a row does deselect the cells in it, but leaves
|
||||
// the other ones selected.
|
||||
m_grid->DeselectRow(4);
|
||||
CHECK(!m_grid->IsInSelection(4, 0));
|
||||
CHECK(!m_grid->IsInSelection(4, 1));
|
||||
CHECK(m_grid->IsInSelection(0, 1));
|
||||
|
||||
m_grid->DeselectCol(1);
|
||||
CHECK(!m_grid->IsInSelection(0, 1));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::SelectionRange", "[grid]")
|
||||
|
Reference in New Issue
Block a user