From e0a927af94545d4accdde9549eaf8a92fb7ac86a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 31 Jan 2021 00:28:08 +0100 Subject: [PATCH] Wait for wxDataViewCtrl relayout under GTK in the unit test A single wxYield() doesn't seem to be enough, at least not when running in GitHub Actions environment, so wait for a longer time. --- tests/controls/dataviewctrltest.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tests/controls/dataviewctrltest.cpp b/tests/controls/dataviewctrltest.cpp index f970c886b2..ffca55b260 100644 --- a/tests/controls/dataviewctrltest.cpp +++ b/tests/controls/dataviewctrltest.cpp @@ -329,9 +329,18 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase, m_dvc->EnsureVisible(last); #ifdef __WXGTK__ - // And again to let it scroll the correct items into view. - wxYield(); -#endif + // Wait for the list control to be relaid out. + wxStopWatch sw; + while ( m_dvc->GetTopItem() == m_root ) + { + if ( sw.Time() > 500 ) + { + WARN("Timed out waiting for wxDataViewCtrl layout"); + break; + } + wxYield(); + } +#endif // __WXGTK__ // Check that this was indeed the case. const wxDataViewItem top = m_dvc->GetTopItem();