tst_QTemporaryFile: test value of openMode() after open().

I had a doubt about what it would be, turns out it's ReadWrite.
Turns out it's documented, too :-)

Change-Id: I87c2ffc81aa240ffa88c495fe250b022d7fb3c21
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
David Faure 2016-01-23 21:21:13 +01:00
parent 0668d08b87
commit e8ed29d679

View File

@ -540,15 +540,16 @@ void tst_QTemporaryFile::keepOpenMode()
{
QTemporaryFile file;
QVERIFY(file.open());
QCOMPARE(file.openMode(), QIODevice::ReadWrite);
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.openMode(), QIODevice::ReadOnly);
QCOMPARE(file.readAll(), data);
QVERIFY(((QFile &)file).open(QIODevice::WriteOnly));
QVERIFY(QIODevice::WriteOnly == file.openMode());
QCOMPARE(file.openMode(), QIODevice::WriteOnly);
}
}