Windows: Fix qabstractfilenengine-test.
The test fails if the repository is checked out with Windows line endings. Try to work around. Basically, ensure that common developers can conveniently run the test. Change-Id: I91f31b830ba7ba305deea782737d4e07a89420eb Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>bb10
parent
9e09b8dc48
commit
f0942bd8cb
|
|
@ -598,11 +598,25 @@ void tst_QAbstractFileEngine::fileIO()
|
|||
{
|
||||
// Reading
|
||||
QFile file(fileName);
|
||||
|
||||
QVERIFY(!file.isOpen());
|
||||
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Unbuffered));
|
||||
|
||||
/* For an exact match, this test requires the repository to
|
||||
* be checked out with UNIX-style line endings on Windows.
|
||||
* Try to succeed also for the common case of checking out with autocrlf
|
||||
* by reading the file as text and checking if the size matches
|
||||
* the original size + the '\r' characters added by autocrlf. */
|
||||
|
||||
QFile::OpenMode openMode = QIODevice::ReadOnly | QIODevice::Unbuffered;
|
||||
#ifdef Q_OS_WIN
|
||||
openMode |= QIODevice::Text;
|
||||
#endif
|
||||
QVERIFY(file.open(openMode));
|
||||
QVERIFY(file.isOpen());
|
||||
#ifdef Q_OS_WIN
|
||||
const qint64 convertedSize = fileSize + readContent.count('\n');
|
||||
if (file.size() == convertedSize)
|
||||
fileSize = convertedSize;
|
||||
#endif
|
||||
QCOMPARE(file.size(), fileSize);
|
||||
QCOMPARE(file.pos(), qint64(0));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue