diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2012-01-19 11:53:09 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-23 14:47:10 +0100 |
commit | 1831abb5bbcb520ffcb329fa67bf4d4405eb2ab4 (patch) | |
tree | a439dbe7cd578412610893bbfd6dda5b8ce6da7f /tests | |
parent | 75583bd60583a17402dade392e5ff9bc50d198ea (diff) |
Remove QEventLoop::DeferredDeletion
This flag has been deprecated since Qt 4.4, so remove it.
tst_QApplication had 2 nearly identical tests, one for testing the
QEventLoop::DeferredDeletion flag, and one to test sendPostedEvents()
with QEvent::DeferredDelete. The latter is the preferred way, so keep
that test, but remove the test for the obsoleted flag.
Change-Id: Icdb7483c32b3c920bda31d2bbb4f7414ece6d826
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp | 75 |
1 files changed, 3 insertions, 72 deletions
diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 821952cd62..5f0ed808c4 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -1258,51 +1258,12 @@ public slots: { QApplication::processEvents(); } - void processEventsWithDeferredDeletion() - { - QApplication::processEvents(QEventLoop::DeferredDeletion); - } void sendPostedEventsWithDeferredDelete() { QApplication::sendPostedEvents(0, QEvent::DeferredDelete); } - void deleteLaterAndProcessEvents1() - { - QEventLoop eventLoop; - - QPointer<QObject> p = this; - deleteLater(); - - // trying to delete this object in a deeper eventloop just won't work - QMetaObject::invokeMethod(this, - "processEventsOnly", - Qt::QueuedConnection); - QMetaObject::invokeMethod(&eventLoop, "quit", Qt::QueuedConnection); - eventLoop.exec(); - QVERIFY(p); - QMetaObject::invokeMethod(this, - "processEventsWithDeferredDeletion", - Qt::QueuedConnection); - QMetaObject::invokeMethod(&eventLoop, "quit", Qt::QueuedConnection); - eventLoop.exec(); - QVERIFY(p); - QMetaObject::invokeMethod(this, - "sendPostedEventsWithDeferredDelete", - Qt::QueuedConnection); - QMetaObject::invokeMethod(&eventLoop, "quit", Qt::QueuedConnection); - eventLoop.exec(); - QVERIFY(p); - - // trying to delete it from this eventloop still doesn't work - QApplication::processEvents(); - QVERIFY(p); - - // however, it *will* work with this magic incantation - QApplication::processEvents(QEventLoop::DeferredDeletion); - QVERIFY(!p); - } - void deleteLaterAndProcessEvents2() + void deleteLaterAndProcessEvents() { QEventLoop eventLoop; @@ -1317,12 +1278,6 @@ public slots: eventLoop.exec(); QVERIFY(p); QMetaObject::invokeMethod(this, - "processEventsWithDeferredDeletion", - Qt::QueuedConnection); - QMetaObject::invokeMethod(&eventLoop, "quit", Qt::QueuedConnection); - eventLoop.exec(); - QVERIFY(p); - QMetaObject::invokeMethod(this, "sendPostedEventsWithDeferredDelete", Qt::QueuedConnection); QMetaObject::invokeMethod(&eventLoop, "quit", Qt::QueuedConnection); @@ -1355,16 +1310,7 @@ void tst_QApplication::testDeleteLaterProcessEvents() QApplication app(argc, 0, QApplication::GuiServer); // If you call processEvents() with an event dispatcher present, but // outside any event loops, deferred deletes are not processed unless - // QEventLoop::DeferredDeletion is passed. - object = new QObject; - p = object; - object->deleteLater(); - app.processEvents(); - QVERIFY(p); - app.processEvents(QEventLoop::ProcessEventsFlag(0x10)); // 0x10 == QEventLoop::DeferredDeletion - QVERIFY(!p); - - // sendPostedEvents(0, DeferredDelete); also works + // sendPostedEvents(0, DeferredDelete) is called. object = new QObject; p = object; object->deleteLater(); @@ -1423,22 +1369,7 @@ void tst_QApplication::testDeleteLaterProcessEvents() EventLoopNester *nester = new EventLoopNester(); p = nester; QTimer::singleShot(3000, &loop, SLOT(quit())); - QTimer::singleShot(0, nester, SLOT(deleteLaterAndProcessEvents1())); - - loop.exec(); - QVERIFY(!p); - } - - { - // when the event loop that calls deleteLater() also calls - // processEvents() immediately afterwards, the object should - // not die until the parent loop continues - QApplication app(argc, 0, QApplication::GuiServer); - QEventLoop loop; - EventLoopNester *nester = new EventLoopNester(); - p = nester; - QTimer::singleShot(3000, &loop, SLOT(quit())); - QTimer::singleShot(0, nester, SLOT(deleteLaterAndProcessEvents2())); + QTimer::singleShot(0, nester, SLOT(deleteLaterAndProcessEvents())); loop.exec(); QVERIFY(!p); |