summaryrefslogtreecommitdiffstats
path: root/tests/auto/gestures
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@nokia.com>2010-09-08 15:10:45 (GMT)
committerJeremy Katz <jeremy.katz@nokia.com>2010-09-14 15:14:26 (GMT)
commit8401e31e7c0375f9c595678b510b6d2092a2f2e6 (patch)
treea5227716308b4c5c5c514760eb544794eb41f018 /tests/auto/gestures
parent37b9c2df53b281bddee26291855e0c7f01f52a7c (diff)
downloadQt-8401e31e7c0375f9c595678b510b6d2092a2f2e6.zip
Qt-8401e31e7c0375f9c595678b510b6d2092a2f2e6.tar.gz
Qt-8401e31e7c0375f9c595678b510b6d2092a2f2e6.tar.bz2
Add test: assert when gesture is never accepted.
Test for Qt-Bug 13501.
Diffstat (limited to 'tests/auto/gestures')
-rw-r--r--tests/auto/gestures/tst_gestures.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index ddc3939..667cdd3 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -41,6 +41,7 @@
#include <QtTest/QtTest>
+#include <QtTest/qtesttouch.h>
#include "../../shared/util.h"
#include <qevent.h>
@@ -361,6 +362,7 @@ private slots:
void partialGesturePropagation();
void testQGestureRecognizerCleanup();
void testReuseCanceledGestures();
+ void bug_13501_gesture_not_accepted();
};
tst_Gestures::tst_Gestures()
@@ -2306,5 +2308,29 @@ void tst_Gestures::conflictingGesturesInGraphicsView()
QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
}
+class NoConsumeWidgetBug13501 :public QWidget
+{
+ Q_OBJECT
+protected:
+ bool event(QEvent *e) {
+ if(e->type() == QEvent::Gesture) {
+ return false;
+ }
+ return QWidget::event(e);
+ }
+};
+
+void tst_Gestures::bug_13501_gesture_not_accepted()
+{
+ // Create a gesture event that is not accepted by any widget
+ // make sure this does not lead to an assert in QGestureManager
+ NoConsumeWidgetBug13501 w;
+ w.grabGesture(Qt::TapGesture);
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+ //QTest::mousePress(&ignoreEvent, Qt::LeftButton);
+ QTest::touchEvent(&w).press(0, QPoint(10, 10), &w);
+}
+
QTEST_MAIN(tst_Gestures)
#include "tst_gestures.moc"