Commit 8cb3031d authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Changing sendEvent() to notifyEvent().

QTest code uses notifyEvent() to post events. That being the case, it may be
more appropriate for our testing code to use notifyEvent() as well. This may
improve test playback reliability across platforms.
parent 5a1d83d0
......@@ -70,7 +70,7 @@ bool pq3DViewEventPlayer::playEvent(QObject* Object,
QEvent::Type type = (Command == "mousePress")? QEvent::MouseButtonPress :
((Command=="mouseMove")? QEvent::MouseMove : QEvent::MouseButtonRelease);
QMouseEvent e(type, QPoint(x,y), button, buttons, keym);
QCoreApplication::sendEvent(Object, &e);
qApp->notify(Object, &e);
}
return true;
}
......
......@@ -101,7 +101,7 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
{
menu_bar->setActiveAction(next->menuAction());
int max_wait = 0;
while(!next->isVisible() && (++max_wait) <= 10)
while(!next->isVisible() && (++max_wait) <= 2)
{
pqEventDispatcher::processEventsAndWait(100);
}
......@@ -111,7 +111,7 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
menu->setActiveAction(next->menuAction());
int max_wait = 0;
while(!next->isVisible() && (++max_wait) <= 10)
while(!next->isVisible() && (++max_wait) <= 2)
{
pqEventDispatcher::processEventsAndWait(100);
}
......@@ -126,8 +126,8 @@ bool pqAbstractActivateEventPlayer::playEvent(QObject* Object,
QKeyEvent keyDown(QEvent::KeyPress, Qt::Key_Enter, Qt::NoModifier);
QKeyEvent keyUp(QEvent::KeyRelease, Qt::Key_Enter, Qt::NoModifier);
QApplication::sendEvent(object, &keyDown);
QApplication::sendEvent(object, &keyUp);
qApp->notify(object, &keyDown);
qApp->notify(object, &keyUp);
//QApplication::processEvents();
return true;
......
......@@ -143,7 +143,7 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co
data[3],
!!data[4].toInt(),
data[5].toInt());
QCoreApplication::sendEvent(object, &ke);
qApp->notify(object, &ke);
return true;
}
}
......@@ -178,12 +178,13 @@ bool pqAbstractItemViewEventPlayer::playEvent(QObject* Object, const QString& Co
QRect r = object->visualRect(idx);
pt = r.topLeft() + QPoint(x,y);
}
QEvent::Type type = QEvent::MouseButtonPress;
type = Command == "mouseMove" ? QEvent::MouseMove : type;
type = Command == "mouseRelease" ? QEvent::MouseButtonRelease : type;
type = Command == "mouseDblClick" ? QEvent::MouseButtonDblClick : type;
QMouseEvent e(type, pt, button, buttons, keym);
QCoreApplication::sendEvent(object->viewport(), &e);
qApp->notify(object->viewport(), &e);
return true;
}
}
......
......@@ -55,15 +55,15 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* Object,
QPoint pt(widget->x(), widget->y());
QPoint globalPt = widget->mapToGlobal(pt);
QContextMenuEvent e(QContextMenuEvent::Other, pt, globalPt);
QCoreApplication::sendEvent(widget, &e);
qApp->notify(widget, &e);
return true;
}
else if(Command == "key")
{
QKeyEvent kd(QEvent::KeyPress, Arguments.toInt(), Qt::NoModifier);
QKeyEvent ku(QEvent::KeyRelease, Arguments.toInt(), Qt::NoModifier);
QCoreApplication::sendEvent(widget, &kd);
QCoreApplication::sendEvent(widget, &ku);
qApp->notify(widget, &kd);
qApp->notify(widget, &ku);
return true;
}
else if(Command == "keyEvent")
......@@ -75,7 +75,7 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* Object,
data[3],
!!data[4].toInt(),
data[5].toInt());
QCoreApplication::sendEvent(widget, &ke);
qApp->notify(widget, &ke);
return true;
}
else if(Command.startsWith("mouse"))
......@@ -100,7 +100,7 @@ bool pqBasicWidgetEventPlayer::playEvent(QObject* Object,
button = Qt::NoButton;
}
QMouseEvent e(type, pt, button, buttons, keym);
QCoreApplication::sendEvent(widget, &e);
qApp->notify(widget, &e);
return true;
}
}
......
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