![]() ![]() Simulates clicking a sequence of keys on a widget. void QtTest::ke圜licks ( QWidget * widget, const QString & sequence, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1 ) The example above simulates clicking a on myWidget without any keyboard modifiers and without delay of the test. It behaves essentially like the above function.Įxample: QtTest::ke圜lick(myWidget, 'a') This is an overloaded member function, provided for convenience. ![]() void QtTest::ke圜lick ( QWidget * widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1 ) The second example simulates clicking shift-escape on myWidget with a following 200 ms delay of the test. The first example above simulates clicking the escape key on myWidget without any keyboard modifiers and without delay. QtTest::ke圜lick(myWidget, Qt::Key_Escape, Qt::ShiftModifier, 200) If delay is larger than 0, the test will wait for delay milliseconds.Įxamples: QtTest::ke圜lick(myWidget, Qt::Key_Escape) Simulates clicking of key with an optional modifier on a widget. void QtTest::ke圜lick ( QWidget * widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay = -1 ) The example above tests that QDir::mkdir() outputs the right warning when invoked with an invalid file name. QtTest::ignoreMessage(QtWarningMessage, "QDir::mkdir: Empty or null file name(s)") If the message you want to ignore is outputted twice, you have to call ignoreMessage() twice, too. Note: Invoking this function will only ignore one message. If the test finished and the message was not outputted, a test failure is appended to the test log. If the message with the corresponding type is outputted, it will be removed from the test log. Ignores messages created by qDebug() or qWarning(). void QtTest::ignoreMessage ( QtMsgType type, const char * message ) For a list of recognized arguments, read QtTest Command Line Arguments.įor stand-alone tests, the convenience macro QTTEST_MAIN() can be used to declare a main method that parses the command line arguments and executes the tests. Optionally, the command line arguments argc and argv can be provided. If (qstrcmp(currentTestFunction(), "myDatabaseTest") = 0) int QtTest::exec ( QObject * testObject, int argc = 0, char ** argv = 0 )Įxecutes tests declared in testObject. Returns the name of the test function that is currently executed. const char * QtTest::currentTestFunction () Returns true if the current test function failed, otherwise false. ![]() If the test doesn't have any assigned testdata, the function returns 0. Returns the name of the current test data. Use this mode when it doesn't make sense to execute the test any further after the expected failure.Ĭontinues execution of the test after the expected failure.įunction Documentation const char * QtTest::currentDataTag () ConstantĪborts the execution of the test. This enum describes the modes for handling an expected failure of the VERIFY() or COMPARE() macros. ![]() Skips all the entries in the test table the test won't be executed further. Skips the current entry in the test table continues execution of all the other entries in the table. This enum describes the modes for skipping tests during execution of the test data. ConstantĪ mouse button is clicked (pressed and released).Ī mouse button is double clicked (pressed and released twice). This enum describes possible actions for mouse handling. The key is clicked (pressed and released). This enum describes possible actions for key handling. Type Documentation enum QtTest::KeyAction Please refer to the QtTest documentation for information on how to write unit tests. The QtTest namespace contains all the functions and declarations that are related to the QtTest tool. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |