summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:30:57 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2016-01-08 12:35:24 +0100
commitad16478a76815f8f61d454bf7760aaf9ffbb4b51 (patch)
treeeefdd9219cc9d59b62e042f49fc7555b980cb7a4 /tests/auto/other
parent80a741f3616290897ba0d9f1cbd3c9c5ee62da37 (diff)
parent09c92863001790a0304a5ef389901ee2b5b6cdc2 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Based on merge done by Liang Qi Change-Id: Id566e5b9f284d29bff2199f13f9417c660f5b26f
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/gestures/tst_gestures.cpp56
-rw-r--r--tests/auto/other/toolsupport/tst_toolsupport.cpp2
2 files changed, 38 insertions, 20 deletions
diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp
index fa65c29b00..1918c8d151 100644
--- a/tests/auto/other/gestures/tst_gestures.cpp
+++ b/tests/auto/other/gestures/tst_gestures.cpp
@@ -49,6 +49,24 @@
#include <qdebug.h>
+static bool waitForWindowExposed(QWindow *window)
+{
+ if (!window)
+ return false;
+#ifdef Q_OS_OSX
+ QTest::qWait(100);
+ return window->isExposed();
+#endif
+ return QTest::qWaitForWindowExposed(window);
+}
+
+static bool waitForWindowExposed(QWidget *widget)
+{
+ if (!widget)
+ return false;
+ return waitForWindowExposed(widget->windowHandle());
+}
+
static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view)
{
return view->viewport()->mapToGlobal(view->mapFromScene(item->mapToScene(pt)));
@@ -364,7 +382,7 @@ void tst_Gestures::customGesture()
GestureWidget widget;
widget.grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
widget.show();
- QVERIFY(QTest::qWaitForWindowExposed(&widget));
+ QVERIFY(waitForWindowExposed(&widget));
CustomEvent event;
event.hotSpot = widget.mapToGlobal(QPoint(5,5));
@@ -833,7 +851,7 @@ void tst_Gestures::graphicsItemGesture()
item->setPos(100, 100);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@@ -895,7 +913,7 @@ void tst_Gestures::graphicsView()
item->setPos(100, 100);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item->grabGesture(CustomGesture::GestureType);
@@ -971,7 +989,7 @@ void tst_Gestures::graphicsItemTreeGesture()
item1_child2->setParentItem(item1);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@@ -1028,7 +1046,7 @@ void tst_Gestures::explicitGraphicsObjectTarget()
item2_child1->setPos(10, 10);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren);
@@ -1087,7 +1105,7 @@ void tst_Gestures::gestureOverChildGraphicsItem()
item2_child1->setPos(0, 0);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->grabGesture(CustomGesture::GestureType);
@@ -1385,7 +1403,7 @@ void tst_Gestures::testMapToScene()
item0->setPos(14, 16);
view.show(); // need to show to give it a global coordinate
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
QPoint origin = view.mapToGlobal(QPoint());
@@ -1511,7 +1529,7 @@ void tst_Gestures::autoCancelGestures()
parent.grabGesture(CustomGesture::GestureType);
child->grabGesture(secondGesture);
parent.show();
- QVERIFY(QTest::qWaitForWindowExposed(&parent));
+ QVERIFY(waitForWindowExposed(&parent));
/*
An event is sent to both the child and the parent, when the child gets it a gesture is triggered
@@ -1570,7 +1588,7 @@ void tst_Gestures::autoCancelGestures2()
child->grabGesture(secondGesture);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@@ -1616,7 +1634,7 @@ void tst_Gestures::graphicsViewParentPropagation()
item1_c1_c1->setPos(0, 0);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent);
@@ -1686,7 +1704,7 @@ void tst_Gestures::panelPropagation()
item1_child1_child1->setZValue(10);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -1797,7 +1815,7 @@ void tst_Gestures::panelStacksBehindParent()
panel->setZValue(5);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -1881,7 +1899,7 @@ void tst_Gestures::deleteGestureTargetItem()
items.insert(item2->objectName(), item2);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
if (propagateUpdateGesture)
@@ -1926,7 +1944,7 @@ void tst_Gestures::viewportCoordinates()
scene.addItem(item1);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
CustomEvent event;
@@ -1963,7 +1981,7 @@ void tst_Gestures::partialGesturePropagation()
scene.addItem(item4);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
item1->ignoredUpdatedGestures << CustomGesture::GestureType;
@@ -2051,7 +2069,7 @@ void tst_Gestures::testQGestureRecognizerCleanup()
//QGestureRecognizer::registerRecognizer(new PanRecognizer(PanRecognizer::Custom));
w->show();
- QVERIFY(QTest::qWaitForWindowExposed(w));
+ QVERIFY(waitForWindowExposed(w));
delete w;
}
@@ -2172,7 +2190,7 @@ void tst_Gestures::testReuseCanceledGestures()
gv->viewport()->grabGesture(tapGestureTypeId);
mw.show();
- QVERIFY(QTest::qWaitForWindowExposed(&mw));
+ QVERIFY(waitForWindowExposed(&mw));
QPoint targetPos(gv->mapFromScene(target->mapToScene(target->rect().center())));
targetPos = gv->viewport()->mapFromParent(targetPos);
@@ -2238,7 +2256,7 @@ void tst_Gestures::conflictingGesturesInGraphicsView()
scene.addItem(item2);
view.show();
- QVERIFY(QTest::qWaitForWindowExposed(&view));
+ QVERIFY(waitForWindowExposed(&view));
view.ensureVisible(scene.sceneRect());
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
@@ -2303,7 +2321,7 @@ void tst_Gestures::bug_13501_gesture_not_accepted()
NoConsumeWidgetBug13501 w;
w.grabGesture(Qt::TapGesture);
w.show();
- QVERIFY(QTest::qWaitForWindowExposed(&w));
+ QVERIFY(waitForWindowExposed(&w));
//QTest::mousePress(&ignoreEvent, Qt::LeftButton);
QTouchDevice *device = new QTouchDevice;
device->setType(QTouchDevice::TouchScreen);
diff --git a/tests/auto/other/toolsupport/tst_toolsupport.cpp b/tests/auto/other/toolsupport/tst_toolsupport.cpp
index fdbb6e13d4..7942a84615 100644
--- a/tests/auto/other/toolsupport/tst_toolsupport.cpp
+++ b/tests/auto/other/toolsupport/tst_toolsupport.cpp
@@ -121,7 +121,7 @@ void tst_toolsupport::offsets_data()
}
#ifdef Q_OS_LINUX
- if (sizeof(void *) == 8) {
+ {
QTestData &data = QTest::newRow("QFilePrivate::fileName")
<< pmm_to_offsetof(&QFilePrivate::fileName);
data << 168 << 248;