diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-29 09:18:22 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-04-29 09:18:22 (GMT) |
commit | ae16f6c59a009a508c1224b5dc02752ada0ce61a (patch) | |
tree | 1fd24feef7e3cd4217a3792324b76276ecd9f24c /tests/auto | |
parent | 6940070adb45d67a0a9186205a4914a0a6c14135 (diff) | |
parent | b7ea50145c6dc443e15d9f3f1e1dd1737a5135cc (diff) | |
download | Qt-ae16f6c59a009a508c1224b5dc02752ada0ce61a.zip Qt-ae16f6c59a009a508c1224b5dc02752ada0ce61a.tar.gz Qt-ae16f6c59a009a508c1224b5dc02752ada0ce61a.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Ensured that WA_InputMethodEnabled was set before FocusInEvent was sent.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 1c19fab..e3c699b 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3664,6 +3664,22 @@ void tst_QGraphicsView::update() #endif } +class FocusItem : public QGraphicsRectItem +{ +public: + FocusItem() : QGraphicsRectItem(0, 0, 20, 20) { + m_viewHasIMEnabledInFocusInEvent = false; + } + + void focusInEvent(QFocusEvent *event) + { + QGraphicsView *view = scene()->views().first(); + m_viewHasIMEnabledInFocusInEvent = view->testAttribute(Qt::WA_InputMethodEnabled); + } + + bool m_viewHasIMEnabledInFocusInEvent; +}; + void tst_QGraphicsView::inputMethodSensitivity() { QGraphicsScene scene; @@ -3673,7 +3689,7 @@ void tst_QGraphicsView::inputMethodSensitivity() QApplication::setActiveWindow(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); - QGraphicsRectItem *item = new QGraphicsRectItem; + FocusItem *item = new FocusItem; view.setAttribute(Qt::WA_InputMethodEnabled, true); @@ -3702,6 +3718,7 @@ void tst_QGraphicsView::inputMethodSensitivity() scene.setFocusItem(item); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item)); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true); item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); @@ -3710,15 +3727,17 @@ void tst_QGraphicsView::inputMethodSensitivity() QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); // introduce another item that is focusable but does not accept input methods - QGraphicsRectItem *item2 = new QGraphicsRectItem; + FocusItem *item2 = new FocusItem; item2->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(item2); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(item2->m_viewHasIMEnabledInFocusInEvent, false); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2)); scene.setFocusItem(item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item)); view.setScene(0); @@ -3727,10 +3746,12 @@ void tst_QGraphicsView::inputMethodSensitivity() view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item)); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(item2->m_viewHasIMEnabledInFocusInEvent, false); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item2)); view.setScene(0); @@ -3743,6 +3764,7 @@ void tst_QGraphicsView::inputMethodSensitivity() view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(item->m_viewHasIMEnabledInFocusInEvent, true); QCOMPARE(scene.focusItem(), static_cast<QGraphicsItem *>(item)); } |