From f60c03d5bb03ba42955ce309a1765795f33e9bc1 Mon Sep 17 00:00:00 2001 From: kh1 Date: Thu, 15 Mar 2012 11:42:34 +0100 Subject: Fix formating and build with QT_NO_CAST_FROM_ASCII. Change-Id: I00e4b1ec840d976dbfc7f0138726692a770aadba Reviewed-by: Niels Weber Reviewed-by: Tim Jenssen --- .../environmentvariabletest.cpp | 4 +-- tests/fileengineclient/fileengineclient.cpp | 33 ++++++++++++---------- tests/fileengineserver/fileengineserver.cpp | 4 +-- 3 files changed, 22 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/environmentvariable/environmentvariabletest.cpp b/tests/environmentvariable/environmentvariabletest.cpp index b3088cfb2..453559a62 100644 --- a/tests/environmentvariable/environmentvariabletest.cpp +++ b/tests/environmentvariable/environmentvariabletest.cpp @@ -66,7 +66,7 @@ void EnvironmentVariableTest::testPersistentNonSystem() QVERIFY2(ok, qPrintable(op.errorString())); // Verify now... - QSettings settings("HKEY_CURRENT_USER\\Environment", QSettings::NativeFormat); + QSettings settings(QLatin1String("HKEY_CURRENT_USER\\Environment"), QSettings::NativeFormat); QVERIFY(value == settings.value(key).toString()); // Remove the setting @@ -94,7 +94,7 @@ void EnvironmentVariableTest::testNonPersistentNonSystem() QVERIFY2(ok, qPrintable(op.errorString())); - QString comp = qgetenv(qPrintable(key)); + QString comp = QString::fromLocal8Bit(qgetenv(qPrintable(key))); QCOMPARE(value, comp); } diff --git a/tests/fileengineclient/fileengineclient.cpp b/tests/fileengineclient/fileengineclient.cpp index 33f8fff53..4dfa3e95a 100644 --- a/tests/fileengineclient/fileengineclient.cpp +++ b/tests/fileengineclient/fileengineclient.cpp @@ -33,7 +33,7 @@ #include #include -#include +#include #include #include @@ -47,7 +47,7 @@ public: { m_process = processWrapper; QObject::connect(m_process, SIGNAL(readyRead()), - this, SLOT(readProcessOutput()), Qt::DirectConnection ); + this, SLOT(readProcessOutput()), Qt::DirectConnection); } void clearSavedOutPut() { m_savedOutPut.clear(); } QByteArray savedOutPut() { return m_savedOutPut; } @@ -58,10 +58,11 @@ public slots: Q_ASSERT(m_process); Q_ASSERT(QThread::currentThread() == m_process->thread()); if (QThread::currentThread() != m_process->thread()) { - qDebug() << Q_FUNC_INFO << QLatin1String(" can only be called from the same thread as the process is.") ; + qDebug() << Q_FUNC_INFO << QLatin1String("can only be called from the same thread as the " + "process is."); } const QByteArray output = m_process->readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { m_savedOutPut.append(output); qDebug() << output; } @@ -75,18 +76,19 @@ private: int main(int argc, char **argv) { - QApplication app(argc, argv); + QCoreApplication app(argc, argv); QString fileName(QLatin1String("give_me_some_output.bat")); QFile file(fileName); if (file.exists() && !file.remove()) { - qFatal( qPrintable( QString("something is wrong, can not delete: %1").arg(file.fileName()) ) ); + qFatal(qPrintable(QString::fromLatin1("something is wrong, can not delete: %1").arg(file.fileName()))); return -1; } if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { - qFatal( qPrintable( QString("something is wrong, can not open for writing to: %1").arg(file.fileName()) ) ); + qFatal(qPrintable(QString::fromLatin1("something is wrong, can not open for writing to: %1") + .arg(file.fileName()))); return -2; } @@ -94,7 +96,7 @@ int main(int argc, char **argv) out << QLatin1String("echo mega test output"); if (!file.flush()) { - qFatal( qPrintable( QString("something is wrong, can not write to: %1").arg(file.fileName()) ) ); + qFatal(qPrintable(QString::fromLatin1("something is wrong, can not write to: %1").arg(file.fileName()))); return -3; } file.close(); @@ -110,7 +112,7 @@ int main(int argc, char **argv) qDebug() << "1"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -118,7 +120,7 @@ int main(int argc, char **argv) qDebug() << "2"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -126,7 +128,7 @@ int main(int argc, char **argv) qDebug() << "3"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -146,7 +148,7 @@ int main(int argc, char **argv) qDebug() << "1"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -154,7 +156,7 @@ int main(int argc, char **argv) qDebug() << "2"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -162,7 +164,7 @@ int main(int argc, char **argv) qDebug() << "3"; { const QByteArray output = process.readAll(); - if( !output.isEmpty() ) { + if (!output.isEmpty()) { qDebug() << output; } } @@ -170,7 +172,8 @@ int main(int argc, char **argv) } if (firstOutPut != secondOutPut) { - qFatal( qPrintable( QString("Test failed: output is different between a normal QProcess and QProcessWrapper").arg(file.fileName()) ) ); + qFatal(qPrintable(QString::fromLatin1("Test failed: output is different between a normal QProcess " + "and QProcessWrapper: %1").arg(file.fileName()))); return -2; } else { qDebug() << QLatin1String("Test OK: QProcess works as expected."); diff --git a/tests/fileengineserver/fileengineserver.cpp b/tests/fileengineserver/fileengineserver.cpp index a1e2d121c..9b53c8f91 100644 --- a/tests/fileengineserver/fileengineserver.cpp +++ b/tests/fileengineserver/fileengineserver.cpp @@ -32,11 +32,11 @@ #include -#include +#include int main(int argc, char **argv) { - QApplication app(argc, argv); + QCoreApplication app(argc, argv); FSEngineServer server(39999); server.enableTestMode(); return app.exec(); -- cgit v1.2.3