Commit 4a25f910 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

BUG: On Macs, the test playback is relying on timeouts to detect modal dialogs.

Now, this timeout can happen, even when we are not really waiting a modal
dialog's exec() e.g. when we are simply waiting for a short time for the GUI to
refresh. This was resulting in the test playing continuing oddly causing some
tests that use too many modal dialogs to fail. This should fix that that issue.
parent 7cf81798
......@@ -48,6 +48,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream>
using namespace std;
bool pqEventDispatcher::DeferMenuTimeouts = false;
//-----------------------------------------------------------------------------
pqEventDispatcher::pqEventDispatcher(QObject* parentObject) :
Superclass(parentObject)
......@@ -176,6 +177,8 @@ void pqEventDispatcher::playEventStack(void* activeWidget)
//-----------------------------------------------------------------------------
void pqEventDispatcher::processEventsAndWait(int ms)
{
bool prev = pqEventDispatcher::DeferMenuTimeouts;
pqEventDispatcher::DeferMenuTimeouts = true;
if (ms > 0)
{
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
......@@ -184,11 +187,23 @@ void pqEventDispatcher::processEventsAndWait(int ms)
loop.exec(QEventLoop::ExcludeUserInputEvents);
}
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
pqEventDispatcher::DeferMenuTimeouts = prev;
}
//-----------------------------------------------------------------------------
void pqEventDispatcher::onMenuTimerTimeout()
{
// this is used to capture cases where are popup-menu (or any modal dialog in
// case of APPLE) is active in its event loop. However, we don't want the
// test to proceed if this timeout happened while we were in the
// processEventsAndWait() loop at any stage in executing an event. So we have
// this trap.
if (pqEventDispatcher::DeferMenuTimeouts)
{
this->AdhocMenuTimer.start();
return;
}
QWidget* currentPopup = QApplication::activePopupWidget();
#if defined(__APPLE__)
if (!currentPopup)
......
......@@ -82,6 +82,7 @@ protected slots:
protected:
bool PlayBackFinished;
bool PlayBackStatus;
static bool DeferMenuTimeouts;
pqEventSource* ActiveSource;
pqEventPlayer* ActivePlayer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment