summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-09-15 13:12:52 (GMT)
committerAndreas Aardal Hanssen <andreas.aardal.hanssen@nokia.com>2009-09-15 13:20:57 (GMT)
commit4c779ca7cd74b77ec5f7e480b9762acccce3c4ad (patch)
treece10bb255720e58d8cfd762ddc3e5baea99e9a26 /tests
parentfd8be39b40467be69a7cd9c5a009c5a47c6a4e9b (diff)
downloadQt-4c779ca7cd74b77ec5f7e480b9762acccce3c4ad.zip
Qt-4c779ca7cd74b77ec5f7e480b9762acccce3c4ad.tar.gz
Qt-4c779ca7cd74b77ec5f7e480b9762acccce3c4ad.tar.bz2
Fix a bug in FocusScopes; ensure subFocus is set correctly.
The bug was triggered by setting focus on a parent scope (which then passes focus to the innermost scope). Subfocus was set up for the first scope, but not the inner scopes. Reviewed-by: TrustMe
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 0744fa5..304330e 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -8332,6 +8332,22 @@ void tst_QGraphicsItem::focusScope()
rect4->setParentItem(0);
QCOMPARE(scope3->focusScopeItem(), (QGraphicsItem *)0);
QVERIFY(!scope3->hasFocus());
+
+ QGraphicsRectItem *rectA = new QGraphicsRectItem;
+ QGraphicsRectItem *scopeA = new QGraphicsRectItem(rectA);
+ scopeA->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope);
+ scopeA->setFocus();
+ QGraphicsRectItem *scopeB = new QGraphicsRectItem(scopeA);
+ scopeB->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemIsFocusScope);
+ scopeB->setFocus();
+
+ scene.addItem(rectA);
+ QVERIFY(rect5->hasFocus());
+ QVERIFY(!scopeB->hasFocus());
+
+ scopeA->setFocus();
+ QVERIFY(scopeB->hasFocus());
+ QCOMPARE(scopeB->focusItem(), (QGraphicsItem *)scopeB);
}
QTEST_MAIN(tst_QGraphicsItem)