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.
This commit is contained in:
Vadim Zeitlin 2023-12-27 02:46:10 +01:00
parent e55d7c1dc3
commit 5f62f30231

View file

@ -557,22 +557,32 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellSelect", "[grid]")
wxYield(); wxYield();
sim.MouseClick(); sim.MouseClick();
wxYield(); if ( !WaitForEventAt(point, "mouse click to be processed", [&]() {
return cell.GetCount() != 0;
}) )
return;
CHECK(cell.GetCount() == 1); CHECK(cell.GetCount() == 1);
cell.Clear(); cell.Clear();
m_grid->SetGridCursor(1, 1); m_grid->SetGridCursor(1, 1);
CHECK(cell.GetCount() == 1);
cell.Clear();
m_grid->GoToCell(1, 0); m_grid->GoToCell(1, 0);
CHECK(cell.GetCount() == 1);
cell.Clear();
sim.MouseMove(point); sim.MouseMove(point);
wxYield(); wxYield();
sim.MouseDblClick(); sim.MouseDblClick();
wxYield(); if ( !WaitForEventAt(point, "mouse double click to be processed", [&]() {
return cell.GetCount() != 0;
CHECK(cell.GetCount() == 3); }) )
return;
CHECK(cell.GetCount() == 1);
#endif #endif
} }