diff options
author | Yoann Lopes <yoann.lopes@nokia.com> | 2010-04-21 11:24:27 (GMT) |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 10:05:43 (GMT) |
commit | 13945c8d65c4a3ad9a4088785851dabcc0a25dcf (patch) | |
tree | 6e2c1a863f0cdf5f503aaa6214d59f26c90f8b17 /tests/auto | |
parent | 998bd0db4e676bb19e958bc31aa4fbce7aa3100f (diff) | |
download | Qt-13945c8d65c4a3ad9a4088785851dabcc0a25dcf.zip Qt-13945c8d65c4a3ad9a4088785851dabcc0a25dcf.tar.gz Qt-13945c8d65c4a3ad9a4088785851dabcc0a25dcf.tar.bz2 |
Fixes wrong QGraphicsView's viewport cursor reset.
The cursor was reset even when it had not been previously saved.
Autotest included.
Task-number: QTBUG-7438
Reviewed-by: bnilsen
(cherry picked from commit ad0c6b17cde4a3ce0041d1a54b96ccb5a6792520)
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index a831a44..59ec720 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -239,6 +239,7 @@ private slots: void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); + void QTBUG_7438_cursor(); }; void tst_QGraphicsView::initTestCase() @@ -4085,5 +4086,32 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); } +void tst_QGraphicsView::QTBUG_7438_cursor() +{ +#ifndef QT_NO_CURSOR +#if defined(Q_OS_WINCE) + QSKIP("Qt/CE does not have regular cursor support", SkipAll); +#endif + QGraphicsScene scene; + QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); + item->setFlag(QGraphicsItem::ItemIsMovable); + + QGraphicsView view(&scene); + view.setFixedSize(400, 400); + view.show(); + QTest::qWaitForWindowShown(&view); + + QCOMPARE(view.viewport()->cursor().shape(), QCursor().shape()); + view.viewport()->setCursor(Qt::PointingHandCursor); + QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); + sendMouseMove(view.viewport(), view.mapFromScene(0, 0)); + QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); + sendMousePress(view.viewport(), view.mapFromScene(0, 0)); + QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); + sendMouseRelease(view.viewport(), view.mapFromScene(0, 0)); + QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); +#endif +} + QTEST_MAIN(tst_QGraphicsView) #include "tst_qgraphicsview.moc" |