diff options
author | Cristian Adam <cristian.adam@qt.io> | 2019-09-10 13:13:30 +0200 |
---|---|---|
committer | Cristian Adam <cristian.adam@qt.io> | 2019-09-10 15:05:59 +0000 |
commit | 486aaabd2141b4a7df58829d924a4a7ed23e69c7 (patch) | |
tree | 92dc127c0720d1a1080b4c3f7817ecbad669a93d /tests/auto | |
parent | 62d16e437a0faf2de55284c19ac6a08797c8d127 (diff) | |
download | qt-creator-486aaabd2141b4a7df58829d924a4a7ed23e69c7.tar.gz |
CMake Build: Use same Qt compiler defines for tests
Source code needed adjustments though.
Change-Id: I78b4610a6bb895a385c7c30a6c92c97a276b89dd
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/cplusplus/lexer/tst_lexer.cpp | 2 | ||||
-rw-r--r-- | tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp | 8 | ||||
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 31 | ||||
-rw-r--r-- | tests/auto/json/tst_json.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/codemodel/check/tst_check.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp | 10 | ||||
-rw-r--r-- | tests/auto/ssh/tst_ssh.cpp | 12 | ||||
-rw-r--r-- | tests/auto/utils/stringutils/tst_stringutils.cpp | 2 |
10 files changed, 40 insertions, 37 deletions
diff --git a/tests/auto/cplusplus/lexer/tst_lexer.cpp b/tests/auto/cplusplus/lexer/tst_lexer.cpp index 72900df698..79548e6fd4 100644 --- a/tests/auto/cplusplus/lexer/tst_lexer.cpp +++ b/tests/auto/cplusplus/lexer/tst_lexer.cpp @@ -127,7 +127,7 @@ void tst_SimpleLexer::run(const QByteArray &source, languageFeatures.flags |= extraLanguageFeatures.flags; lexer.setLanguageFeatures(languageFeatures); } - const Tokens tokens = lexer(source, preserveState ? _state : 0); + const Tokens tokens = lexer(QString::fromUtf8(source), preserveState ? _state : 0); if (preserveState) _state = lexer.state(); diff --git a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp index 6c628c5c7f..005ea5c1fa 100644 --- a/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp +++ b/tests/auto/cplusplus/preprocessor/tst_preprocessor.cpp @@ -217,10 +217,8 @@ public: dir = QFileInfo(currentFileName).dir(); const QFileInfo inc(dir, includedFileName); if (inc.exists()) { - const QString resolved = inc.filePath(); - return resolved.toUtf8().constData(); + return inc.filePath(); } else { - // std::cerr<<"Cannot find " << inc.fileName().toUtf8().constData()<<std::endl; return QString(); } } @@ -418,8 +416,8 @@ QByteArray tst_Preprocessor::simplified(const QByteArray &buf) QList<QByteArray> lines = buf.split('\n'); foreach (const QByteArray &line, lines) { if (!line.startsWith('#')) { - out.append(' '); - out.append(line); + out.append(" "); + out.append(QString::fromUtf8(line)); } } diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index f1413dee6a..e5be41a104 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -281,7 +281,7 @@ static QString parentIName(const QString &iname) struct Value { Value() : value(noValue) {} - Value(const char *str) : value(str) {} + Value(const char *str) : value(QString::fromUtf8(str)) {} Value(const QString &str) : value(str) {} bool matches(const QString &actualValue0, const Context &context) const @@ -595,11 +595,11 @@ struct CheckType : public Check { CheckType(const QByteArray &iname, const Name &name, const Type &type) - : Check(iname, name, noValue, type) + : Check(QString::fromUtf8(iname), name, noValue, type) {} CheckType(const QByteArray &iname, const Type &type) - : Check(iname, noValue, type) + : Check(QString::fromUtf8(iname), noValue, type) {} }; @@ -609,19 +609,23 @@ const QtVersion Qt5 = QtVersion(0x50000); struct Check4 : Check { Check4(const QByteArray &iname, const Value &value, const Type &type) - : Check(iname, value, type) { qtVersionForCheck = Qt4; } + : Check(QString::fromUtf8(iname), value, type) + { qtVersionForCheck = Qt4; } Check4(const QByteArray &iname, const Name &name, const Value &value, const Type &type) - : Check(iname, name, value, type) { qtVersionForCheck = Qt4; } + : Check(QString::fromUtf8(iname), name, value, type) + { qtVersionForCheck = Qt4; } }; struct Check5 : Check { Check5(const QByteArray &iname, const Value &value, const Type &type) - : Check(iname, value, type) { qtVersionForCheck = Qt5; } + : Check(QString::fromUtf8(iname), value, type) + { qtVersionForCheck = Qt5; } Check5(const QByteArray &iname, const Name &name, const Value &value, const Type &type) - : Check(iname, name, value, type) { qtVersionForCheck = Qt5; } + : Check(QString::fromUtf8(iname), name, value, type) + { qtVersionForCheck = Qt5; } }; @@ -733,8 +737,8 @@ public: const Data &operator+(const Profile &profile) const { - profileExtra += profile.contents; - includes += profile.includes; + profileExtra += QString::fromUtf8(profile.contents); + includes += QString::fromUtf8(profile.includes); return *this; } @@ -1613,7 +1617,7 @@ void tst_Dumpers::dumper() contents = output.mid(posDataStart); contents.replace("\\\"", "\""); - actual.fromStringMultiple(contents); + actual.fromStringMultiple(QString::fromLocal8Bit(contents)); context.nameSpace = actual["qtnamespace"].data(); actual = actual["data"]; //qDebug() << "FOUND NS: " << context.nameSpace; @@ -1632,12 +1636,13 @@ void tst_Dumpers::dumper() posNameSpaceStart += sizeof("@NS@") - 1; int posNameSpaceEnd = output.indexOf("@", posNameSpaceStart); QVERIFY(posNameSpaceEnd != -1); - context.nameSpace = output.mid(posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart); + context.nameSpace = QString::fromLocal8Bit(output.mid( + posNameSpaceStart, posNameSpaceEnd - posNameSpaceStart)); //qDebug() << "FOUND NS: " << context.nameSpace; if (context.nameSpace == "::") context.nameSpace.clear(); contents.replace("\\\"", "\""); - actual.fromString(contents); + actual.fromString(QString::fromLocal8Bit(contents)); } else { QByteArray localsAnswerStart("<qtcreatorcdbext>|R|42|"); QByteArray locals("|script|"); @@ -1653,7 +1658,7 @@ void tst_Dumpers::dumper() if (localsBeginPos != -1) localsBeginPos = output.indexOf(locals, localsBeginPos); } while (localsBeginPos != -1); - actual.fromString(contents); + actual.fromString(QString::fromLocal8Bit(contents)); context.nameSpace = actual["result"]["qtnamespace"].data(); actual = actual["result"]["data"]; } diff --git a/tests/auto/json/tst_json.cpp b/tests/auto/json/tst_json.cpp index 1253f00806..cb38a70489 100644 --- a/tests/auto/json/tst_json.cpp +++ b/tests/auto/json/tst_json.cpp @@ -1571,8 +1571,8 @@ void tst_Json::fromBinary() void tst_Json::toAndFromBinary_data() { QTest::addColumn<QString>("filename"); - QTest::newRow("test.json") << (testDataDir + QLatin1String("/test.json")); - QTest::newRow("test2.json") << (testDataDir + QLatin1String("/test2.json")); + QTest::newRow("test.json") << QString(testDataDir + QLatin1String("/test.json")); + QTest::newRow("test2.json") << QString(testDataDir + QLatin1String("/test2.json")); } void tst_Json::toAndFromBinary() diff --git a/tests/auto/qml/codemodel/check/tst_check.cpp b/tests/auto/qml/codemodel/check/tst_check.cpp index 4c9a8e4d65..9f5207284b 100644 --- a/tests/auto/qml/codemodel/check/tst_check.cpp +++ b/tests/auto/qml/codemodel/check/tst_check.cpp @@ -114,7 +114,7 @@ void tst_Check::test() Document::MutablePtr doc = Document::create(path, Dialect::Qml); QFile file(doc->fileName()); file.open(QFile::ReadOnly | QFile::Text); - doc->setSource(file.readAll()); + doc->setSource(QString::fromUtf8(file.readAll())); file.close(); doc->parse(); snapshot.insert(doc); diff --git a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp index 79ce9cec1b..3139e6feca 100644 --- a/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp +++ b/tests/auto/qml/codemodel/dependencies/tst_dependencies.cpp @@ -74,7 +74,7 @@ struct TestData static TestData testData(const QString &path) { QFile file(path); file.open(QFile::ReadOnly | QFile::Text); - const QString content = QString(file.readAll()); + const QString content = QString::fromUtf8(file.readAll()); file.close(); Document::MutablePtr doc = Document::create(path, Dialect::Qml); diff --git a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp index 735daa04f7..ea530d2143 100644 --- a/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp +++ b/tests/auto/qml/codemodel/ecmascript7/tst_ecmascript7.cpp @@ -76,7 +76,7 @@ static TestData testData(const QString &path) { QFile file(path); file.open(QFile::ReadOnly | QFile::Text); - const QString content = QString(file.readAll()); + const QString content = QString::fromUtf8(file.readAll()); file.close(); Document::MutablePtr doc = Document::create(path, Dialect::Qml); @@ -96,7 +96,7 @@ static QStringList readSkipList(const QDir &dir, const QString &filename) return QStringList(); while (!f.atEnd()) { - const QString s = f.readLine().trimmed(); + const QString s = QString::fromUtf8(f.readLine().trimmed()); if (!s.isEmpty()) result << dir.absoluteFilePath(s); } diff --git a/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp b/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp index c42053083e..a17ef2d993 100644 --- a/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp +++ b/tests/auto/qml/qmljssimplereader/tst_qmljssimplereader.cpp @@ -67,7 +67,7 @@ void tst_SimpleReader::testWellFormed() SimpleReaderNode::WeakPtr weak02; { SimpleReader reader; - SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReaderNode::Ptr rootNode = reader.readFromSource(QString::fromUtf8(source)); QVERIFY(reader.errors().isEmpty()); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -130,7 +130,7 @@ void tst_SimpleReader::testIllFormed01() " propertyBlah: false\n" "}\n"; SimpleReader reader; - SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReaderNode::Ptr rootNode = reader.readFromSource(QString::fromUtf8(source)); QVERIFY(!rootNode); QVERIFY(!reader.errors().empty()); @@ -153,7 +153,7 @@ void tst_SimpleReader::testIllFormed02() "}\n"; SimpleReader reader; - SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReaderNode::Ptr rootNode = reader.readFromSource(QString::fromUtf8(source)); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -188,7 +188,7 @@ void tst_SimpleReader::testArrays() const QVariant variant = variantList; SimpleReader reader; - SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReaderNode::Ptr rootNode = reader.readFromSource(QString::fromUtf8(source)); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); @@ -239,7 +239,7 @@ void tst_SimpleReader::testBug01() "}\n"; SimpleReader reader; - SimpleReaderNode::Ptr rootNode = reader.readFromSource(source); + SimpleReaderNode::Ptr rootNode = reader.readFromSource(QString::fromUtf8(source)); QVERIFY(rootNode); QVERIFY(rootNode->isValid()); diff --git a/tests/auto/ssh/tst_ssh.cpp b/tests/auto/ssh/tst_ssh.cpp index dfc60952ae..5283f71960 100644 --- a/tests/auto/ssh/tst_ssh.cpp +++ b/tests/auto/ssh/tst_ssh.cpp @@ -89,10 +89,10 @@ static SshConnectionParameters getParameters() } \ if (params.userName().isEmpty()) \ QSKIP(qPrintable(QString::fromLatin1("No user name provided. Set %1.") \ - .arg(userVar()))); \ + .arg(QString::fromUtf8(userVar())))); \ if (params.privateKeyFile.isEmpty()) \ QSKIP(qPrintable(QString::fromLatin1("No key file provided. Set %1.") \ - .arg(keyFileVar()))); \ + .arg(QString::fromUtf8(keyFileVar())))); \ } while (false) class tst_Ssh : public QObject @@ -234,9 +234,9 @@ void tst_Ssh::remoteProcess() connect(&runner, &SshRemoteProcessRunner::readyReadStandardError, [&remoteStderr, &runner] { remoteStderr += runner.readAllStandardError(); }); if (useTerminal) - runner.runInTerminal(commandLine, params); + runner.runInTerminal(QString::fromUtf8(commandLine), params); else - runner.run(commandLine, params); + runner.run(QString::fromUtf8(commandLine), params); QTimer timer; QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit); timer.setSingleShot(true); @@ -254,7 +254,7 @@ void tst_Ssh::remoteProcess() SshRemoteProcessRunner killer; if (isBlocking) - killer.run("pkill -f -9 \"" + commandLine + '"', params); + killer.run("pkill -f -9 \"" + QString::fromUtf8(commandLine) + '"', params); timer.start(); loop.exec(); @@ -285,7 +285,7 @@ void tst_Ssh::remoteProcessChannels() QByteArray remoteStderr; QByteArray remoteData; SshRemoteProcessPtr echoProcess - = connection.createRemoteProcess("printf " + testString + " >&2"); + = connection.createRemoteProcess("printf " + QString::fromUtf8(testString) + " >&2"); echoProcess->setReadChannel(QProcess::StandardError); QEventLoop loop; connect(echoProcess.get(), &SshRemoteProcess::done, &loop, &QEventLoop::quit); diff --git a/tests/auto/utils/stringutils/tst_stringutils.cpp b/tests/auto/utils/stringutils/tst_stringutils.cpp index 98e04185ab..010e6ce8b4 100644 --- a/tests/auto/utils/stringutils/tst_stringutils.cpp +++ b/tests/auto/utils/stringutils/tst_stringutils.cpp @@ -194,7 +194,7 @@ void tst_StringUtils::testStripAccelerator() { QFETCH(QString, expected); - QCOMPARE(Utils::stripAccelerator(QTest::currentDataTag()), expected); + QCOMPARE(Utils::stripAccelerator(QString::fromUtf8(QTest::currentDataTag())), expected); } void tst_StringUtils::testStripAccelerator_data() |