From 5f62f302316d35ff48d57594ef388fe3394e920c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 27 Dec 2023 02:46:10 +0100 Subject: [PATCH] Use WaitForEventAt() in Grid::CellSelect test too Try making this test more robust as well as it also sporadically fails on AppVeyor. Also simplify it a bit, checking for each of the expected events in turn instead of checking for their total number at the end. --- tests/controls/gridtest.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 3f40f15bd6..97557eb5bc 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -557,22 +557,32 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellSelect", "[grid]") wxYield(); sim.MouseClick(); - wxYield(); - + if ( !WaitForEventAt(point, "mouse click to be processed", [&]() { + return cell.GetCount() != 0; + }) ) + return; CHECK(cell.GetCount() == 1); - cell.Clear(); m_grid->SetGridCursor(1, 1); + + CHECK(cell.GetCount() == 1); + cell.Clear(); + m_grid->GoToCell(1, 0); + CHECK(cell.GetCount() == 1); + cell.Clear(); + sim.MouseMove(point); wxYield(); sim.MouseDblClick(); - wxYield(); - - CHECK(cell.GetCount() == 3); + if ( !WaitForEventAt(point, "mouse double click to be processed", [&]() { + return cell.GetCount() != 0; + }) ) + return; + CHECK(cell.GetCount() == 1); #endif }