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

List:       kde-commits
Subject:    KDE/kdelibs/kdeui/tests
From:       David Faure <faure () kde ! org>
Date:       2010-05-06 15:58:00
Message-ID: 20100506160214.ACCBFAC8AC () svn ! kde ! org
[Download RAW message or body]

SVN commit 1123678 by dfaure:

Add unittest for what happens when closing (with the window manager button) a dialog \
that has a cancel button: cancelClicked() is emitted, and rejected() is emitted as \
                well.
CCMAIL: mat69@gmx.net


 M  +13 -0     kdialog_unittest.cpp  


--- trunk/KDE/kdelibs/kdeui/tests/kdialog_unittest.cpp #1123677:1123678
@@ -156,6 +156,19 @@
         QCOMPARE(dialog.buttonWhatsThis(id), whatsthis);
         QCOMPARE(dialog.button(id)->whatsThis(), whatsthis);
     }
+
+    void testCloseDialog()
+    {
+        KDialog dialog;
+        dialog.setButtons(KDialog::Ok | KDialog::Cancel);
+        QSignalSpy qCancelClickedSpy(&dialog, SIGNAL(cancelClicked()));
+        QSignalSpy qRejectedSpy(&dialog, SIGNAL(rejected()));
+        dialog.show(); // KDialog::closeEvent tests for isHidden
+        dialog.close();
+        QTest::qWait(200);
+        QCOMPARE(qCancelClickedSpy.count(), 1); // KDialog emulated cancel being \
clicked +        QCOMPARE(qRejectedSpy.count(), 1); // and then rejected is emitted \
as well +    }
 };
 
 QTEST_KDEMAIN(KDialog_UnitTest, GUI)


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

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