summaryrefslogtreecommitdiffstats
path: root/tests/auto/qinputcontext
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-02-11 04:30:21 (GMT)
committerAndrew den Exter <andrew.den-exter@nokia.com>2011-02-15 00:58:07 (GMT)
commit5f9f98ec047024fadbfdea334fbea7c357179032 (patch)
tree37114e50063c4467138c2ff361a8e62ddfc67508 /tests/auto/qinputcontext
parent3bc6f8d8dd630cd0298e27fc4b7430d2bf73a232 (diff)
downloadQt-5f9f98ec047024fadbfdea334fbea7c357179032.zip
Qt-5f9f98ec047024fadbfdea334fbea7c357179032.tar.gz
Qt-5f9f98ec047024fadbfdea334fbea7c357179032.tar.bz2
Fix inheritance of widget input contexts.
If a parent widget has an input context assigned return that from QWidget::inputContext() before returning QApplication::inputContext(). Change-Id: I4982a91ace9b7485534f1c31fa4e2d549482640e Task-number: QTBUG-17390 Reviewed-by: axis
Diffstat (limited to 'tests/auto/qinputcontext')
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 800f9de..6a047f2 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -88,6 +88,7 @@ private slots:
void closeSoftwareInputPanel();
void selections();
void focusProxy();
+ void contextInheritance();
void symbianTestCoeFepInputContext_data();
void symbianTestCoeFepInputContext();
void symbianTestCoeFepAutoCommit_data();
@@ -473,6 +474,37 @@ void tst_QInputContext::focusProxy()
QCOMPARE(gic->focusWidget(), &proxy);
}
+void tst_QInputContext::contextInheritance()
+{
+ QWidget parent;
+ QWidget child(&parent);
+
+ parent.setAttribute(Qt::WA_InputMethodEnabled, true);
+ child.setAttribute(Qt::WA_InputMethodEnabled, true);
+
+ QCOMPARE(parent.inputContext(), qApp->inputContext());
+ QCOMPARE(child.inputContext(), qApp->inputContext());
+
+ QInputContext *qic = new QFilterInputContext;
+ parent.setInputContext(qic);
+ QCOMPARE(parent.inputContext(), qic);
+ QCOMPARE(child.inputContext(), qic);
+
+ parent.setAttribute(Qt::WA_InputMethodEnabled, false);
+ QVERIFY(!parent.inputContext());
+ QCOMPARE(child.inputContext(), qic);
+ parent.setAttribute(Qt::WA_InputMethodEnabled, true);
+
+ parent.setInputContext(0);
+ QCOMPARE(parent.inputContext(), qApp->inputContext());
+ QCOMPARE(child.inputContext(), qApp->inputContext());
+
+ qic = new QFilterInputContext;
+ qApp->setInputContext(qic);
+ QCOMPARE(parent.inputContext(), qic);
+ QCOMPARE(child.inputContext(), qic);
+}
+
#ifdef QT_WEBKIT_LIB
class AutoWebView : public QWebView
{