summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-05-08 11:06:47 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-05-08 11:06:47 (GMT)
commitc45ba5929d2e6326449df124d42fc60032c1c93c (patch)
treecfe0c71610cb04b1e33e1fd96ef23d576bcbba2b
parent58f25669087bf52357bc69f398b4713d33b03d1e (diff)
downloadQt-c45ba5929d2e6326449df124d42fc60032c1c93c.zip
Qt-c45ba5929d2e6326449df124d42fc60032c1c93c.tar.gz
Qt-c45ba5929d2e6326449df124d42fc60032c1c93c.tar.bz2
warn about events that happen out of sequence
-rw-r--r--tests/manual/qtouchevent/touchwidget.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/manual/qtouchevent/touchwidget.cpp b/tests/manual/qtouchevent/touchwidget.cpp
index f029f8b..a8141cc 100644
--- a/tests/manual/qtouchevent/touchwidget.cpp
+++ b/tests/manual/qtouchevent/touchwidget.cpp
@@ -31,6 +31,9 @@ bool TouchWidget::event(QEvent *event)
{
switch (event->type()) {
case QEvent::TouchBegin:
+ if (seenTouchBegin) qWarning("TouchBegin: already seen a TouchBegin");
+ if (seenTouchUpdate) qWarning("TouchBegin: TouchUpdate cannot happen before TouchBegin");
+ if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin");
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
touchPointCount = qMax(touchPointCount, static_cast<QTouchEvent *>(event)->touchPoints().count());
if (acceptTouchBegin) {
@@ -39,6 +42,8 @@ bool TouchWidget::event(QEvent *event)
}
break;
case QEvent::TouchUpdate:
+ if (!seenTouchBegin) qWarning("TouchUpdate: have not seen TouchBegin");
+ if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate");
seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
touchPointCount = qMax(touchPointCount, static_cast<QTouchEvent *>(event)->touchPoints().count());
if (acceptTouchUpdate) {
@@ -47,6 +52,8 @@ bool TouchWidget::event(QEvent *event)
}
break;
case QEvent::TouchEnd:
+ if (!seenTouchBegin) qWarning("TouchEnd: have not seen TouchBegin");
+ if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd");
seenTouchEnd = seenTouchBegin && !seenTouchEnd;
touchPointCount = qMax(touchPointCount, static_cast<QTouchEvent *>(event)->touchPoints().count());
if (closeWindowOnTouchEnd)