Disable tests using wxUIActionSimulator under non-MSW platforms

wxUIActionSimulator is just too unreliable to be used there, so while
fixing it should really be a priority, for now at least prevent these
spurious failures from masking any other ones, which indicate real
problems that need to be fixed.

Notice that these tests can still be enabled by setting the environment
variable WX_UI_TESTS to 1 (or disabled by setting it to 0 under MSW).
This commit is contained in:
Vadim Zeitlin
2017-11-05 17:50:09 +01:00
parent 0858cd52a7
commit 99378ed0d7
2 changed files with 41 additions and 6 deletions

View File

@@ -360,6 +360,37 @@ extern bool IsAutomaticTest()
#if wxUSE_GUI #if wxUSE_GUI
bool EnableUITests()
{
static int s_enabled = -1;
if ( s_enabled == -1 )
{
// Allow explicitly configuring this via an environment variable under
// all platforms.
wxString enabled;
if ( wxGetEnv("WX_UI_TESTS", &enabled) )
{
if ( enabled == "1" )
s_enabled = 1;
else if ( enabled == "0" )
s_enabled = 0;
else
wxFprintf(stderr, "Unknown \"WX_UI_TESTS\" value \"%s\" ignored.\n", enabled);
}
if ( s_enabled == -1 )
{
#ifdef __WXMSW__
s_enabled = 1;
#else // !__WXMSW__
s_enabled = 0;
#endif // __WXMSW__/!__WXMSW__
}
}
return s_enabled == 1;
}
void DeleteTestWindow(wxWindow* win) void DeleteTestWindow(wxWindow* win)
{ {
if ( !win ) if ( !win )

View File

@@ -10,13 +10,14 @@
// this allows the tests that do not rely on it to run on platforms that don't // this allows the tests that do not rely on it to run on platforms that don't
// support it. // support it.
// //
// FIXME: And while OS X does support it, more or less, too many tests // Unfortunately, currently too many of the UI tests fail on non-MSW platforms,
// currently fail under it so disable all interactive tests there. They // so they're disabled there by default. This really, really needs to be fixed,
// should, of course, be reenabled a.s.a.p. // but for now having the UI tests always failing is not helpful as it prevents
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXOSX__) // other test failures from being noticed, so disable them there.
#define WXUISIM_TEST(test) CPPUNIT_TEST(test) #if wxUSE_UIACTIONSIMULATOR
#define WXUISIM_TEST(test) if ( EnableUITests() ) { CPPUNIT_TEST(test) }
#else #else
#define WXUISIM_TEST(test) (void)0 #define WXUISIM_TEST(test)
#endif #endif
// define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants // define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants
@@ -169,6 +170,9 @@ private:
#if wxUSE_GUI #if wxUSE_GUI
// Return true if the UI tests are enabled, used by WXUISIM_TEST().
extern bool EnableUITests();
// Helper function deleting the window without asserts (and hence exceptions // Helper function deleting the window without asserts (and hence exceptions
// thrown from its dtor!) even if it has mouse capture. // thrown from its dtor!) even if it has mouse capture.
void DeleteTestWindow(wxWindow* win); void DeleteTestWindow(wxWindow* win);