summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-21 10:38:57 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-08-21 11:03:18 +0200
commitc8ca300e491c186304d0864a9e870337e891e6f7 (patch)
treef1d991c5960b5acc0bf2a709960e871d48d91acf /src/testlib
parent31c96d34d27f8cad020238df28c10a71b2c4a34f (diff)
parent8b540f68a8404e4b9e3ac65a22c11416a91ee749 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: qmake/doc/src/qmake-manual.qdoc src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/src.pro Change-Id: I0a560826c420e46988da3776bd8f9160c365459a
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestlog.cpp42
-rw-r--r--src/testlib/qtestmouse.h6
2 files changed, 12 insertions, 36 deletions
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index 99c7ec749d..d094372d0b 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -76,14 +76,6 @@ static void saveCoverageTool(const char * appname, bool testfailed, bool install
#endif
}
-//
-// declare deprecated API from qlogging.h locally
-// (we can't use qInstallMessageHandler because it would break
-// tests that (still) rely on qInstallMsgHandler.)
-//
-typedef void (*QtMsgHandler)(QtMsgType, const char *);
-Q_CORE_EXPORT QtMsgHandler qInstallMsgHandler(QtMsgHandler);
-
namespace QTest {
int fails = 0;
@@ -212,7 +204,7 @@ namespace QTest {
static int maxWarnings = 2002;
static bool installedTestCoverage = true;
- static QtMsgHandler oldMessageHandler;
+ static QtMessageHandler oldMessageHandler;
static bool handleIgnoredMessage(QtMsgType type, const char *msg)
{
@@ -238,23 +230,17 @@ namespace QTest {
return false;
}
-// don't warn about qInstallMsgHandler
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
- static void messageHandler(QtMsgType type, const char *msg)
+ static void messageHandler(QtMsgType type, const QMessageLogContext & /*context*/, const QString &message)
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
- if (!msg || QTest::TestLoggers::loggerCount() == 0) {
+ if (QTest::TestLoggers::loggerCount() == 0) {
// if this goes wrong, something is seriously broken.
- qInstallMsgHandler(oldMessageHandler);
- QTEST_ASSERT(msg);
+ qInstallMessageHandler(oldMessageHandler);
QTEST_ASSERT(QTest::TestLoggers::loggerCount() != 0);
}
+ QByteArray msg = message.toLocal8Bit();
if (handleIgnoredMessage(type, msg))
// the message is expected, so just swallow it.
return;
@@ -293,10 +279,6 @@ namespace QTest {
break;
}
}
-
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic pop
-#endif
}
void QTestLog::enterTestFunction(const char* function)
@@ -399,31 +381,21 @@ void QTestLog::addBenchmarkResult(const QBenchmarkResult &result)
QTest::TestLoggers::addBenchmarkResult(result);
}
-// don't warn about qInstallMsgHandler
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic push
-# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
-
void QTestLog::startLogging()
{
QTest::TestLoggers::startLogging();
- QTest::oldMessageHandler = qInstallMsgHandler(QTest::messageHandler);
+ QTest::oldMessageHandler = qInstallMessageHandler(QTest::messageHandler);
}
void QTestLog::stopLogging()
{
- qInstallMsgHandler(QTest::oldMessageHandler);
+ qInstallMessageHandler(QTest::oldMessageHandler);
QTest::TestLoggers::stopLogging();
QTest::TestLoggers::destroyLoggers();
QTest::loggerUsingStdout = false;
saveCoverageTool(QTestResult::currentAppname(), failCount() != 0, QTestLog::installedTestCoverage());
}
-#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) && !defined(Q_CC_INTEL)
-# pragma GCC diagnostic pop
-#endif
-
void QTestLog::addLogger(LogMode mode, const char *filename)
{
if (filename && strcmp(filename, "-") == 0)
diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h
index 4d70aff27e..8efa80789c 100644
--- a/src/testlib/qtestmouse.h
+++ b/src/testlib/qtestmouse.h
@@ -61,6 +61,8 @@
#include <QtWidgets/qwidget.h>
#endif
+#include <QDebug>
+
QT_BEGIN_NAMESPACE
Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF & local, const QPointF & global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier);
@@ -84,8 +86,10 @@ namespace QTest
QTEST_ASSERT(window);
extern int Q_TESTLIB_EXPORT defaultMouseDelay();
- if (!window->geometry().contains(pos))
+ // pos is in window local coordinates
+ if (window->geometry().width() <= pos.x() || window->geometry().height() <= pos.y()) {
QTest::qWarn("Mouse event occurs outside of target window.");
+ }
static Qt::MouseButton lastButton = Qt::NoButton;