Commit b3f9d6e4 authored by Volker Krause's avatar Volker Krause
Browse files

Fix Windows unit tests

parent f3d3283d
Pipeline #166583 passed with stages
in 4 minutes and 19 seconds
......@@ -15,4 +15,4 @@ Dependencies:
Options:
cmake-options: "-DBUILD_STANDALONE_APP=ON"
require-passing-tests-on: [ 'Linux', 'FreeBSD' ]
require-passing-tests-on: [ 'Linux', 'FreeBSD', 'Windows' ]
......@@ -24,14 +24,14 @@ private Q_SLOTS:
QVERIFY(!p.hasError());
QFile outFile(QStringLiteral("parser-test.mapcss.out"));
QVERIFY(outFile.open(QFile::WriteOnly));
QVERIFY(outFile.open(QFile::WriteOnly | QFile::Text));
style.write(&outFile);
outFile.close();
QVERIFY(outFile.open(QFile::ReadOnly));
QVERIFY(outFile.open(QFile::ReadOnly | QFile::Text));
const auto b1 = outFile.readAll();
QFile refFile(QStringLiteral(SOURCE_DIR "/data/mapcss/parser-test.mapcss.ref"));
QVERIFY(refFile.open(QFile::ReadOnly));
QVERIFY(refFile.open(QFile::ReadOnly | QFile::Text));
const auto b2 = refFile.readAll();
if (b1 != b2) {
......
......@@ -106,7 +106,7 @@ private Q_SLOTS:
QVERIFY(!result.empty());
QFile outFile(QFileInfo(expected).fileName());
QVERIFY(outFile.open(QFile::ReadWrite | QFile::Truncate));
QVERIFY(outFile.open(QFile::ReadWrite | QFile::Truncate | QFile::Text));
for (const auto &platform : result) {
outFile.write(platform.name().toUtf8() + "\n");
......@@ -142,7 +142,7 @@ private Q_SLOTS:
const auto platforms = outFile.readAll();
QFile expectedFile(expected);
QVERIFY(expectedFile.open(QFile::ReadOnly));
QVERIFY(expectedFile.open(QFile::ReadOnly | QFile::Text));
const auto expectedPlatforms = expectedFile.readAll();
if (platforms != expectedPlatforms) {
......
......@@ -95,13 +95,12 @@ STRING ["]{STRING_ELEMENT}*["]
{HEXCOLOR8} {
// the 32bit signed version of strtol isn't good enough for 32bit unsigned
#if Q_PROCESSOR_WORDSIZE == 8
yylval->uintVal = strtol(yytext + 1, nullptr, 16);
#elif Q_PROCESSOR_WORDSIZE == 4
yylval->uintVal = strtoll(yytext + 1, nullptr, 16);
#else
#error unknown wordsize!?
#endif
static_assert(sizeof(long) == 4 || sizeof(long) == 8);
if constexpr (sizeof(long) == 8) {
yylval->uintVal = strtol(yytext + 1, nullptr, 16);
} else if constexpr (sizeof(long) == 4) {
yylval->uintVal = strtoll(yytext + 1, nullptr, 16);
}
return T_HEX_COLOR;
}
{HEXCOLOR6} {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment