[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdeui/tests
From:       David Faure <faure () kde ! org>
Date:       2010-05-26 8:37:23
Message-ID: 201005261037.23600.faure () kde ! org
[Download RAW message or body]

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<KDialog> 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).

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic