summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-08-07 00:18:45 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-14 20:21:19 +0200
commita2fbe8056cfad33eee5a4752e6f61230d5ac96da (patch)
treef47923eebc1a3d23449dfd3cfd1b101650c72bc4 /src/testlib
parentbdd682ea4cc21938eed080817fb931d362d8231a (diff)
QtTestLib: use new qEnvironmentVariableIsEmpty()
Except where using the contents of the variable, in which case collapse two calls to qgetenv() for the same variable into one that stores the result in a temporary QByteArray and continues working with that one instead. Change-Id: I6c09a20ae946327ccb85e4833a60a373a8a07355 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 296bc96c4b..73acf01708 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1084,7 +1084,7 @@ QT_BEGIN_NAMESPACE
static bool installCoverageTool(const char * appname, const char * testname)
{
#ifdef __COVERAGESCANNER__
- if (!qgetenv("QT_TESTCOCOON_ACTIVE").isEmpty())
+ if (!qEnvironmentVariableIsEmpty("QT_TESTCOCOON_ACTIVE"))
return false;
// Set environment variable QT_TESTCOCOON_ACTIVE to prevent an eventual subtest from
// being considered as a stand-alone test regarding the coverage analysis.
@@ -1162,8 +1162,9 @@ static void invokeMethod(QObject *obj, const char *methodName)
int defaultEventDelay()
{
if (eventDelay == -1) {
- if (!qgetenv("QTEST_EVENT_DELAY").isEmpty())
- eventDelay = atoi(qgetenv("QTEST_EVENT_DELAY"));
+ const QByteArray env = qgetenv("QTEST_EVENT_DELAY");
+ if (!env.isEmpty())
+ eventDelay = atoi(env.constData());
else
eventDelay = 0;
}
@@ -1173,8 +1174,9 @@ int defaultEventDelay()
int Q_TESTLIB_EXPORT defaultMouseDelay()
{
if (mouseDelay == -1) {
- if (!qgetenv("QTEST_MOUSEEVENT_DELAY").isEmpty())
- mouseDelay = atoi(qgetenv("QTEST_MOUSEEVENT_DELAY"));
+ const QByteArray env = qgetenv("QTEST_MOUSEEVENT_DELAY");
+ if (!env.isEmpty())
+ mouseDelay = atoi(env.constData());
else
mouseDelay = defaultEventDelay();
}
@@ -1184,8 +1186,9 @@ int Q_TESTLIB_EXPORT defaultMouseDelay()
int Q_TESTLIB_EXPORT defaultKeyDelay()
{
if (keyDelay == -1) {
- if (!qgetenv("QTEST_KEYEVENT_DELAY").isEmpty())
- keyDelay = atoi(qgetenv("QTEST_KEYEVENT_DELAY").constData());
+ const QByteArray env = qgetenv("QTEST_KEYEVENT_DELAY");
+ if (!env.isEmpty())
+ keyDelay = atoi(env.constData());
else
keyDelay = defaultEventDelay();
}