wasm: qabstractfileengine test fails on wasm/windows

The test assumes either windows or unix line endings, however
wasm can run on either system, causing problem with
git config core.autocrlf=true
Fix the test so that on wasm we correct filesize if
necessary

Change-Id: Ieb86c5388aa931d8ca06822e1c09a2c55801de67
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
Even Oscar Andersen 2024-04-15 16:43:37 +02:00
parent 3217c563a4
commit 9e57e523d3

View File

@ -621,12 +621,12 @@ void tst_QAbstractFileEngine::fileIO()
* the original size + the '\r' characters added by autocrlf. */
QFile::OpenMode openMode = QIODevice::ReadOnly | QIODevice::Unbuffered;
#ifdef Q_OS_WIN
#if defined (Q_OS_WIN) || defined(Q_OS_WASM)
openMode |= QIODevice::Text;
#endif
QVERIFY(file.open(openMode));
QVERIFY(file.isOpen());
#ifdef Q_OS_WIN
#if defined(Q_OS_WIN) || defined(Q_OS_WASM)
const qint64 convertedSize = fileSize + readContent.count('\n');
if (file.size() == convertedSize)
fileSize = convertedSize;