From bb93682a87eb8173f9219c7776a00e9bb2c478a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 14 Aug 2020 12:41:10 +0200 Subject: [PATCH] Improve wxGrid selection test slightly Check that deselecting a row leaves the cells outside of this row selected. This requires passing "true" to the previous call of SelectRow() to prevent it from clearing the existing selection, as it does by default. --- tests/controls/gridtest.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 8a862fb7ce..e0a8ff4732 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -560,15 +560,18 @@ 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));