diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-11 13:47:58 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2017-05-11 18:47:46 +0000 |
commit | 15a1a4868fee2770debb4cb10ae64f701e63466b (patch) | |
tree | 59e263fc8c5b522836c2e947f98e882f4a88170e /tests/auto/quick | |
parent | 2e570e52deb75d6293a144bd5b3d51171d757b92 (diff) |
touchmouse autotest: add debug operator for the test-specific Event type
It's nice to be able to do
qDebug() << eventItem->eventList
when troubleshooting behavior in case of test failure.
Change-Id: I2b50d5b092a0c9eb4eab3105be66a36aedf871bb
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/touchmouse/tst_touchmouse.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 643d3dbb90..01aa5d1c8e 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -30,6 +30,7 @@ #include <QtTest/QtTest> #include <QtGui/qstylehints.h> +#include <private/qdebug_p.h> #include <QtQuick/qquickview.h> #include <QtQuick/qquickitem.h> @@ -62,6 +63,21 @@ struct Event QList<QTouchEvent::TouchPoint> points; }; +#ifndef QT_NO_DEBUG_STREAM +QDebug operator<<(QDebug dbg, const struct Event &event) { + QDebugStateSaver saver(dbg); + dbg.nospace(); + dbg << "Event("; + QtDebugUtils::formatQEnum(dbg, event.type); + if (event.points.isEmpty()) + dbg << " @ " << event.mousePos << " global " << event.mousePosGlobal; + else + dbg << ", " << event.points.count() << " touchpoints: " << event.points; + dbg << ')'; + return dbg; +} +#endif + class EventItem : public QQuickItem { Q_OBJECT |