From 5ebad6878478c33f8a832929a2fb74e93bc29b62 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 17 Nov 2010 12:29:54 +0000 Subject: Test coverage: test more of QFile API Adding tests for these functions: symLinkTarget / readLink (static & non static) permissions (static) constructors which take a QObject parent After this, all function of QFile API are tested except encoding/decoding functions and some QT3_SUPPORT inlines in the header. Reviewed-by: joao --- tests/auto/qfile/tst_qfile.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 53618e5..f60ab1e 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -214,6 +214,8 @@ private slots: void resize_data(); void resize(); + void objectConstructors(); + // --- Task related tests below this line void task167217(); @@ -1112,6 +1114,7 @@ void tst_QFile::permissions() QFETCH(bool, expected); QFile f(file); QCOMPARE(((f.permissions() & perms) == QFile::Permissions(perms)), expected); + QCOMPARE(((QFile::permissions(file) & perms) == QFile::Permissions(perms)), expected); } void tst_QFile::setPermissions() @@ -1299,6 +1302,12 @@ void tst_QFile::link() QVERIFY(info2.isSymLink()); QCOMPARE(info2.symLinkTarget(), info1.absoluteFilePath()); + QFile link("myLink.lnk"); + QVERIFY(link.open(QIODevice::ReadOnly)); + QCOMPARE(link.symLinkTarget(), info1.absoluteFilePath()); + link.close(); + QCOMPARE(QFile::symLinkTarget("myLink.lnk"), info1.absoluteFilePath()); + #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) QString wd = getWorkingDirectoryForLink(info2.absoluteFilePath()); QCOMPARE(QDir::fromNativeSeparators(wd), info1.absolutePath()); @@ -3111,5 +3120,14 @@ void tst_QFile::resize() QVERIFY(QFile::remove(filename)); } +void tst_QFile::objectConstructors() +{ + QObject ob; + QFile* file1 = new QFile(SRCDIR "testfile.txt", &ob); + QFile* file2 = new QFile(&ob); + QVERIFY(file1->exists()); + QVERIFY(!file2->exists()); +} + QTEST_MAIN(tst_QFile) #include "tst_qfile.moc" -- cgit v0.12