summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-05-18 12:58:44 (GMT)
committerJoão Abecasis <joao@abecasis.name>2009-05-22 12:33:45 (GMT)
commitf1793cbff8aa9b4adcb5fd511e495f7e96811e2b (patch)
tree9d79221828ffe31ea252353b38d213c45ad5fbde /tests
parent5cb1ed45ba55dbc9752e0f6f47cc6d1525464646 (diff)
downloadQt-f1793cbff8aa9b4adcb5fd511e495f7e96811e2b.zip
Qt-f1793cbff8aa9b4adcb5fd511e495f7e96811e2b.tar.gz
Qt-f1793cbff8aa9b4adcb5fd511e495f7e96811e2b.tar.bz2
Unconditionally open temporary files in ReadWrite mode
Although QTemporaryFile hides QFile::open(OpenMode), this function is still available when accessing instance methods through the base class. Unconditionally setting ReadWrite allows the temporary file to be re-opened with different flags. Task-number: 248223 Reviewed-by: Thiago
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
index c6a43ff..26f5f40 100644
--- a/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
+++ b/tests/auto/qtemporaryfile/tst_qtemporaryfile.cpp
@@ -87,6 +87,8 @@ private slots:
void stressTest();
void rename();
void renameFdLeak();
+ void reOpenThroughQFile();
+
public:
};
@@ -424,5 +426,18 @@ void tst_QTemporaryFile::renameFdLeak()
#endif
}
+void tst_QTemporaryFile::reOpenThroughQFile()
+{
+ QByteArray data("abcdefghij");
+
+ QTemporaryFile file;
+ QVERIFY(((QFile &)file).open(QIODevice::WriteOnly));
+ QCOMPARE(file.write(data), (qint64)data.size());
+
+ file.close();
+ QVERIFY(file.open());
+ QCOMPARE(file.readAll(), data);
+}
+
QTEST_MAIN(tst_QTemporaryFile)
#include "tst_qtemporaryfile.moc"