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:
committed by
Vadim Zeitlin
parent
fb5c13ed00
commit
59ad9f46e6
@@ -30,6 +30,7 @@
|
||||
#include "wx/scopeguard.h"
|
||||
#include "wx/toolbar.h"
|
||||
#include "wx/uiaction.h"
|
||||
#include "wx/stopwatch.h"
|
||||
|
||||
// FIXME: Currently under OS X testing paint event doesn't work because neither
|
||||
// calling Refresh()+Update() nor even sending wxPaintEvent directly to
|
||||
@@ -37,12 +38,7 @@
|
||||
// some tests there. But this should be fixed and the tests reenabled
|
||||
// because wxPaintEvent propagation in wxScrolledWindow is a perfect
|
||||
// example of fragile code that could be broken under OS X.
|
||||
//
|
||||
// FIXME: Under GTK+ 3 the test is broken because a simple wxYield() is not
|
||||
// enough to map the frame. It should be also fixed there by waiting for
|
||||
// it to come up, with some timeout, but for now it always fails, so
|
||||
// it's useless to run it.
|
||||
#if !defined(__WXOSX__) && !defined(__WXGTK3__)
|
||||
#if !defined(__WXOSX__)
|
||||
#define CAN_TEST_PAINT_EVENTS
|
||||
#endif
|
||||
|
||||
@@ -180,7 +176,8 @@ public:
|
||||
#ifdef __WXGTK__
|
||||
// We need to map the window, otherwise we're not going to get any
|
||||
// paint events for it.
|
||||
wxYield();
|
||||
for ( wxStopWatch sw; sw.Time() < 50; )
|
||||
wxYield();
|
||||
|
||||
// Ignore events generated during the initial mapping.
|
||||
g_str.clear();
|
||||
|
Reference in New Issue
Block a user