Make wxUIActionSimulator works more reliably on GTK/X11

Add wxXSync class which adds delays between the synthesized events
sufficient for them to be processed by the higher layers (X, GTK).

This makes it possible to run the UI tests by default with wxGTK.

Closes https://github.com/wxWidgets/wxWidgets/pull/1845
This commit is contained in:
ali kettab
2020-05-07 02:45:17 +01:00
committed by Vadim Zeitlin
parent fb5c13ed00
commit 59ad9f46e6
18 changed files with 202 additions and 160 deletions

View File

@@ -27,6 +27,10 @@
#include "wx/uiaction.h"
#include "wx/vector.h"
#ifdef __WXGTK__
#include "wx/stopwatch.h"
#endif
namespace
{
@@ -229,7 +233,11 @@ void KeyboardEventTestCase::setUp()
m_win = new KeyboardTestWindow(wxTheApp->GetTopWindow());
wxYield();
m_win->SetFocus();
wxYield(); // needed to show the new window
#ifdef __WXGTK__
for ( wxStopWatch sw; sw.Time() < 10; )
#endif
wxYield(); // needed to show the new window
// The window might get some key up events when it's being shown if the key
// was pressed when the program was started and released after the window