summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-11-16 15:11:09 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-11-17 13:00:58 (GMT)
commit72ee915bb0465549b7ca8e62d2af146cc44fdeac (patch)
treeec850793382e74a1e77728c45b475262995e7011 /tests/auto
parent98a05681851db9d88b1364af52be543715fbe306 (diff)
downloadQt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.zip
Qt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.tar.gz
Qt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.tar.bz2
Fix regression introduced in c08e708037d33271825ce6a6a1ac640e96b70c36
When writing nothing to a file, not actually writing anything is not an error. Also, from a change introduced in the same commit, there is no point in checking for EOF when writing. Task-number: QTBUG-5847 Reviewed-by: Olivier Goffart
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qfile/tst_qfile.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qfile/tst_qfile.cpp b/tests/auto/qfile/tst_qfile.cpp
index b3d6fd9..d545909 100644
--- a/tests/auto/qfile/tst_qfile.cpp
+++ b/tests/auto/qfile/tst_qfile.cpp
@@ -210,6 +210,7 @@ private slots:
void task167217();
void openDirectory();
+ void writeNothing();
public:
// disabled this test for the moment... it hangs
@@ -2840,5 +2841,16 @@ void tst_QFile::openStandardStreams()
}
}
+void tst_QFile::writeNothing()
+{
+ for (int i = 0; i < 3; ++i) {
+ QFile file("file.txt");
+ QVERIFY( openFile(file, QIODevice::WriteOnly | QIODevice::Unbuffered, FileType(i)) );
+ QVERIFY( 0 == file.write((char *)0, 0) );
+ QCOMPARE( file.error(), QFile::NoError );
+ closeFile(file);
+ }
+}
+
QTEST_MAIN(tst_QFile)
#include "tst_qfile.moc"