summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-08-26 19:29:33 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-29 12:44:24 +0200
commitdf7944e7d7dd8b2bbccbd639eff0ab09745d6cc3 (patch)
treec59f5ed9f7f74ad6a2bca10225af56e98bf00b14 /tests/auto/widgets/dialogs
parente4b2a0b4bab2a17a65fedafe9bae50af1fe019f6 (diff)
Cocoa: Fix QFontDialog, QColorDialog auto-tests
The new Cocoa event dispatcher made apparent some deficiencies in the way the dialog helpers were being hidden. In particular, we would not stop a dialog helper's modal loop when closing the dialog, resulting in the auto-tests hanging. Also, since the QApplication event loop is runnig with [NSApp run] in the stack, the previous workarounds are no longer needed. Task-number: QTBUG-24321 Change-Id: Ifba713c286638d78a699c319a15683d09714f06f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp11
-rw-r--r--tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp17
2 files changed, 11 insertions, 17 deletions
diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
index d83e4729ef..06491f96ab 100644
--- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
+++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
@@ -144,13 +144,10 @@ void tst_QColorDialog::postKeyReturn() {
void tst_QColorDialog::testGetRgba()
{
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "Sending QTest::keyClick to OSX color dialog helper fails, see QTBUG-24320", Continue);
-#endif
- bool ok = false;
- QTimer::singleShot(500, this, SLOT(postKeyReturn()));
- QColorDialog::getRgba(0xffffffff, &ok);
- QVERIFY(ok);
+ QColorDialog cd;
+ cd.show();
+ QTimer::singleShot(0, this, SLOT(postKeyReturn()));
+ QTRY_COMPARE(cd.result(), int(QDialog::Accepted));
}
void tst_QColorDialog::defaultOkButton()
diff --git a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
index 1762e40a9d..ae70adf94b 100644
--- a/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
+++ b/tests/auto/widgets/dialogs/qfontdialog/tst_qfontdialog.cpp
@@ -64,7 +64,7 @@ public:
public slots:
void postKeyReturn();
- void testGetFont();
+ void testDefaultOkButton();
void testSetFont();
public slots:
@@ -116,15 +116,12 @@ void tst_QFontDialog::postKeyReturn() {
}
}
-void tst_QFontDialog::testGetFont()
+void tst_QFontDialog::testDefaultOkButton()
{
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "Sending QTest::keyClick to OSX font dialog helper fails, see QTBUG-24321", Continue);
-#endif
- bool ok = false;
- QTimer::singleShot(2000, this, SLOT(postKeyReturn()));
- QFontDialog::getFont(&ok);
- QVERIFY(ok);
+ QFontDialog fd;
+ fd.show();
+ QTimer::singleShot(0, this, SLOT(postKeyReturn()));
+ QTRY_COMPARE(fd.result(), int(QDialog::Accepted));
}
void tst_QFontDialog::runSlotWithFailsafeTimer(const char *member)
@@ -144,7 +141,7 @@ void tst_QFontDialog::runSlotWithFailsafeTimer(const char *member)
void tst_QFontDialog::defaultOkButton()
{
- runSlotWithFailsafeTimer(SLOT(testGetFont()));
+ runSlotWithFailsafeTimer(SLOT(testDefaultOkButton()));
}
void tst_QFontDialog::testSetFont()