From c92b39a13d58db820fa441244eff5dc19e96c8ba Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Jul 2019 16:07:06 +0200 Subject: [PATCH] Disable tests requiring a WM under Xvfb Both iconization and activation of TLWs is dependent on the presence of a WM, but there is no WM running under Xvfb, so skip these tests in this case. --- tests/persistence/tlw.cpp | 25 +++++++++++++++++-------- tests/toplevel/toplevel.cpp | 6 +++++- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tests/persistence/tlw.cpp b/tests/persistence/tlw.cpp index 47a346d4af..78f89c15e4 100644 --- a/tests/persistence/tlw.cpp +++ b/tests/persistence/tlw.cpp @@ -112,16 +112,25 @@ TEST_CASE_METHOD(PersistenceTests, "wxPersistTLW", "[persist][tlw]") frame->Show(); #ifdef __WXGTK__ - wxStopWatch sw; - while ( !frame->IsIconized() ) + // When using Xvfb, the frame will never get iconized, presumably + // because there is no WM, so don't even bother waiting or warning. + if ( IsRunningUnderXVFB() ) { - wxYield(); - if ( sw.Time() > 500 ) + checkIconized = false; + } + else + { + wxStopWatch sw; + while ( !frame->IsIconized() ) { - // 500ms should be enough for the window to end up iconized. - WARN("Frame wasn't iconized as expected"); - checkIconized = false; - break; + wxYield(); + if ( sw.Time() > 500 ) + { + // 500ms should be enough for the window to end up iconized. + WARN("Frame wasn't iconized as expected"); + checkIconized = false; + break; + } } } #endif // __WXGTK__ diff --git a/tests/toplevel/toplevel.cpp b/tests/toplevel/toplevel.cpp index 6039da1804..c388ed9c0e 100644 --- a/tests/toplevel/toplevel.cpp +++ b/tests/toplevel/toplevel.cpp @@ -72,7 +72,11 @@ static void TopLevelWindowShowTest(wxTopLevelWindow* tlw) tlw->Show(true); countActivate.WaitEvent(); - CHECK(tlw->IsActive()); + // TLWs never become active when running under Xvfb, presumably because + // there is no WM there. + if ( !IsRunningUnderXVFB() ) + CHECK(tlw->IsActive()); + CHECK(tlw->IsShown()); tlw->Hide();