From 3d07de66b1a8dd57bd2b869676f8dd4993042b33 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 3 Oct 2023 15:59:52 +0200 Subject: [PATCH] Add a wait to wxGrid UI unit tests too Wait for a bit before checking for the expected event as a single wxYield() call might apparently not be enough under load, as this test sporadically fails in AppVeyor CI builds even though it passes locally. --- tests/controls/gridtest.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 5921793b82..f7cd2517c9 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -608,7 +608,9 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SortClick", "[grid]") wxYield(); sim.MouseClick(); - wxYield(); + WaitFor("mouse click to be processed", [&]() { + return sort.GetCount() != 0; + }); CHECK(sort.GetCount() == 1); #endif @@ -642,7 +644,9 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Size", "[grid]") wxYield(); sim.MouseUp(); - wxYield(); + WaitFor("mouse release to be processed", [&]() { + return colsize.GetCount() != 0; + }); CHECK(colsize.GetCount() == 1); @@ -651,7 +655,9 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Size", "[grid]") sim.MouseDragDrop(pt.x, pt.y, pt.x, pt.y + 50); - wxYield(); + WaitFor("mouse drag to be processed", [&]() { + return rowsize.GetCount() != 0; + }); CHECK(rowsize.GetCount() == 1); #endif