diff options
author | axis <qt-info@nokia.com> | 2009-06-03 11:11:29 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-06-03 11:16:51 (GMT) |
commit | 3592724b1f7e635904c31ba09a61d6b7259c93e5 (patch) | |
tree | 7074bab19415d52b2d98392f4e64ea575e156c1e /tests/auto | |
parent | c651bff5e560dc495896002ce773b418a05b69a1 (diff) | |
download | Qt-3592724b1f7e635904c31ba09a61d6b7259c93e5.zip Qt-3592724b1f7e635904c31ba09a61d6b7259c93e5.tar.gz Qt-3592724b1f7e635904c31ba09a61d6b7259c93e5.tar.bz2 |
Fixed failing test case.
We are not guaranteed that the checked-for event is the last event,
so we look for it in a list instead.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qinputcontext/tst_qinputcontext.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 444672e..67a6819 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -87,7 +87,7 @@ void tst_QInputContext::maximumTextLength() class QFilterInputContext : public QInputContext { public: - QFilterInputContext() : lastType(QEvent::None) {} + QFilterInputContext() {} ~QFilterInputContext() {} QString identifierName() { return QString(); } @@ -99,12 +99,12 @@ public: bool filterEvent( const QEvent *event ) { - lastType = event->type(); + lastTypes.append(event->type()); return false; } public: - QEvent::Type lastType; + QList<QEvent::Type> lastTypes; }; void tst_QInputContext::filterMouseEvents() @@ -117,7 +117,7 @@ void tst_QInputContext::filterMouseEvents() le.setInputContext(ic); QTest::mouseClick(&le, Qt::LeftButton); - QCOMPARE(ic->lastType, QEvent::MouseButtonRelease); + QVERIFY(ic->lastTypes.indexOf(QEvent::MouseButtonRelease) >= 0); le.setInputContext(0); } @@ -145,18 +145,20 @@ void tst_QInputContext::requestSoftwareInputPanel() // Testing single click panel activation. qApp->setAutoSipOnMouseFocus(true); QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(ic2->lastType, QEvent::RequestSoftwareInputPanel); + QVERIFY(ic2->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0); + ic2->lastTypes.clear(); // Testing double click panel activation. qApp->setAutoSipOnMouseFocus(false); QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QVERIFY(ic1->lastType != QEvent::RequestSoftwareInputPanel); + QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0); QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(ic1->lastType, QEvent::RequestSoftwareInputPanel); + QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) >= 0); + ic1->lastTypes.clear(); // Testing right mouse button QTest::mouseClick(le1, Qt::RightButton, Qt::NoModifier, QPoint(5, 5)); - QVERIFY(ic1->lastType != QEvent::RequestSoftwareInputPanel); + QVERIFY(ic1->lastTypes.indexOf(QEvent::RequestSoftwareInputPanel) < 0); } void tst_QInputContext::closeSoftwareInputPanel() @@ -185,11 +187,11 @@ void tst_QInputContext::closeSoftwareInputPanel() // Testing that panel doesn't close between two input methods aware widgets. QTest::mouseClick(le1, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); QTest::mouseClick(le2, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QVERIFY(ic2->lastType != QEvent::CloseSoftwareInputPanel); + QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) < 0); // Testing that panel closes when focusing non-aware widget. QTest::mouseClick(rb, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5)); - QCOMPARE(ic2->lastType, QEvent::CloseSoftwareInputPanel); + QVERIFY(ic2->lastTypes.indexOf(QEvent::CloseSoftwareInputPanel) >= 0); } void tst_QInputContext::selections() |