summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-05-07 12:42:36 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-14 15:21:23 +0200
commit0b862e067756132225e33be09670631edd50d944 (patch)
treeb911e3787e67c0e0e7f929c3e376f4a3c54df6ea /tests
parent3f1519d40a118c8519c910e4d138829d36e16690 (diff)
QGV: fix items not to be selected on right mouse button release
Task-number: QTBUG-30990 Change-Id: I421d9169b592da2b468eceb9df4f3f7c6a06e8d6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Andreas Aardal Hanssen <andreas@hanssen.name>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 37190c3cf2..3e24257736 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -470,6 +470,7 @@ private slots:
void QTBUG_13473_sceneposchange();
void QTBUG_16374_crashInDestructor();
void QTBUG_20699_focusScopeCrash();
+ void QTBUG_30990_rightClickSelection();
private:
QList<QGraphicsItem *> paintedItems;
@@ -11468,5 +11469,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"