From kde-commits Thu Jun 03 20:20:23 2010 From: =?iso-8859-1?q?Andr=E9_W=F6bbeking?= Date: Thu, 03 Jun 2010 20:20:23 +0000 To: kde-commits Subject: Re: KDE/kdelibs/kdeui/tests Message-Id: <201006032220.23701.Woebbeking () kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127559645505891 On Wednesday 26 May 2010, David Faure wrote: > On Tuesday 25 May 2010, André Wöbbeking wrote: > > On Friday 21 May 2010, David Faure wrote: > > > SVN commit 1129079 by dfaure: > > > > > > Test for Qt::WA_DeleteOnClose in KDialog closed by OK button, works. > > > > > > M +18 -1 kdialog_unittest.cpp > > > > > > --- trunk/KDE/kdelibs/kdeui/tests/kdialog_unittest.cpp #1129078:1129079 > > > @@ -158,12 +158,29 @@ > > > > > > QCOMPARE(dialog.button(id)->whatsThis(), whatsthis); > > > > > > } > > > > > > - void testCloseDialog() > > > + void testDeleteOnClose() > > > > > > { > > > > > > KDialog* dialog = new KDialog; > > > QWeakPointer dialogPointer(dialog); > > > dialog->setAttribute(Qt::WA_DeleteOnClose); > > > dialog->setButtons(KDialog::Ok | KDialog::Cancel); > > > > > > + QSignalSpy qOkClickedSpy(dialog, SIGNAL(okClicked())); > > > + QSignalSpy qAcceptedSpy(dialog, SIGNAL(accepted())); > > > + dialog->show(); // KDialog::closeEvent tests for isHidden > > > + dialog->button(KDialog::Ok)->click(); > > > + QCOMPARE(qOkClickedSpy.count(), 1); > > > + QCOMPARE(qAcceptedSpy.count(), 1); // and then accepted is > > > emitted as well + qApp->sendPostedEvents(); // DeferredDelete > > > + QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); > > > > I'm just curious, are both calls needed to process the delete events? > > No, I removed the first call in a later commit. > > I don't really understand why the second call works while the first one > doesn't though ;) Maybe related to * [132395] Sent DeferredDelete events at the right time. Specifying the QEventLoop::DeferredDeletion flag (now deprecated) to processEvents() is no longer necessary. (from changes-4.4.0)