summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qwidget
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-03-10 16:39:05 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-03-11 20:08:50 +0100
commit50d0f57b77b8088875d7185c5906b5f57985d5fb (patch)
tree16d21bb5f558461511258f493159658ccecc696a /tests/auto/widgets/kernel/qwidget
parent713282dfe41fbad1c1c940cec54227cd7c267831 (diff)
parent45dc347a95fd674cefcf5d1ac63b01557fcb2fef (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
This change partially reverts 1bfc7f68 about QT_HAS_BUILTIN define and undef in src/corelib/tools/qsimd_p.h. This change is also squashed with "Fall back to c++11 standard compiler flag for host builds" which is done by Peter Seiderer. Conflicts: mkspecs/features/default_post.prf src/3rdparty/sqlite/0001-Fixing-the-SQLite3-build-for-WEC2013-again.patch src/3rdparty/sqlite/sqlite3.c src/corelib/tools/qsimd_p.h src/gui/kernel/qevent.cpp src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface_p.h src/plugins/bearer/blackberry/blackberry.pro src/plugins/platforms/cocoa/qcocoasystemsettings.mm src/plugins/platformthemes/gtk2/gtk2.pro src/plugins/styles/bb10style/bb10style.pro src/sql/drivers/sqlite2/qsql_sqlite2.cpp tools/configure/configureapp.cpp Task-number: QTBUG-51644 Done-with: Peter Seiderer <ps.report@gmx.net> Change-Id: I6100d6ace31b2e8d41a95f0b5d5ebf8f1fd88b44
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget')
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 515ddf480f..ae48445363 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -442,6 +442,7 @@ private slots:
void touchEventSynthesizedMouseEvent();
void touchUpdateOnNewTouch();
+ void touchEventsForGesturePendingWidgets();
void styleSheetPropagation();
@@ -9783,6 +9784,7 @@ public:
m_touchUpdateCount(0),
m_touchEndCount(0),
m_touchEventCount(0),
+ m_gestureEventCount(0),
m_acceptTouch(false),
m_mouseEventCount(0),
m_acceptMouse(true)
@@ -9820,6 +9822,9 @@ protected:
else
e->ignore();
return true;
+ case QEvent::Gesture:
+ ++m_gestureEventCount;
+ return true;
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
@@ -9842,6 +9847,7 @@ public:
int m_touchUpdateCount;
int m_touchEndCount;
int m_touchEventCount;
+ int m_gestureEventCount;
bool m_acceptTouch;
int m_mouseEventCount;
bool m_acceptMouse;
@@ -9997,6 +10003,48 @@ void tst_QWidget::touchUpdateOnNewTouch()
QCOMPARE(widget.m_touchEndCount, 1);
}
+void tst_QWidget::touchEventsForGesturePendingWidgets()
+{
+ QTouchDevice *device = new QTouchDevice;
+ device->setType(QTouchDevice::TouchScreen);
+ QWindowSystemInterface::registerTouchDevice(device);
+
+ TouchMouseWidget parent;
+ TouchMouseWidget child(&parent);
+ parent.grabGesture(Qt::TapAndHoldGesture);
+ parent.show();
+
+ QWindow* window = parent.windowHandle();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QTest::qWait(500); // needed for QApplication::topLevelAt(), which is used by QGestureManager
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchEventCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::touchEvent(window, device).press(0, QPoint(20, 20), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1); // QTapAndHoldGestureRecognizer::create() sets Qt::WA_AcceptTouchEvents
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::touchEvent(window, device).move(0, QPoint(25, 25), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1);
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QCOMPARE(parent.m_gestureEventCount, 0);
+ QTest::qWait(1000);
+ QTest::touchEvent(window, device).release(0, QPoint(25, 25), window);
+ QCOMPARE(child.m_touchEventCount, 0);
+ QCOMPARE(child.m_gestureEventCount, 0);
+ QCOMPARE(parent.m_touchBeginCount, 1);
+ QCOMPARE(parent.m_touchUpdateCount, 0);
+ QCOMPARE(parent.m_touchEndCount, 0);
+ QVERIFY(parent.m_gestureEventCount > 0);
+}
+
void tst_QWidget::styleSheetPropagation()
{
QTableView tw;