Add a helper IsRunningUnderXvfb() function to the test suite

This will allow disabling some tests which fail when running only under
Xvfb.

The new function doesn't work automatically because there doesn't seem
to be any way to distinguish it from the usual server, so it just checks
whether wxUSE_XVFB=1 is set in the environment, as is done by Travis CI
build script.
This commit is contained in:
Vadim Zeitlin
2019-07-17 14:37:19 +02:00
parent 7425fd0c50
commit ee0f21388f
2 changed files with 14 additions and 0 deletions

View File

@@ -406,6 +406,18 @@ extern bool IsAutomaticTest()
return s_isAutomatic == 1; return s_isAutomatic == 1;
} }
extern bool IsRunningUnderXVFB()
{
static int s_isRunningUnderXVFB = -1;
if ( s_isRunningUnderXVFB == -1 )
{
wxString value;
s_isRunningUnderXVFB = wxGetEnv("wxUSE_XVFB", &value) && value == "1";
}
return s_isRunningUnderXVFB == 1;
}
#if wxUSE_GUI #if wxUSE_GUI
bool EnableUITests() bool EnableUITests()

View File

@@ -121,6 +121,8 @@ extern bool IsNetworkAvailable();
extern bool IsAutomaticTest(); extern bool IsAutomaticTest();
extern bool IsRunningUnderXVFB();
// Helper class setting the locale to the given one for its lifetime. // Helper class setting the locale to the given one for its lifetime.
class LocaleSetter class LocaleSetter
{ {