summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2009-04-17 11:58:37 (GMT)
committeraxis <qt-info@nokia.com>2009-05-04 13:24:34 (GMT)
commit82840fcce074658bd39ad6425fd50022b9250dcf (patch)
treefe184623e20c5711dbb03cab8de357a72fc85ea0 /tests
parent23972064c554163e4bdb6de0fe6eaa0d41a6ad6a (diff)
downloadQt-82840fcce074658bd39ad6425fd50022b9250dcf.zip
Qt-82840fcce074658bd39ad6425fd50022b9250dcf.tar.gz
Qt-82840fcce074658bd39ad6425fd50022b9250dcf.tar.bz2
Close the input panel when focusing a non-inputmethods aware widget.
AutoTest: Included RevBy: denis
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 5fdd931..444b400 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -46,6 +46,7 @@
#include <qlineedit.h>
#include <qplaintextedit.h>
#include <qlayout.h>
+#include <qradiobutton.h>
class tst_QInputContext : public QObject
{
@@ -64,6 +65,7 @@ private slots:
void maximumTextLength();
void filterMouseEvents();
void requestSoftwareInputPanel();
+ void closeSoftwareInputPanel();
};
void tst_QInputContext::maximumTextLength()
@@ -156,5 +158,38 @@ void tst_QInputContext::requestSoftwareInputPanel()
QVERIFY(ic1->lastType != QEvent::RequestSoftwareInputPanel);
}
+void tst_QInputContext::closeSoftwareInputPanel()
+{
+ QWidget w;
+ QLayout *layout = new QVBoxLayout;
+ QLineEdit *le1, *le2;
+ QRadioButton *rb;
+ le1 = new QLineEdit;
+ le2 = new QLineEdit;
+ rb = new QRadioButton;
+ layout->addWidget(le1);
+ layout->addWidget(le2);
+ layout->addWidget(rb);
+ w.setLayout(layout);
+
+ QFilterInputContext *ic1, *ic2;
+ ic1 = new QFilterInputContext;
+ ic2 = new QFilterInputContext;
+ le1->setInputContext(ic1);
+ le2->setInputContext(ic2);
+
+ w.show();
+ QApplication::setActiveWindow(&w);
+
+ // 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);
+
+ // Testing that panel closes when focusing non-aware widget.
+ QTest::mouseClick(rb, Qt::LeftButton, Qt::NoModifier, QPoint(5, 5));
+ QCOMPARE(ic2->lastType, QEvent::CloseSoftwareInputPanel);
+}
+
QTEST_MAIN(tst_QInputContext)
#include "tst_qinputcontext.moc"