diff options
author | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 18:21:05 (GMT) |
---|---|---|
committer | Shane Kearns <shane.kearns@accenture.com> | 2010-11-16 18:36:05 (GMT) |
commit | 43aa80fe8c1064d88b104a8f8f1b97bbaeaf1cec (patch) | |
tree | 3175dff7ed0677ed6b28ea0dc74331f227afdee8 /tests/auto/qfile | |
parent | bc6d6b99981f5abf4d8f4059f86f0441156b6700 (diff) | |
download | Qt-43aa80fe8c1064d88b104a8f8f1b97bbaeaf1cec.zip Qt-43aa80fe8c1064d88b104a8f8f1b97bbaeaf1cec.tar.gz Qt-43aa80fe8c1064d88b104a8f8f1b97bbaeaf1cec.tar.bz2 |
Test coverage: test QFile::resize
Reviewed-By: joao
Diffstat (limited to 'tests/auto/qfile')
-rw-r--r-- | tests/auto/qfile/tst_qfile.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp index 088c1f2..53618e5 100644 --- a/tests/auto/qfile/tst_qfile.cpp +++ b/tests/auto/qfile/tst_qfile.cpp @@ -211,6 +211,9 @@ private slots: void openStandardStreams(); + void resize_data(); + void resize(); + // --- Task related tests below this line void task167217(); @@ -3085,5 +3088,28 @@ void tst_QFile::writeNothing() } } +void tst_QFile::resize_data() +{ + QTest::addColumn<int>("filetype"); + + QTest::newRow("native") << int(OpenQFile); + QTest::newRow("fileno") << int(OpenFd); + QTest::newRow("stream") << int(OpenStream); +} + +void tst_QFile::resize() +{ + QFETCH(int, filetype); + QString filename(QLatin1String("file.txt")); + QFile file(filename); + QVERIFY(openFile(file, QIODevice::ReadWrite, FileType(filetype))); + QVERIFY(file.resize(8)); + QCOMPARE(file.size(), qint64(8)); + closeFile(file); + QFile::resize(filename, 4); + QCOMPARE(QFileInfo(filename).size(), qint64(4)); + QVERIFY(QFile::remove(filename)); +} + QTEST_MAIN(tst_QFile) #include "tst_qfile.moc" |