summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp')
-rw-r--r--tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
index 7b80152b62..797d5ff5e3 100644
--- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
@@ -159,8 +159,8 @@ private slots:
void isBundle_data();
void isBundle();
- void isLocalFs_data();
- void isLocalFs();
+ void isNativePath_data();
+ void isNativePath();
void refresh();
@@ -1222,10 +1222,13 @@ void tst_QFileInfo::isBundle()
QCOMPARE(fi.isBundle(), isBundle);
}
-void tst_QFileInfo::isLocalFs_data()
+void tst_QFileInfo::isNativePath_data()
{
QTest::addColumn<QString>("path");
- QTest::addColumn<bool>("isLocalFs");
+ QTest::addColumn<bool>("isNativePath");
+
+ QTest::newRow("default-constructed") << QString() << false;
+ QTest::newRow("empty") << QString("") << true;
QTest::newRow("local root") << QString::fromLatin1("/") << true;
QTest::newRow("local non-existent file") << QString::fromLatin1("/abrakadabra.boo") << true;
@@ -1233,17 +1236,15 @@ void tst_QFileInfo::isLocalFs_data()
QTest::newRow("qresource root") << QString::fromLatin1(":/") << false;
}
-void tst_QFileInfo::isLocalFs()
+void tst_QFileInfo::isNativePath()
{
QFETCH(QString, path);
- QFETCH(bool, isLocalFs);
+ QFETCH(bool, isNativePath);
QFileInfo info(path);
- QFileInfoPrivate *privateInfo = getPrivate(info);
- QCOMPARE((privateInfo->fileEngine == 0), isLocalFs);
- if (privateInfo->fileEngine)
- QCOMPARE(bool(privateInfo->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag)
- & QAbstractFileEngine::LocalDiskFlag), isLocalFs);
+ if (path.isNull())
+ info = QFileInfo();
+ QCOMPARE(info.isNativePath(), isNativePath);
}
void tst_QFileInfo::refresh()
@@ -1722,7 +1723,13 @@ void tst_QFileInfo::group()
#if defined(Q_OS_UNIX)
struct group *gr;
gid_t gid = getegid();
+
+ errno = 0;
gr = getgrgid(gid);
+
+ QVERIFY2(gr, qPrintable(
+ QString("getgrgid returned 0: %1, cannot determine my own group")
+ .arg(QString::fromLocal8Bit(strerror(errno)))));
expected = QString::fromLocal8Bit(gr->gr_name);
#endif