summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
authorPekka Vuorela <pekka.ta.vuorela@nokia.com>2012-01-02 17:42:00 +0200
committerQt by Nokia <qt-info@nokia.com>2012-01-05 11:40:08 +0100
commit8ad583b7f9cd4ab450e636bc2c0626975397aa86 (patch)
treecccc38e417a7e9ffb1f0020456078d6d114b5c7f /tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
parentad22c0c7cff332a77ea527c21e39490c8917b68e (diff)
Removed QApplication::setInputContext()
Obsoleted by platform input context. Setting a custom QInputContext wouldn't work properly anymore. Change-Id: I966573a82fdd7530544878513a655eae7b3ad67b Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp54
1 files changed, 14 insertions, 40 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index d8d9589691..16bb5d345b 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -442,16 +442,6 @@ bool tst_QWidget::ensureScreenSize(int width, int height)
return (available.width() >= width && available.height() >= height);
}
-class MyInputContext : public QInputContext
-{
-public:
- MyInputContext() : QInputContext() {}
- QString identifierName() { return QString("NoName"); }
- QString language() { return QString("NoLanguage"); }
- void reset() {}
- bool isComposing() const { return false; }
-};
-
// Testing get/set functions
void tst_QWidget::getSetCheck()
{
@@ -587,13 +577,6 @@ void tst_QWidget::getSetCheck()
obj1.setAcceptDrops(true);
QCOMPARE(true, obj1.acceptDrops());
- // QInputContext * QWidget::inputContext()
- MyInputContext *var13 = new MyInputContext;
- qApp->setInputContext(var13);
- QCOMPARE((QInputContext *)0, obj1.inputContext()); // The widget by default doesn't have the WA_InputMethodEnabled attribute
- obj1.setAttribute(Qt::WA_InputMethodEnabled);
- QCOMPARE(static_cast<QInputContext *>(var13), obj1.inputContext());
-
// bool QWidget::autoFillBackground()
// void QWidget::setAutoFillBackground(bool)
obj1.setAutoFillBackground(false);
@@ -9128,23 +9111,10 @@ void tst_QWidget::openModal_taskQTBUG_5804()
delete win;
}
-class InputContextTester : public QInputContext
-{
- Q_OBJECT
-public:
- QString identifierName() { return QString(); }
- bool isComposing() const { return false; }
- QString language() { return QString(); }
- void reset() { ++resets; }
- int resets;
-};
-
void tst_QWidget::focusProxyAndInputMethods()
{
- InputContextTester *inputContext = new InputContextTester;
QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint);
toplevel->setAttribute(Qt::WA_InputMethodEnabled, true);
- qApp->setInputContext(inputContext); // ownership is transferred
QWidget *child = new QWidget(toplevel);
child->setFocusProxy(toplevel);
@@ -9167,20 +9137,24 @@ void tst_QWidget::focusProxyAndInputMethods()
// and that the input method gets the focus proxy passed
// as the focus widget instead of the child widget.
// otherwise input method queries go to the wrong widget
+ QInputContext *inputContext = qApp->inputContext();
+ if (inputContext) {
+ QCOMPARE(inputContext->focusWidget(), toplevel);
- QCOMPARE(inputContext->focusWidget(), toplevel);
+ child->setAttribute(Qt::WA_InputMethodEnabled, false);
+ QVERIFY(!inputContext->focusWidget());
- child->setAttribute(Qt::WA_InputMethodEnabled, false);
- QVERIFY(!inputContext->focusWidget());
-
- child->setAttribute(Qt::WA_InputMethodEnabled, true);
- QCOMPARE(inputContext->focusWidget(), toplevel);
+ child->setAttribute(Qt::WA_InputMethodEnabled, true);
+ QCOMPARE(inputContext->focusWidget(), toplevel);
- child->setEnabled(false);
- QVERIFY(!inputContext->focusWidget());
+ child->setEnabled(false);
+ QVERIFY(!inputContext->focusWidget());
- child->setEnabled(true);
- QCOMPARE(inputContext->focusWidget(), toplevel);
+ child->setEnabled(true);
+ QCOMPARE(inputContext->focusWidget(), toplevel);
+ } else {
+ qDebug() << "No input context set, skipping QInputContext::focusWidget() test";
+ }
delete toplevel;
}