From 5bfe794aaab34d6aa021b5640972509e3bc6ced8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 16 Oct 2014 15:12:59 +0200 Subject: Remove trailing '\n' in qFormatLogMessage output Do not automatically add a \n to all messages formatted by qFormatLogMessage. Some backends require a final newline, some don't, so it's best to only append it where it's actually needed. The returned string will be null if the pattern is empty. This allows to differentiate between the case that the pattern just didn't apply (empty line is printed), and the case that qSetMessagePattern(QString()) have been called (nothing is printed). Change-Id: I17fde997a4074f58f82de6dea129948155c322d6 Reviewed-by: Oswald Buddenhagen Reviewed-by: Alex Blasche --- src/testlib/qtestlog.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp index 7ea953232f..e48fdc1ad0 100644 --- a/src/testlib/qtestlog.cpp +++ b/src/testlib/qtestlog.cpp @@ -279,7 +279,6 @@ namespace QTest { return; QString msg = qFormatLogMessage(type, context, message); - msg.chop(1); // remove trailing newline if (type != QtFatalMsg) { if (counter.load() <= 0) -- cgit v1.2.3 From a8df9982901a8e9d01cce06c9ffe2b34e6ea23a7 Mon Sep 17 00:00:00 2001 From: Roland Winklmeier Date: Mon, 27 Oct 2014 23:09:06 +0100 Subject: Make QTestEventLoop::exitLoop() thread-safe QTestEventLoop::exitLoop() is used by QSignalSpy to stop event processing when the connected signal has been received. The design of QSignalSpy requires QTestEventLoop::exitLoop() to be thread-safe, which it wasn't. When QSignalSpy is connected to a signal in a different thread, exitLoop() was called from the thread which emitted the signal and not the one in which QTestEventLoop is running. This caused troubles when killing the internal timer. This patch adds a check in the beginning of exitLoop(). If it is called from a different thread, it will post an event into the message queue in which QTestEventLoop is running and execute it there. Change-Id: Icb8c8ff2f5344800ee6c6125b98c677c7a196c32 Reviewed-by: Thiago Macieira --- src/testlib/qtesteventloop.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/testlib') diff --git a/src/testlib/qtesteventloop.h b/src/testlib/qtesteventloop.h index 9e738d2c47..034655cc50 100644 --- a/src/testlib/qtesteventloop.h +++ b/src/testlib/qtesteventloop.h @@ -40,6 +40,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -101,6 +102,12 @@ inline void QTestEventLoop::enterLoopMSecs(int ms) inline void QTestEventLoop::exitLoop() { + if (thread() != QThread::currentThread()) + { + QMetaObject::invokeMethod(this, "exitLoop", Qt::QueuedConnection); + return; + } + if (timerId != -1) killTimer(timerId); timerId = -1; -- cgit v1.2.3 From adf1b30934f2b2b92271955e7867a7b2620bc6b9 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 10 Nov 2014 18:19:45 -0800 Subject: Make QVersionNumber private We're not ready. [ChangeLog][EDITORIAL] Remove all mentions of QVersionNumber. Change-Id: I03ad95992982eb3177f982c1eeddb6a6bc29336c Reviewed-by: Keith Gardner Reviewed-by: Lars Knoll --- src/testlib/qtest.h | 6 ------ src/testlib/qtestcase.cpp | 7 ------- 2 files changed, 13 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index d3443e7390..6298262958 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -164,11 +163,6 @@ template<> inline char *toString(const QVariant &v) return qstrdup(vstring.constData()); } -template<> inline char *toString(const QVersionNumber &version) -{ - return toString(version.toString()); -} - template<> inline bool qCompare(QString const &t1, QLatin1String const &t2, const char *actual, const char *expected, const char *file, int line) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 2d92b3f6bd..b174913eae 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1027,13 +1027,6 @@ QT_BEGIN_NAMESPACE Returns a textual representation of the given \a variant. */ -/*! - \fn char *QTest::toString(const QVersionNumber &version) - \overload - - Returns a textual representation of the given \a version. -*/ - /*! \fn void QTest::qWait(int ms) Waits for \a ms milliseconds. While waiting, events will be processed and -- cgit v1.2.3 From cd75ca0dbd2b9b6cef8fd840f3ecdeeb04502362 Mon Sep 17 00:00:00 2001 From: Maurice Kalinowski Date: Wed, 19 Nov 2014 14:21:40 +0100 Subject: WinRT: Ignore winrtrunner specific arguments qdevel is an option used from winrtrunner to indicate a specific environment to the app. QTestLib needs to ignore that parameter similar to the Visual Studio generated arguments. Change-Id: I00a3abe19f1e5b4159e65d26050f04e28f40316f Reviewed-by: Oliver Wolff Reviewed-by: Andrew Knight --- src/testlib/qtestcase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index b174913eae..928a3f31f1 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -1728,7 +1728,8 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml) } else if (strcmp(argv[i], "-vb") == 0) { QBenchmarkGlobalData::current->verboseOutput = true; #ifdef Q_OS_WINRT - } else if (strncmp(argv[i], "-ServerName:", 12) == 0) { + } else if (strncmp(argv[i], "-ServerName:", 12) == 0 || + strncmp(argv[i], "-qdevel", 7) == 0) { continue; #endif } else if (argv[i][0] == '-') { -- cgit v1.2.3 From 49052ba8a87fc0f8dc437d63cc541845501ab7a8 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Nov 2014 22:11:48 -0800 Subject: QtTest: fix pretty-printing of QStrings containing " It needs to be escaped with a backslash. Change-Id: Idf62914fca08eb6be8a039c2af72bac42c0d594a Reviewed-by: Jason McDonald --- src/testlib/qtestcase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 928a3f31f1..24d563045b 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2153,7 +2153,7 @@ char *toPrettyUnicode(const ushort *p, int length) break; } - if (*p < 0x7f && *p >= 0x20 && *p != '\\') { + if (*p < 0x7f && *p >= 0x20 && *p != '\\' && *p != '"') { *dst++ = *p; continue; } -- cgit v1.2.3