From 89866e1112bba004847573c5494aa3b6ec75049f Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 30 Dec 2010 15:25:38 +1000 Subject: 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. --- tests/auto/qmessagebox/tst_qmessagebox.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 #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 -- cgit v0.12