summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2011-08-15 03:44:44 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2011-08-30 07:30:49 (GMT)
commit01f09542782ce87483979d9e817b95d55a3b28d3 (patch)
treeabc6620e47098fd31a2eec18c9e705f7a027e374 /tests
parent3074b010734f8bc3e982c42473e6c39a63e4cce0 (diff)
downloadQt-01f09542782ce87483979d9e817b95d55a3b28d3.zip
Qt-01f09542782ce87483979d9e817b95d55a3b28d3.tar.gz
Qt-01f09542782ce87483979d9e817b95d55a3b28d3.tar.bz2
FocusScope's focusItem must always be a descendent
Task-number: QTBUG-20699 Reviewed-by: Michael Brasser
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 3665b10..9b834d5 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -475,6 +475,7 @@ private slots:
void QTBUG_12112_focusItem();
void QTBUG_13473_sceneposchange();
void QTBUG_16374_crashInDestructor();
+ void QTBUG_20699_focusScopeCrash();
private:
QList<QGraphicsItem *> paintedItems;
@@ -11265,5 +11266,36 @@ void tst_QGraphicsItem::QTBUG_16374_crashInDestructor()
QTest::qWaitForWindowShown(&view);
}
+void tst_QGraphicsItem::QTBUG_20699_focusScopeCrash()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsPixmapItem fs;
+ fs.setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable);
+ scene.addItem(&fs);
+ QGraphicsPixmapItem* fs2 = new QGraphicsPixmapItem(&fs);
+ fs2->setFlags(QGraphicsItem::ItemIsFocusScope | QGraphicsItem::ItemIsFocusable);
+ QGraphicsPixmapItem* fi2 = new QGraphicsPixmapItem(&fs);
+ fi2->setFlags(QGraphicsItem::ItemIsFocusable);
+ QGraphicsPixmapItem* fi = new QGraphicsPixmapItem(fs2);
+ fi->setFlags(QGraphicsItem::ItemIsFocusable);
+ fs.setFocus();
+ fi->setFocus();
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+ fi->setParentItem(fi2);
+ fi->setFocus();
+ fs.setFocus();
+ fi->setParentItem(fs2);
+ fi->setFocus();
+ fs2->setFocus();
+ fs.setFocus();
+ fi->setParentItem(fi2);
+ fi->setFocus();
+ fs.setFocus();
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"