From kde-commits Wed May 26 08:37:23 2010 From: David Faure Date: Wed, 26 May 2010 08:37:23 +0000 To: kde-commits Subject: Re: KDE/kdelibs/kdeui/tests Message-Id: <201005261037.23600.faure () kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=127486309122800 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 ;) -- David Faure, faure@kde.org, http://www.davidfaure.fr Sponsored by Nokia to work on KDE, incl. Konqueror (http://www.konqueror.org).