summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-02-12 01:39:47 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-17 05:25:56 +0100
commitb838170cebc8d1adefc6c8de34e6a39494ffd75e (patch)
tree876b5edca2939ac9c402c0bb81a96b8220b981b5 /tests/auto
parent2193df65a380e27b839bae3dc63ad7496af575e8 (diff)
QDebug: Add support for %{pid}, %{appname} and %{threadid}
Change-Id: I4add0a374e6524b615c6dc0ecfb010a90075b04f Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/corelib/global/qlogging/app/main.cpp7
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp10
2 files changed, 10 insertions, 7 deletions
diff --git a/tests/auto/corelib/global/qlogging/app/main.cpp b/tests/auto/corelib/global/qlogging/app/main.cpp
index c26b29ea56..dfa52315c7 100644
--- a/tests/auto/corelib/global/qlogging/app/main.cpp
+++ b/tests/auto/corelib/global/qlogging/app/main.cpp
@@ -39,15 +39,18 @@
**
****************************************************************************/
-#include <qglobal.h>
+#include <QCoreApplication>
struct T {
T() { qDebug("static constructor"); }
~T() { qDebug("static destructor"); }
} t;
-int main(int, char **)
+int main(int argc, char **argv)
{
+ QCoreApplication app(argc, argv);
+ app.setApplicationName("tst_qlogging");
+
qDebug("qDebug");
qWarning("qWarning");
qCritical("qCritical");
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index b2935ea6f2..11949cf1db 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -620,7 +620,7 @@ void tst_qmessagehandler::qMessagePattern()
QStringList environment = QProcess::systemEnvironment();
// %{file} is tricky because of shadow builds
- environment.prepend("QT_MESSAGE_PATTERN=\"%{type} %{line} %{function} %{message}\"");
+ environment.prepend("QT_MESSAGE_PATTERN=\"%{type} %{appname} %{line} %{function} %{message}\"");
process.setEnvironment(environment);
#ifdef Q_OS_WIN
process.start("app/app.exe");
@@ -633,12 +633,12 @@ void tst_qmessagehandler::qMessagePattern()
// qDebug() << output;
QVERIFY(!output.isEmpty());
- QVERIFY(output.contains("debug 45 T::T static constructor"));
+ QVERIFY(output.contains("debug 45 T::T static constructor"));
// we can't be sure whether the QT_MESSAGE_PATTERN is already destructed
QVERIFY(output.contains("static destructor"));
- QVERIFY(output.contains("debug 51 main qDebug"));
- QVERIFY(output.contains("warning 52 main qWarning"));
- QVERIFY(output.contains("critical 53 main qCritical"));
+ QVERIFY(output.contains("debug tst_qlogging 54 main qDebug"));
+ QVERIFY(output.contains("warning tst_qlogging 55 main qWarning"));
+ QVERIFY(output.contains("critical tst_qlogging 56 main qCritical"));
environment = QProcess::systemEnvironment();
environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{message}\"");