From c45ba5929d2e6326449df124d42fc60032c1c93c Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Fri, 8 May 2009 13:06:47 +0200 Subject: warn about events that happen out of sequence --- tests/manual/qtouchevent/touchwidget.cpp | 7 +++++++ 1 file changed, 7 insertions(+) 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(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(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(event)->touchPoints().count()); if (closeWindowOnTouchEnd) -- cgit v0.12