From 57d2be63fc525905b914383d808770d483ac1582 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 17 Oct 2019 22:04:20 +0200 Subject: [PATCH] Wait until grid is fully shown in the unit test Without this, the mouse clicks sometimes are received by the parent frame and not the grid itself. --- tests/controls/gridtest.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index d2c42b4441..62771e7400 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -27,6 +27,8 @@ #include "wx/stopwatch.h" #endif // __WXGTK__ +#include "waitforpaint.h" + class GridTestCase : public CppUnit::TestCase { public: @@ -132,8 +134,15 @@ void GridTestCase::setUp() if( ms_nativelabels ) m_grid->SetUseNativeColLabels(); + WaitForPaint waitForPaint(m_grid->GetGridWindow()); + m_grid->Refresh(); m_grid->Update(); + + if ( !waitForPaint.YieldUntilPainted() ) + { + WARN("Grid not repainted until timeout expiration"); + } } void GridTestCase::tearDown()