summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfile
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@accenture.com>2010-11-17 12:29:54 (GMT)
committerShane Kearns <shane.kearns@accenture.com>2010-11-17 17:11:05 (GMT)
commit5ebad6878478c33f8a832929a2fb74e93bc29b62 (patch)
tree0c7287a9e0782cbc37ea62e079a5605b81949949 /tests/auto/qfile
parentf50098de5af1886f69214285345ef7ef4ebdc1fd (diff)
downloadQt-5ebad6878478c33f8a832929a2fb74e93bc29b62.zip
Qt-5ebad6878478c33f8a832929a2fb74e93bc29b62.tar.gz
Qt-5ebad6878478c33f8a832929a2fb74e93bc29b62.tar.bz2
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
Diffstat (limited to 'tests/auto/qfile')
-rw-r--r--tests/auto/qfile/tst_qfile.cpp18
1 files changed, 18 insertions, 0 deletions
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"