diff options
author | Pasi Petäjäjärvi <pasi.petajajarvi@digia.com> | 2013-01-02 17:43:39 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-25 08:51:09 +0100 |
commit | 05b4000e01ff5785739617c3069fbe0b0d36a606 (patch) | |
tree | 351c09c3fb919507003a9ebac09d71cd8d850cde /tests | |
parent | a909dd0ea48af9428dbbeac1504df0eb68b63df4 (diff) |
Fixed checking HOME variable return value using isEmpty()
Return value of the QFile::decodeName(qgetenv("HOME")); is never null
if HOME environment variable is not set. So need to check the return
value using isEmpty() instead.
Task-number: QTBUG-28912
Change-Id: Ic57b1978d63e99b056cde35ca8cb9d2a07ff8ce8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/io/qdir/tst_qdir.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 7799d40de7..d44ef167b5 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1344,6 +1344,14 @@ void tst_QDir::homePath() #ifdef Q_OS_UNIX if (strHome.length() > 1) // root dir = "/" QVERIFY(!strHome.endsWith('/')); + + QByteArray envHome = qgetenv("HOME"); +#if !defined(_WRS_KERNEL) // unsetenv is not available on VxWorks DKM mode + unsetenv("HOME"); +#endif + QCOMPARE(QDir::homePath(), QDir::rootPath()); + qputenv("HOME", envHome); + #elif defined(Q_OS_WIN) if (strHome.length() > 3) // root dir = "c:/"; "//" is not really valid... QVERIFY(!strHome.endsWith('/')); |