Merge branch 'gtk-persist-tlw'

Fix bugs affecting wxPersistentTLW under GTK.

See https://github.com/wxWidgets/wxWidgets/pull/1419
This commit is contained in:
Vadim Zeitlin
2019-07-18 17:44:35 +02:00
5 changed files with 118 additions and 3 deletions

View File

@@ -20,6 +20,10 @@
#ifndef WX_PRECOMP
#include "wx/frame.h"
#ifdef __WXGTK__
#include "wx/stopwatch.h"
#endif // __WXGTK__
#endif // WX_PRECOMP
#include "wx/persist/toplevel.h"
@@ -88,6 +92,7 @@ TEST_CASE_METHOD(PersistenceTests, "wxPersistTLW", "[persist][tlw]")
}
// Now try recreating the frame using the restored values.
bool checkIconized = true;
{
wxFrame* const frame = CreatePersistenceTestFrame();
@@ -106,6 +111,21 @@ TEST_CASE_METHOD(PersistenceTests, "wxPersistTLW", "[persist][tlw]")
frame->Iconize();
frame->Show();
#ifdef __WXGTK__
wxStopWatch sw;
while ( !frame->IsIconized() )
{
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__
delete frame;
}
@@ -115,8 +135,27 @@ TEST_CASE_METHOD(PersistenceTests, "wxPersistTLW", "[persist][tlw]")
CHECK(wxPersistenceManager::Get().RegisterAndRestore(frame));
// As above, we need to show the frame for it to be actually iconized.
frame->Show();
CHECK(!frame->IsMaximized());
CHECK(frame->IsIconized());
if ( checkIconized )
{
#ifdef __WXGTK__
wxStopWatch sw;
while ( !frame->IsIconized() )
{
wxYield();
if ( sw.Time() > 500 )
{
INFO("Abandoning wait after " << sw.Time() << "ms");
break;
}
}
#endif // __WXGTK__
CHECK(frame->IsIconized());
}
frame->Restore();