diff options
author | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-10-22 14:39:14 (GMT) |
---|---|---|
committer | Prasanth Ullattil <prasanth.ullattil@nokia.com> | 2009-10-23 11:25:13 (GMT) |
commit | 3481db791c3b48e28f1a9531b247adf6562edb71 (patch) | |
tree | 201d9160ad1e31bc0986778345b3390474d0f967 /tests/auto/qapplication | |
parent | 19c60da9c15dc609d6d07c687a59d9c2c1a4da13 (diff) | |
download | Qt-3481db791c3b48e28f1a9531b247adf6562edb71.zip Qt-3481db791c3b48e28f1a9531b247adf6562edb71.tar.gz Qt-3481db791c3b48e28f1a9531b247adf6562edb71.tar.bz2 |
Remove internal widgets from QApplication::topLevelWidgets()
We have some internal hidden widgets which should not come up in the
QApplication::topLevelWidgets() list. So the known ones are being
removed from the QWidgetPrivate::allWidgets set.
Task-number: QTBUG-739
Reviewed-by: Denis Dzyubenko
Reviewed-by: Bradley T. Hughes
Diffstat (limited to 'tests/auto/qapplication')
-rw-r--r-- | tests/auto/qapplication/tst_qapplication.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp index 97aa092..e8e1ef0 100644 --- a/tests/auto/qapplication/tst_qapplication.cpp +++ b/tests/auto/qapplication/tst_qapplication.cpp @@ -129,6 +129,7 @@ private slots: void style(); void allWidgets(); + void topLevelWidgets(); void setAttribute(); @@ -1792,6 +1793,27 @@ void tst_QApplication::allWidgets() QVERIFY(!app.allWidgets().contains(w)); // removal test } +void tst_QApplication::topLevelWidgets() +{ + int argc = 1; + QApplication app(argc, &argv0, QApplication::GuiServer); + QWidget *w = new QWidget; + w->show(); +#ifndef QT_NO_CLIPBOARD + QClipboard *clipboard = QApplication::clipboard(); + QString originalText = clipboard->text(); + clipboard->setText(QString("newText")); +#endif + app.processEvents(); + QVERIFY(QApplication::topLevelWidgets().contains(w)); + QCOMPARE(QApplication::topLevelWidgets().count(), 1); + delete w; + w = 0; + app.processEvents(); + QCOMPARE(QApplication::topLevelWidgets().count(), 0); +} + + void tst_QApplication::setAttribute() { |