summaryrefslogtreecommitdiffstats
path: root/tests/auto/qapplication/tst_qapplication.cpp
diff options
context:
space:
mode:
authorPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-10-22 16:39:14 +0200
committerPrasanth Ullattil <prasanth.ullattil@nokia.com>2009-10-23 13:25:13 +0200
commit3481db791c3b48e28f1a9531b247adf6562edb71 (patch)
tree201d9160ad1e31bc0986778345b3390474d0f967 /tests/auto/qapplication/tst_qapplication.cpp
parent19c60da9c15dc609d6d07c687a59d9c2c1a4da13 (diff)
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/tst_qapplication.cpp')
-rw-r--r--tests/auto/qapplication/tst_qapplication.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qapplication/tst_qapplication.cpp b/tests/auto/qapplication/tst_qapplication.cpp
index 97aa0924d0..e8e1ef0ab0 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()
{