summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtemporaryfile
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-07-07 08:50:33 (GMT)
committeraxis <qt-info@nokia.com>2009-07-07 08:50:33 (GMT)
commit1e192edd72789241e7397dcbc5ee326b2aed5790 (patch)
tree430961aed08cdfa25717bde84c3f74a2f75673fe /tests/auto/qtemporaryfile
parent2aac0c8b71fffd7c0335c1429bd1f2405adaa5e7 (diff)
parent343e8b7e75c98a4fd1b692a230de8d1132988705 (diff)
downloadQt-1e192edd72789241e7397dcbc5ee326b2aed5790.zip
Qt-1e192edd72789241e7397dcbc5ee326b2aed5790.tar.gz
Qt-1e192edd72789241e7397dcbc5ee326b2aed5790.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: configure.exe src/network/access/qhttpnetworkconnection_p.h tests/auto/qstyle/qstyle.pro tests/auto/qstyle/tst_qstyle.cpp tools/configure/configureapp.cpp configure.exe will be recompiled in next commit. Took ours.
Diffstat (limited to 'tests/auto/qtemporaryfile')
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index dde4946..1677972 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -92,6 +92,7 @@ private slots:
void rename();
void renameFdLeak();
void reOpenThroughQFile();
+ void keepOpenMode();
public:
};
@@ -443,5 +444,37 @@ void tst_QTemporaryFile::reOpenThroughQFile()
QCOMPARE(file.readAll(), data);
}
+void tst_QTemporaryFile::keepOpenMode()
+{
+ QByteArray data("abcdefghij");
+
+ {
+ QTemporaryFile file;
+ QVERIFY(((QFile &)file).open(QIODevice::WriteOnly));
+ QVERIFY(QIODevice::WriteOnly == file.openMode());
+
+ QCOMPARE(file.write(data), (qint64)data.size());
+ file.close();
+
+ QVERIFY(((QFile &)file).open(QIODevice::ReadOnly));
+ QVERIFY(QIODevice::ReadOnly == file.openMode());
+ QCOMPARE(file.readAll(), data);
+ }
+
+ {
+ QTemporaryFile file;
+ QVERIFY(file.open());
+ QCOMPARE(file.write(data), (qint64)data.size());
+ QVERIFY(file.rename("temporary-file.txt"));
+
+ QVERIFY(((QFile &)file).open(QIODevice::ReadOnly));
+ QVERIFY(QIODevice::ReadOnly == file.openMode());
+ QCOMPARE(file.readAll(), data);
+
+ QVERIFY(((QFile &)file).open(QIODevice::WriteOnly));
+ QVERIFY(QIODevice::WriteOnly == file.openMode());
+ }
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"