diff options
author | Pasi Petäjäjärvi <pasi.petajajarvi@digia.com> | 2013-02-11 12:08:34 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-02-13 10:00:28 (GMT) |
commit | 5314de3edc93c6c3897f6b4068cef3763aa86cf3 (patch) | |
tree | 294aab0da92297c5726ab5e6e2d502544b126546 /tests | |
parent | 841dd0b9486150b7cbccbab41553ab6b4d13627d (diff) | |
download | Qt-5314de3edc93c6c3897f6b4068cef3763aa86cf3.zip Qt-5314de3edc93c6c3897f6b4068cef3763aa86cf3.tar.gz Qt-5314de3edc93c6c3897f6b4068cef3763aa86cf3.tar.bz2 |
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: I7875520965bf2c0c7311fb051c1f5177e9c3685b
(cherry picked from qtbase/05b4000e01ff5785739617c3069fbe0b0d36a606)
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdir/tst_qdir.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 32a66d8..5036842 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -1395,6 +1395,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('/')); |