diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-05-15 14:31:47 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-16 01:31:57 +0200 |
commit | 0463c1e6cd26e4b88f433a5598d1bd1544a59212 (patch) | |
tree | cc4e3d6f2878e5141b4ba2670bc1bbb41b5888c3 /tests/auto | |
parent | 0daeee468ccc76dfb957892050b4c11d4807e2d3 (diff) | |
download | qt4-tools-0463c1e6cd26e4b88f433a5598d1bd1544a59212.tar.gz |
QGV: fix items not to be selected on right mouse button release
Task-number: QTBUG-30990
Change-Id: Iaf2dd7ed496625097daa05d5dc92ef5957574ee9
(Cherry-picked from qtbase/0b862e067756132225e33be09670631edd50d944)
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 15ae53ac95..2637106953 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -478,6 +478,7 @@ private slots: void QTBUG_13473_sceneposchange(); void QTBUG_16374_crashInDestructor(); void QTBUG_20699_focusScopeCrash(); + void QTBUG_30990_rightClickSelection(); private: QList<QGraphicsItem *> paintedItems; @@ -11497,5 +11498,32 @@ void tst_QGraphicsItem::QTBUG_20699_focusScopeCrash() fs.setFocus(); } +void tst_QGraphicsItem::QTBUG_30990_rightClickSelection() +{ + QGraphicsScene scene; + QGraphicsItem *item1 = scene.addRect(10, 10, 10, 10); + item1->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable); + QGraphicsItem *item2 = scene.addRect(100, 100, 10, 10); + item2->setFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable); + + // right mouse press & release over an item should not make it selected + sendMousePress(&scene, item1->boundingRect().center(), Qt::RightButton); + QVERIFY(!item1->isSelected()); + sendMouseRelease(&scene, item1->boundingRect().center(), Qt::RightButton); + QVERIFY(!item1->isSelected()); + + // right mouse press over one item, moving over another item, + // and then releasing should make neither of the items selected + sendMousePress(&scene, item1->boundingRect().center(), Qt::RightButton); + QVERIFY(!item1->isSelected()); + QVERIFY(!item2->isSelected()); + sendMouseMove(&scene, item2->boundingRect().center(), Qt::RightButton); + QVERIFY(!item1->isSelected()); + QVERIFY(!item2->isSelected()); + sendMouseRelease(&scene, item2->boundingRect().center(), Qt::RightButton); + QVERIFY(!item1->isSelected()); + QVERIFY(!item2->isSelected()); +} + QTEST_MAIN(tst_QGraphicsItem) #include "tst_qgraphicsitem.moc" |