summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <sroedal@trolltech.com>2009-05-13 13:22:21 (GMT)
committerSamuel Rødal <sroedal@trolltech.com>2009-05-13 13:22:21 (GMT)
commitf15352c51625688ec445c73125a2e25327377d49 (patch)
tree0d7d82d8ea8ffeff5cf042cd70af3200ec6f1925 /tests/auto/qgraphicsview/tst_qgraphicsview.cpp
parentc8c5becc81679eb8a9a0f8baa454bc43fd3cccf9 (diff)
parent0a74bc2ce91e8c7a10ae54fd0f80814902fa5de9 (diff)
downloadQt-f15352c51625688ec445c73125a2e25327377d49.zip
Qt-f15352c51625688ec445c73125a2e25327377d49.tar.gz
Qt-f15352c51625688ec445c73125a2e25327377d49.tar.bz2
Merge commit 'qt/master'
Diffstat (limited to 'tests/auto/qgraphicsview/tst_qgraphicsview.cpp')
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index ca88afc..920cba7 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -190,6 +190,7 @@ private slots:
void scrollAfterResize();
void centerOnDirtyItem();
void mouseTracking();
+ void mouseTracking2();
// task specific tests below me
void task172231_untransformableItems();
@@ -203,6 +204,7 @@ private slots:
void task239729_noViewUpdate();
void task239047_fitInViewSmallViewport();
void task245469_itemsAtPointWithClip();
+ void task253415_reconnectUpdateSceneOnSceneChanged();
};
void tst_QGraphicsView::initTestCase()
@@ -3173,5 +3175,54 @@ void tst_QGraphicsView::mouseTracking()
}
}
+void tst_QGraphicsView::mouseTracking2()
+{
+ // Make sure mouse move events propagates to the scene when
+ // mouse tracking is explicitly enabled on the view,
+ // even when all items ignore hover events / use default cursor.
+
+ QGraphicsScene scene;
+ scene.addRect(0, 0, 100, 100);
+
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(200);
+
+ QVERIFY(!view.viewport()->hasMouseTracking());
+ view.viewport()->setMouseTracking(true); // Explicitly enable mouse tracking.
+ QVERIFY(view.viewport()->hasMouseTracking());
+
+ EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove);
+ QCOMPARE(spy.count(), 0);
+ sendMouseMove(view.viewport(), view.viewport()->rect().center());
+ QCOMPARE(spy.count(), 1);
+}
+
+void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
+{
+ QGraphicsView view;
+ QGraphicsView dummyView;
+ view.setWindowFlags(view.windowFlags() | Qt::WindowStaysOnTopHint);
+ view.resize(200, 200);
+
+ QGraphicsScene scene1;
+ QObject::connect(&scene1, SIGNAL(changed(QList<QRectF>)), &dummyView, SLOT(updateScene(QList<QRectF>)));
+ view.setScene(&scene1);
+
+ QTest::qWait(125);
+
+ QGraphicsScene scene2;
+ QObject::connect(&scene2, SIGNAL(changed(QList<QRectF>)), &dummyView, SLOT(updateScene(QList<QRectF>)));
+ view.setScene(&scene2);
+
+ QTest::qWait(125);
+
+ bool wasConnected2 = QObject::disconnect(&scene2, SIGNAL(changed(QList<QRectF>)), &view, 0);
+ QVERIFY(wasConnected2);
+}
+
QTEST_MAIN(tst_QGraphicsView)
#include "tst_qgraphicsview.moc"