Home

QtTestEventList Class Reference

QtTestEventList is a list of GUI events. More...

#include <QtTestEventList>

Public Functions


Detailed Description

QtTestEventList is a list of GUI events.

QtTestEventList inherits from QList<QtTestEvent>, and provides convenience functions for populating the list.

A QtTestEventList can be populated with GUI events that can be stored as test data for later usage, or be replayed on any QWidget.

Example:

    QtTestEventList events;
    events.addKeyClick('a');
    events.addKeyClick(Qt::Key_Backspace);
    events.addDelay(200);

    QLineEdit *lineEdit = new QLineEdit(myParent);
    ...
    events.simulate(lineEdit);
    events.simulate(lineEdit);

The example above simulates the user entering the character a followed by a backspace, waiting for 200 milliseconds and repeating it.


Member Function Documentation

QtTestEventList::QtTestEventList ()

Constructs an empty QtTestEventList.

QtTestEventList::QtTestEventList ( const QtTestEventList & other )

Constructs a new QtTestEventList as a copy of other.

QtTestEventList::~QtTestEventList ()

Empties the list and destroys all stored events.

void QtTestEventList::addDelay ( int msecs )

Adds a msecs milliseconds delay.

See also QtTest::wait().

void QtTestEventList::addKeyClick ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

Adds a new key click to the list. The event will simulate the key qtKey with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyClick().

void QtTestEventList::addKeyClick ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds a new key click to the list. The event will simulate the key ascii with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyClick().

void QtTestEventList::addKeyClicks ( const QString & keys, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

Adds new keyboard entries to the list. The event will press the keys with the modifiers and wait msecs milliseconds between each key.

See also QtTest::keyClicks().

void QtTestEventList::addKeyPress ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

Adds a new key press to the list. The event will press the key qtKey with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyPress().

void QtTestEventList::addKeyPress ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds a new key press to the list. The event will press the key ascii with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyPress().

void QtTestEventList::addKeyRelease ( Qt::Key qtKey, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

Adds a new key release to the list. The event will release the key qtKey with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyRelease().

void QtTestEventList::addKeyRelease ( char ascii, Qt::KeyboardModifiers modifiers = Qt::NoModifier, int msecs = -1 )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds a new key release to the list. The event will release the key ascii with the modifier modifiers and then wait for msecs milliseconds.

See also QtTest::keyRelease().

void QtTestEventList::addMouseClick ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )

Add a mouse click to the list. The event will click the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.

See also QtTest::mouseClick().

void QtTestEventList::addMouseDClick ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )

Add a double mouse click to the list. The event will double click the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.

See also QtTest::mousePress().

void QtTestEventList::addMouseMove ( QPoint pos = QPoint(), int delay = -1 )

Adds a mouse move to the list. The event will move the mouse to the position pos. If a delay (in milliseconds) is set, the test will wait after moving the mouse. The default position is the center of the widget.

See also QtTest::mousePress().

void QtTestEventList::addMousePress ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )

Add a mouse press to the list. The event will press the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.

See also QtTest::mousePress().

void QtTestEventList::addMouseRelease ( Qt::MouseButton button, Qt::KeyboardModifiers modifiers = 0, QPoint pos = QPoint(), int delay = -1 )

Add a mouse release to the list. The event will release the button with optional modifiers at the position pos with an optional delay. The default position is the center of the widget.

See also QtTest::mouseRelease().

void QtTestEventList::clear ()

Removes all events from the list.

void QtTestEventList::simulate ( QWidget * w )

Simulates the events from the list one by one on the widget w. For an example, please read the QtTestEventList class documentation.


Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions