tests/auto/qdialog/tst_qdialog.cpp
changeset 30 5dc02b23752f
parent 19 fcece45ef507
equal deleted inserted replaced
29:b72c6db6890b 30:5dc02b23752f
   445     QMetaObject::invokeMethod(dialog, "deleteLater", Qt::QueuedConnection);
   445     QMetaObject::invokeMethod(dialog, "deleteLater", Qt::QueuedConnection);
   446     QCOMPARE(dialog->exec(), int(QDialog::Rejected));
   446     QCOMPARE(dialog->exec(), int(QDialog::Rejected));
   447 }
   447 }
   448 
   448 
   449 #ifndef QT_NO_EXCEPTIONS
   449 #ifndef QT_NO_EXCEPTIONS
   450 class QDialogTestException { };
   450 class QDialogTestException : public std::exception { };
   451 
   451 
   452 class ExceptionDialog : public QDialog
   452 class ExceptionDialog : public QDialog
   453 {
   453 {
   454     Q_OBJECT
   454     Q_OBJECT
   455 public:
   455 public:
   469 #endif
   469 #endif
   470     int caughtExceptions = 0;
   470     int caughtExceptions = 0;
   471     try {
   471     try {
   472         ExceptionDialog dialog;
   472         ExceptionDialog dialog;
   473         QMetaObject::invokeMethod(&dialog, "throwException", Qt::QueuedConnection);
   473         QMetaObject::invokeMethod(&dialog, "throwException", Qt::QueuedConnection);
       
   474         QMetaObject::invokeMethod(&dialog, "reject", Qt::QueuedConnection);
   474         (void) dialog.exec();
   475         (void) dialog.exec();
   475     } catch(...) {
   476     } catch(...) {
   476         ++caughtExceptions;
   477         ++caughtExceptions;
   477     }
   478     }
       
   479 #ifdef Q_OS_SYMBIAN
       
   480     //on symbian, the event loop absorbs exceptions
       
   481     QCOMPARE(caughtExceptions, 0);
       
   482 #else
   478     QCOMPARE(caughtExceptions, 1);
   483     QCOMPARE(caughtExceptions, 1);
       
   484 #endif
   479 }
   485 }
   480 #else
   486 #else
   481 void tst_QDialog::throwInExec()
   487 void tst_QDialog::throwInExec()
   482 {
   488 {
   483     QSKIP("Exceptions are disabled", SkipAll);
   489     QSKIP("Exceptions are disabled", SkipAll);