summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfileinfo
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-11-16 16:20:44 +0000
committerShane Kearns <shane.kearns@accenture.com>2010-11-16 18:36:03 +0000
commiteab60b677c6e61c2d31f7aec02f05eb9c12862c9 (patch)
tree4774059a57c104ecc366fcf1446c018fd22c3a6c /tests/auto/qfileinfo
parent5a9b670ef04232c7cd5017bd5e241c6ed975be6e (diff)
test coverage: test QFileInfo::group()
Reviewed-By: joao
Diffstat (limited to 'tests/auto/qfileinfo')
-rw-r--r--tests/auto/qfileinfo/tst_qfileinfo.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp
index d021df5bac..3e67fb8bd0 100644
--- a/tests/auto/qfileinfo/tst_qfileinfo.cpp
+++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp
@@ -189,6 +189,7 @@ private slots:
#if !defined(Q_OS_WINCE) && !defined(Q_OS_SYMBIAN)
void owner();
#endif
+ void group();
};
tst_QFileInfo::tst_QFileInfo()
@@ -1690,5 +1691,29 @@ void tst_QFileInfo::owner()
}
#endif
+void tst_QFileInfo::group()
+{
+ QString expected;
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ struct group *gr;
+ gid_t gid = getegid();
+ gr = getgrgid(gid);
+ expected = QString::fromLocal8Bit(gr->gr_name);
+#endif
+
+ QString fileName("ownertest.txt");
+ if (QFile::exists(fileName))
+ QFile::remove(fileName);
+ QFile testFile(fileName);
+ QVERIFY(testFile.open(QIODevice::WriteOnly | QIODevice::Text));
+ QByteArray testData("testfile");
+ QVERIFY(testFile.write(testData) != -1);
+ testFile.close();
+ QFileInfo fi(fileName);
+ QVERIFY(fi.exists());
+
+ QCOMPARE(fi.group(), expected);
+}
+
QTEST_MAIN(tst_QFileInfo)
#include "tst_qfileinfo.moc"