summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmessagebox
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-12-30 05:25:38 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-12-30 05:25:38 (GMT)
commit89866e1112bba004847573c5494aa3b6ec75049f (patch)
tree4b47e6db545fb3b4a06e305da797a316386b29a3 /tests/auto/qmessagebox
parent6981c17455f949fd4fccbaf1bd42ab48f95d4212 (diff)
downloadQt-89866e1112bba004847573c5494aa3b6ec75049f.zip
Qt-89866e1112bba004847573c5494aa3b6ec75049f.tar.gz
Qt-89866e1112bba004847573c5494aa3b6ec75049f.tar.bz2
tst_qmessagebox: fix `about' test on mac
QMessageBox::about and aboutQt are modeless on Mac (only). This means that if we simulate key events, we need to explicitly run the event loop until they are consumed. Prior to a31d271bdd4594ea455736a0000cd3493b0efc93, this buggy test was causing detailsButtonText to fail.
Diffstat (limited to 'tests/auto/qmessagebox')
-rw-r--r--tests/auto/qmessagebox/tst_qmessagebox.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp
index 9e497fa..4bc1a28 100644
--- a/tests/auto/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp
@@ -55,6 +55,8 @@
#include <QCleanlooksStyle>
#endif
+#include "../../shared/util.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -383,7 +385,13 @@ void tst_QMessageBox::about()
keyToSend = Qt::Key_Escape;
sendKeySoon();
QMessageBox::about(0, "Caption", "This is an auto test");
+ // On Mac, about and aboutQt are not modal, so we need to
+ // explicitly run the event loop
+#ifdef Q_WS_MAC
+ QTRY_COMPARE(keyToSend, -1);
+#else
QCOMPARE(keyToSend, -1);
+#endif
#if !defined(Q_OS_WINCE)
keyToSend = Qt::Key_Enter;
@@ -392,7 +400,11 @@ void tst_QMessageBox::about()
#endif
sendKeySoon();
QMessageBox::aboutQt(0, "Caption");
+#ifdef Q_WS_MAC
+ QTRY_COMPARE(keyToSend, -1);
+#else
QCOMPARE(keyToSend, -1);
+#endif
}
// Old message box enums