summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShane Kearns <shane.kearns@sosco.com>2009-08-11 15:59:49 (GMT)
committerShane Kearns <shane.kearns@sosco.com>2009-08-11 16:13:17 (GMT)
commit262d0348f7a38a22809662e296545d07d686afde (patch)
tree7aa47dfdebbb35c9664b8476034de73df3b0009f /tests
parentc5e1630f0ca7062dd602d7e91f47362e5506f858 (diff)
downloadQt-262d0348f7a38a22809662e296545d07d686afde.zip
Qt-262d0348f7a38a22809662e296545d07d686afde.tar.gz
Qt-262d0348f7a38a22809662e296545d07d686afde.tar.bz2
Fix autotest failure in qgraphicsitem.
When autofocused child is deleted, remove from ancestors to avoid double deletion crash. Check for null receiver when auto SIP is enabled in mouseReleaseEvent
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 558688f..892e182 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -160,6 +160,7 @@ public slots:
void init();
private slots:
+ void explicitDeleteAutoFocusProxy();
void construction();
void constructionWithParent();
void destruction();
@@ -7516,5 +7517,28 @@ void tst_QGraphicsItem::reverseCreateAutoFocusProxy()
QVERIFY(text2->hasFocus());
}
+void tst_QGraphicsItem::explicitDeleteAutoFocusProxy()
+{
+ QGraphicsTextItem *text = new QGraphicsTextItem;
+ text->setTextInteractionFlags(Qt::TextEditorInteraction);
+ text->setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy);
+
+ QGraphicsTextItem *text2 = new QGraphicsTextItem;
+ text2->setTextInteractionFlags(Qt::TextEditorInteraction);
+ text2->setFocus();
+ QVERIFY(!text2->hasFocus());
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
+ text2->setParentItem(text);
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)text2);
+ QCOMPARE(text->focusItem(), (QGraphicsItem *)text2);
+
+ QGraphicsScene scene;
+ scene.addItem(text);
+ QVERIFY(text2->hasFocus());
+
+ delete text2;
+ QCOMPARE(text->focusProxy(), (QGraphicsItem *)0);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"