diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index dcd679f..3c4984e 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -4141,11 +4141,14 @@ void tst_QGraphicsView::inputContextReset() inputContext.resets = 0; scene.setFocusItem(0); - QCOMPARE(inputContext.resets, 1); + // the input context is reset twice, once because an item has lost focus and again because + // the Qt::WA_InputMethodEnabled flag is cleared because no item has focus. + QCOMPARE(inputContext.resets, 2); // introduce another item that is focusable but does not accept input methods QGraphicsItem *item2 = new QGraphicsRectItem; - item1->setFlags(QGraphicsItem::ItemIsFocusable); + item2->setFlags(QGraphicsItem::ItemIsFocusable); + scene.addItem(item2); inputContext.resets = 0; scene.setFocusItem(item2); @@ -4154,6 +4157,11 @@ void tst_QGraphicsView::inputContextReset() inputContext.resets = 0; scene.setFocusItem(item1); QCOMPARE(inputContext.resets, 0); + + // test changing between between items that accept input methods. + item2->setFlags(QGraphicsItem::ItemIsFocusable | QGraphicsItem::ItemAcceptsInputMethod); + scene.setFocusItem(item2); + QCOMPARE(inputContext.resets, 1); } void tst_QGraphicsView::indirectPainting() |