summaryrefslogtreecommitdiffstats
path: root/tests/auto/qwidget/tst_qwidget.cpp
diff options
context:
space:
mode:
authorMichael Hasselmann <michael@taschenorakel.de>2010-06-07 15:18:54 (GMT)
committerDenis Dzyubenko <denis.dzyubenko@nokia.com>2010-06-07 16:09:43 (GMT)
commit0c0f22ec0e36d7001c8195dcc6e390a37118e33e (patch)
tree5732513e6405bbd807f7083e18040a28d654be97 /tests/auto/qwidget/tst_qwidget.cpp
parentc28da4dd467c2763bed5c6b31471f078ac26cee6 (diff)
downloadQt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.zip
Qt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.tar.gz
Qt-0c0f22ec0e36d7001c8195dcc6e390a37118e33e.tar.bz2
Fix QApplication/QWidget to really take ownership of input contexts
* src/gui/kernel/[qapplication|qwidget].cpp, tests/auto/qapplication/tst_[qapplication|qwidget].cpp (setInputContext): The documentation for [QApplication|QWidget]::setInputContext claims that the [QApplication|QWidget] instance would take ownership. This commit fixes the setter to also reparent the input context. Furthermore, the crappy test for this setter was improved. Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com>
Diffstat (limited to 'tests/auto/qwidget/tst_qwidget.cpp')
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 5d47aed..83a9e3a 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -605,10 +605,14 @@ void tst_QWidget::getSetCheck()
obj1.setAttribute(Qt::WA_InputMethodEnabled);
obj1.setInputContext(var13);
QCOMPARE(static_cast<QInputContext *>(var13), obj1.inputContext());
+ // QWidget takes ownership, so check parent
+ QCOMPARE(var13->parent(), static_cast<QObject *>(&obj1));
+ // Check self assignment
+ obj1.setInputContext(obj1.inputContext());
+ QCOMPARE(static_cast<QInputContext *>(var13), obj1.inputContext());
obj1.setInputContext((QInputContext *)0);
QCOMPARE(qApp->inputContext(), obj1.inputContext());
QVERIFY(qApp->inputContext() != var13);
- //delete var13; // No delete, since QWidget takes ownership
// bool QWidget::autoFillBackground()
// void QWidget::setAutoFillBackground(bool)