1/****************************************************************************
2**
3** Copyright (C) 2020 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the documentation of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:FDL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Free Documentation License Usage
18** Alternatively, this file may be used under the terms of the GNU Free
19** Documentation License version 1.3 as published by the Free Software
20** Foundation and appearing in the file included in the packaging of
21** this file. Please review the following information to ensure
22** the GNU Free Documentation License version 1.3 requirements
23** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
24** $QT_END_LICENSE$
25**
26****************************************************************************/
27
28/*!
29 \namespace QTest
30 \inmodule QtTest
31
32 \brief The QTest namespace contains all the functions and
33 declarations that are related to Qt Test.
34
35 See the \l{Qt Test Overview} for information about how to write unit tests.
36*/
37
38/*! \macro QVERIFY(condition)
39
40 \relates QTest
41
42 The QVERIFY() macro checks whether the \a condition is true or not. If it is
43 true, execution continues. If not, a failure is recorded in the test log
44 and the test won't be executed further.
45
46 You can use \l QVERIFY2() when it is practical and valuable to put additional
47 information into the test failure report.
48
49 \note This macro can only be used in a test function that is invoked
50 by the test framework.
51
52 For example, the following code shows this macro being used to verify that a
53 \l QSignalSpy object is valid:
54
55 \snippet code/src_qtestlib_qtestcase_snippet.cpp 0
56
57 For more information about the failure, use \c QCOMPARE(x, y) instead of
58 \c QVERIFY(x == y), because it reports both the expected and actual value
59 when the comparison fails.
60
61 \sa QCOMPARE(), QTRY_VERIFY(), QSignalSpy, QEXPECT_FAIL()
62*/
63
64/*! \macro QVERIFY2(condition, message)
65
66 \relates QTest
67
68 The QVERIFY2() macro behaves exactly like QVERIFY(), except that it reports
69 a \a message when \a condition is false. The \a message is a plain C string.
70
71 The message can also be obtained from a function call that produces a plain
72 C string, such as qPrintable() applied to a QString, which may be built in
73 any of its usual ways, including applying \c {.args()} to format some data.
74
75 Example:
76 \snippet code/src_qtestlib_qtestcase.cpp 1
77
78 For example, if you have a file object and you are testing its \c open()
79 function, you might write a test with a statement like:
80
81 \snippet code/src_qtestlib_qtestcase.cpp 32
82
83 If this test fails, it will give no clue as to why the file failed to open:
84
85 \c {FAIL! : tst_QFile::open_write() 'opened' returned FALSE. ()}
86
87 If there is a more informative error message you could construct from the
88 values being tested, you can use \c QVERIFY2() to pass that message along
89 with your test condition, to provide a more informative message on failure:
90
91 \snippet code/src_qtestlib_qtestcase.cpp 33
92
93 If this branch is being tested in the Qt CI system, the above detailed
94 failure message will be inserted into the summary posted to the code-review
95 system:
96
97 \c {FAIL! : tst_QFile::open_write() 'opened' returned FALSE.
98 (open /tmp/qt.a3B42Cd: No space left on device)}
99
100 \sa QVERIFY(), QCOMPARE(), QEXPECT_FAIL()
101*/
102
103/*! \macro QCOMPARE(actual, expected)
104
105 \relates QTest
106
107 The QCOMPARE() macro compares an \a actual value to an \a expected value
108 using the equality operator. If \a actual and \a expected match, execution
109 continues. If not, a failure is recorded in the test log and the test
110 function returns without attempting any later checks.
111
112 Always respect QCOMPARE() parameter semantics. The first parameter passed to
113 it should always be the actual value produced by the code-under-test, while
114 the second parameter should always be the expected value. When the values
115 don't match, QCOMPARE() prints them with the labels \e Actual and \e
116 Expected. If the parameter order is swapped, debugging a failing test can be
117 confusing and tests expecting zero may fail due to rounding errors.
118
119 QCOMPARE() tries to output the contents of the values if the comparison fails,
120 so it is visible from the test log why the comparison failed.
121
122 Example:
123 \snippet code/src_qtestlib_qtestcase.cpp 2
124
125 When comparing floating-point types (\c float, \c double, and \c qfloat16),
126 \l {qFuzzyCompare()} is used for finite values. If \l {qFuzzyIsNull()} is true for
127 both values, they are also considered equal. Infinities match if they have
128 the same sign, and any NaN as actual value matches with any NaN as expected
129 value (even though NaN != NaN, even when they're identical).
130
131 When comparing QList, arrays and initializer lists of the value type
132 can be passed as expected value:
133 \snippet code/src_qtestlib_qtestcase.cpp 34
134
135 Note that using initializer lists requires a defining a helper macro
136 to prevent the preprocessor from interpreting the commas as macro argument
137 delimiters:
138 \snippet code/src_qtestlib_qtestcase.cpp 35
139
140 \note QCOMPARE() can only be used in a test function that is invoked
141 by the test framework.
142
143 For your own classes, you can use \l QTest::toString() to format values for
144 outputting into the test log.
145
146 Example:
147 \snippet code/src_qtestlib_qtestcase_snippet.cpp 34
148
149 The return from \c toString() must be a \c {new char []}. That is, it shall
150 be released with \c delete[] (rather than \c free() or plain \c delete) once
151 the calling code is done with it.
152
153 \sa QVERIFY(), QTRY_COMPARE(), QTest::toString(), QEXPECT_FAIL()
154*/
155
156/*! \macro QVERIFY_EXCEPTION_THROWN(expression, exceptiontype)
157 \since 5.3
158
159 \relates QTest
160
161 The QVERIFY_EXCEPTION_THROWN macro executes an \a expression and tries
162 to catch an exception thrown from the \a expression. If the \a expression
163 throws an exception and its type is the same as \a exceptiontype
164 or \a exceptiontype is substitutable with the type of thrown exception
165 (i.e. usually the type of thrown exception is publicly derived
166 from \a exceptiontype) then execution will be continued. If not-substitutable
167 type of exception is thrown or the \a expression doesn't throw an exception
168 at all, then a failure will be recorded in the test log and
169 the test won't be executed further.
170
171 \note This macro can only be used in a test function that is invoked
172 by the test framework.
173*/
174
175/*! \macro QTRY_VERIFY_WITH_TIMEOUT(condition, timeout)
176 \since 5.0
177
178 \relates QTest
179
180 The QTRY_VERIFY_WITH_TIMEOUT() macro is similar to QVERIFY(), but checks the \a condition
181 repeatedly, until either the condition becomes true or the \a timeout (in milliseconds) is
182 reached. Between each evaluation, events will be processed. If the timeout
183 is reached, a failure is recorded in the test log and the test won't be
184 executed further.
185
186 \note This macro can only be used in a test function that is invoked
187 by the test framework.
188
189 \sa QTRY_VERIFY(), QTRY_VERIFY2_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE(),
190 QEXPECT_FAIL()
191*/
192
193
194/*! \macro QTRY_VERIFY(condition)
195 \since 5.0
196
197 \relates QTest
198
199 Checks the \a condition by invoking QTRY_VERIFY_WITH_TIMEOUT() with a timeout of five seconds.
200
201 \note This macro can only be used in a test function that is invoked
202 by the test framework.
203
204 \sa QTRY_VERIFY_WITH_TIMEOUT(), QTRY_VERIFY2(), QVERIFY(), QCOMPARE(), QTRY_COMPARE(),
205 QEXPECT_FAIL()
206*/
207
208/*! \macro QTRY_VERIFY2_WITH_TIMEOUT(condition, message, timeout)
209 \since 5.6
210
211 \relates QTest
212
213 The QTRY_VERIFY2_WITH_TIMEOUT macro is similar to QTRY_VERIFY_WITH_TIMEOUT()
214 except that it outputs a verbose \a message when \a condition is still false
215 after the specified \a timeout (in milliseconds). The \a message is a plain C string.
216
217 Example:
218 \code
219 QTRY_VERIFY2_WITH_TIMEOUT(list.size() > 2, QByteArray::number(list.size()).constData(), 10000);
220 \endcode
221
222 \note This macro can only be used in a test function that is invoked
223 by the test framework.
224
225 \sa QTRY_VERIFY(), QTRY_VERIFY_WITH_TIMEOUT(), QVERIFY(), QCOMPARE(), QTRY_COMPARE(),
226 QEXPECT_FAIL()
227*/
228
229/*! \macro QTRY_VERIFY2(condition, message)
230 \since 5.6
231
232 \relates QTest
233
234 Checks the \a condition by invoking QTRY_VERIFY2_WITH_TIMEOUT() with a timeout
235 of five seconds. If \a condition is then still false, \a message is output.
236 The \a message is a plain C string.
237
238 Example:
239 \code
240 QTRY_VERIFY2_WITH_TIMEOUT(list.size() > 2, QByteArray::number(list.size()).constData());
241 \endcode
242
243 \note This macro can only be used in a test function that is invoked
244 by the test framework.
245
246 \sa QTRY_VERIFY2_WITH_TIMEOUT(), QTRY_VERIFY2(), QVERIFY(), QCOMPARE(), QTRY_COMPARE(),
247 QEXPECT_FAIL()
248*/
249
250/*! \macro QTRY_COMPARE_WITH_TIMEOUT(actual, expected, timeout)
251 \since 5.0
252
253 \relates QTest
254
255 The QTRY_COMPARE_WITH_TIMEOUT() macro is similar to QCOMPARE(), but performs the comparison
256 of the \a actual and \a expected values repeatedly, until either the two values
257 are equal or the \a timeout (in milliseconds) is reached. Between each comparison, events
258 will be processed. If the timeout is reached, a failure is recorded in the
259 test log and the test won't be executed further.
260
261 \note This macro can only be used in a test function that is invoked
262 by the test framework.
263
264 \sa QTRY_COMPARE(), QCOMPARE(), QVERIFY(), QTRY_VERIFY(), QEXPECT_FAIL()
265*/
266
267/*! \macro QTRY_COMPARE(actual, expected)
268 \since 5.0
269
270 \relates QTest
271
272 Performs a comparison of the \a actual and \a expected values by
273 invoking QTRY_COMPARE_WITH_TIMEOUT() with a timeout of five seconds.
274
275 \note This macro can only be used in a test function that is invoked
276 by the test framework.
277
278 \sa QTRY_COMPARE_WITH_TIMEOUT(), QCOMPARE(), QVERIFY(), QTRY_VERIFY(),
279 QEXPECT_FAIL()
280*/
281
282/*! \macro QFETCH(type, name)
283
284 \relates QTest
285
286 The fetch macro creates a local variable named \a name with the type \a type
287 on the stack. The \a name and \a type must match a column from the test's
288 data table. This is asserted and the test will abort if the assertion fails.
289
290 Assuming a test has the following data:
291
292 \snippet code/src_qtestlib_qtestcase.cpp 3
293
294 The test data has two elements, a QString called \c aString and an integer
295 called \c expected. To fetch these values in the actual test:
296
297 \snippet code/src_qtestlib_qtestcase.cpp 4
298
299 \c aString and \c expected are variables on the stack that are initialized with
300 the current test data.
301
302 \note This macro can only be used in a test function that is invoked
303 by the test framework. The test function must have a _data function.
304*/
305
306/*! \macro QFETCH_GLOBAL(type, name)
307
308 \relates QTest
309
310 This macro fetches a variable named \a name with the type \a type from
311 a row in the global data table. The \a name and \a type must match a
312 column in the global data table. This is asserted and the test will abort
313 if the assertion fails.
314
315 Assuming a test has the following data:
316
317 \snippet code/src_qtestlib_qtestcase_snippet.cpp 30
318
319 The test's own data is a single number per row. In this case,
320 \c initTestCase_data() also supplies a locale per row. Therefore,
321 this test will be run with every combination of locale from the
322 latter and number from the former. Thus, with four rows in the
323 global table and three in the local, the test function is run for
324 12 distinct test-cases (4 * 3 = 12).
325
326 \snippet code/src_qtestlib_qtestcase_snippet.cpp 31
327
328 The locale is read from the global data table using QFETCH_GLOBAL(),
329 and the number is read from the local data table using QFETCH().
330
331 \note This macro can only be used in test methods of a class with an
332 \c initTestCase_data() method.
333*/
334
335/*! \macro QWARN(message)
336
337 \relates QTest
338 \threadsafe
339
340 Appends \a message as a warning to the test log. This macro can be used anywhere
341 in your tests.
342*/
343
344/*! \macro QFAIL(message)
345
346 \relates QTest
347
348 This macro can be used to force a test failure. The test stops
349 executing and the failure \a message is appended to the test log.
350
351 \note This macro can only be used in a test function that is invoked
352 by the test framework.
353
354 Example:
355
356 \snippet code/src_qtestlib_qtestcase.cpp 5
357*/
358
359/*! \macro QTEST(actual, testElement)
360
361 \relates QTest
362
363 QTEST() is a convenience macro for \l QCOMPARE() that compares
364 the value \a actual with the element \a testElement from the test's data.
365 If there is no such element, the test asserts.
366
367 Apart from that, QTEST() behaves exactly as \l QCOMPARE().
368
369 Instead of writing:
370
371 \snippet code/src_qtestlib_qtestcase.cpp 6
372
373 you can write:
374
375 \snippet code/src_qtestlib_qtestcase.cpp 7
376
377 \sa QCOMPARE()
378*/
379
380/*! \macro QSKIP(description)
381
382 \relates QTest
383
384 If called from a test function, the QSKIP() macro stops execution of the test
385 without adding a failure to the test log. You can use it to skip tests that
386 wouldn't make sense in the current configuration. For example, a test of font
387 rendering may call QSKIP() if the needed fonts are not installed on the test
388 system.
389
390 The text \a description is appended to the test log and should contain an
391 explanation of why the test couldn't be executed.
392
393 If the test is data-driven, each call to QSKIP() in the test function will
394 skip only the current row of test data, so an unconditional call to QSKIP()
395 will produce one skip message in the test log for each row of test data.
396
397 If called from an \c _data function, the QSKIP() macro will stop execution of
398 the \c _data function and will prevent execution of the associated test
399 function. This entirely omits a data-driven test. To omit individual rows,
400 make them conditional by using a simple \c{if (condition) newRow(...) << ...}
401 in the \c _data function, instead of using QSKIP() in the test function.
402
403 If called from \c initTestCase_data(), the QSKIP() macro will skip all test
404 and \c _data functions. If called from \c initTestCase() when there is no
405 \c initTestCase_data(), or when it only sets up one row, QSKIP() will
406 likewise skip the whole test. However, if \c initTestCase_data() contains
407 more than one row, then \c initTestCase() is called (followed by each test
408 and finally the wrap-up) once per row of it. Therefore, a call to QSKIP() in
409 \c initTestCase() will merely skip all test functions for the current row of
410 global data, set up by \c initTestCase_data().
411
412 \note This macro can only be used in a test function or \c _data
413 function that is invoked by the test framework.
414
415 Example:
416 \snippet code/src_qtestlib_qtestcase.cpp 8
417
418 \section2 Skipping Known Bugs
419
420 If a test exposes a known bug that will not be fixed immediately, use the
421 QEXPECT_FAIL() macro to document the failure and reference the bug tracking
422 identifier for the known issue. When the test is run, expected failures will
423 be marked as XFAIL in the test output and will not be counted as failures
424 when setting the test program's return code. If an expected failure does
425 not occur, the XPASS (unexpected pass) will be reported in the test output
426 and will be counted as a test failure.
427
428 For known bugs, QEXPECT_FAIL() is better than QSKIP() because a developer
429 cannot fix the bug without an XPASS result reminding them that the test
430 needs to be updated too. If QSKIP() is used, there is no reminder to revise
431 or re-enable the test, without which subsequent regressions will not be
432 reported.
433
434 \sa QEXPECT_FAIL(), {Select Appropriate Mechanisms to Exclude Tests}
435*/
436
437/*! \macro QEXPECT_FAIL(dataIndex, comment, mode)
438
439 \relates QTest
440
441 The QEXPECT_FAIL() macro marks the next \l QCOMPARE() or \l QVERIFY() as an
442 expected failure. Instead of adding a failure to the test log, an expected
443 failure will be reported.
444
445 If a \l QVERIFY() or \l QCOMPARE() is marked as an expected failure,
446 but passes instead, an unexpected pass (XPASS) is written to the test log.
447
448 The parameter \a dataIndex describes for which entry in the test data the
449 failure is expected. Pass an empty string (\c{""}) if the failure
450 is expected for all entries or if no test data exists.
451
452 \a comment will be appended to the test log for the expected failure.
453
454 \a mode is a \l QTest::TestFailMode and sets whether the test should
455 continue to execute or not.
456
457 \note This macro can only be used in a test function that is invoked
458 by the test framework.
459
460 Example 1:
461 \snippet code/src_qtestlib_qtestcase.cpp 9
462
463 In the example above, an expected fail will be written into the test output
464 if the variable \c i is not 42. If the variable \c i is 42, an unexpected pass
465 is written instead. The QEXPECT_FAIL() has no influence on the second QCOMPARE()
466 statement in the example.
467
468 Example 2:
469 \snippet code/src_qtestlib_qtestcase.cpp 10
470
471 The above testfunction will not continue executing for the test data
472 entry \c{data27}.
473
474 \sa QTest::TestFailMode, QVERIFY(), QCOMPARE()
475*/
476
477/*! \macro QFINDTESTDATA(filename)
478 \since 5.0
479
480 \relates QTest
481
482 Returns a QString for the testdata file referred to by \a filename, or an
483 empty QString if the testdata file could not be found.
484
485 This macro allows the test to load data from an external file without
486 hardcoding an absolute filename into the test, or using relative paths
487 which may be error prone.
488
489 The returned path will be the first path from the following list which
490 resolves to an existing file or directory:
491
492 \list
493 \li \a filename relative to QCoreApplication::applicationDirPath()
494 (only if a QCoreApplication or QApplication object has been created).
495 \li \a filename relative to the test's standard install directory
496 (QLibraryInfo::TestsPath with the lowercased testcase name appended).
497 \li \a filename relative to the directory containing the source file from which
498 QFINDTESTDATA is invoked.
499 \endlist
500
501 If the named file/directory does not exist at any of these locations,
502 a warning is printed to the test log.
503
504 For example, in this code:
505 \snippet code/src_qtestlib_qtestcase_snippet.cpp 26
506
507 The testdata file will be resolved as the first existing file from:
508
509 \list
510 \li \c{/home/user/build/myxmlparser/tests/tst_myxmlparser/testxml/simple1.xml}
511 \li \c{/usr/local/Qt-5.0.0/tests/tst_myxmlparser/testxml/simple1.xml}
512 \li \c{/home/user/sources/myxmlparser/tests/tst_myxmlparser/testxml/simple1.xml}
513 \endlist
514
515 This allows the test to find its testdata regardless of whether the
516 test has been installed, and regardless of whether the test's build tree
517 is equal to the test's source tree.
518
519 \note reliable detection of testdata from the source directory requires
520 either that qmake is used, or the \c{QT_TESTCASE_BUILDDIR} macro is defined to
521 point to the working directory from which the compiler is invoked, or only
522 absolute paths to the source files are passed to the compiler. Otherwise, the
523 absolute path of the source directory cannot be determined.
524
525 \note The \c{QT_TESTCASE_BUILDDIR} macro is also implicitly defined if CMake is used
526 and the QtTest module is linked to the target. You can change the default
527 \c{QT_TESTCASE_BUILDDIR} by setting the QT_TESTCASE_BUILDDIR property on the target.
528
529 \note For tests that use the \l QTEST_APPLESS_MAIN() macro to generate a
530 \c{main()} function, \c{QFINDTESTDATA} will not attempt to find test data
531 relative to QCoreApplication::applicationDirPath(). In practice, this means that
532 tests using \c{QTEST_APPLESS_MAIN()} will fail to find their test data
533 if run from a shadow build tree.
534*/
535
536/*! \macro QTEST_MAIN(TestClass)
537
538 \relates QTest
539
540 Implements a main() function that instantiates an application object and
541 the \a TestClass, and executes all tests in the order they were defined.
542 Use this macro to build stand-alone executables.
543
544 If \c QT_WIDGETS_LIB is defined, the application object will be a QApplication,
545 if \c QT_GUI_LIB is defined, the application object will be a QGuiApplication,
546 otherwise it will be a QCoreApplication. If qmake is used and the configuration
547 includes \c{QT += widgets}, then \c QT_WIDGETS_LIB will be defined automatically.
548 Similarly, if qmake is used and the configuration includes \c{QT += gui}, then
549 \c QT_GUI_LIB will be defined automatically.
550
551 \note On platforms that have keypad navigation enabled by default,
552 this macro will forcefully disable it if \c QT_WIDGETS_LIB is defined. This is done
553 to simplify the usage of key events when writing autotests. If you wish to write a
554 test case that uses keypad navigation, you should enable it either in the
555 \c {initTestCase()} or \c {init()} functions of your test case by calling
556 \l {QApplication::setNavigationMode()}.
557
558 Example:
559 \snippet code/src_qtestlib_qtestcase.cpp 11
560
561 \sa QTEST_APPLESS_MAIN(), QTEST_GUILESS_MAIN(), QTest::qExec(),
562 QApplication::setNavigationMode()
563*/
564
565/*! \macro QTEST_APPLESS_MAIN(TestClass)
566
567 \relates QTest
568
569 Implements a main() function that executes all tests in \a TestClass.
570
571 Behaves like \l QTEST_MAIN(), but doesn't instantiate a QApplication
572 object. Use this macro for really simple stand-alone non-GUI tests.
573
574 \sa QTEST_MAIN()
575*/
576
577/*! \macro QTEST_GUILESS_MAIN(TestClass)
578 \since 5.0
579
580 \relates QTest
581
582 Implements a main() function that instantiates a QCoreApplication object
583 and the \a TestClass, and executes all tests in the order they were
584 defined. Use this macro to build stand-alone executables.
585
586 Behaves like \l QTEST_MAIN(), but instantiates a QCoreApplication instead
587 of the QApplication object. Use this macro if your test case doesn't need
588 functionality offered by QApplication, but the event loop is still necessary.
589
590 \sa QTEST_MAIN()
591*/
592
593/*!
594 \macro QBENCHMARK
595
596 \relates QTest
597
598 This macro is used to measure the performance of code within a test.
599 The code to be benchmarked is contained within a code block following
600 this macro.
601
602 For example:
603
604 \snippet code/src_qtestlib_qtestcase.cpp 27
605
606 \sa {Qt Test Overview#Creating a Benchmark}{Creating a Benchmark},
607 {Chapter 5: Writing a Benchmark}{Writing a Benchmark}
608*/
609
610/*!
611 \macro QBENCHMARK_ONCE
612 \since 4.6
613
614 \relates QTest
615
616 \brief The QBENCHMARK_ONCE macro is for measuring performance of a
617 code block by running it once.
618
619 This macro is used to measure the performance of code within a test.
620 The code to be benchmarked is contained within a code block following
621 this macro.
622
623 Unlike QBENCHMARK, the contents of the contained code block is only run
624 once. The elapsed time will be reported as "0" if it's to short to
625 be measured by the selected backend. (Use)
626
627 \sa {Qt Test Overview#Creating a Benchmark}{Creating a Benchmark},
628 {Chapter 5: Writing a Benchmark}{Writing a Benchmark}
629*/
630
631/*! \enum QTest::TestFailMode
632
633 This enum describes the modes for handling an expected failure of the
634 \l QVERIFY() or \l QCOMPARE() macros.
635
636 \value Abort Aborts the execution of the test. Use this mode when it
637 doesn't make sense to execute the test any further after the
638 expected failure.
639
640 \value Continue Continues execution of the test after the expected failure.
641
642 \sa QEXPECT_FAIL()
643*/
644
645/*! \enum QTest::KeyAction
646
647 This enum describes possible actions for key handling.
648
649 \value Press The key is pressed.
650 \value Release The key is released.
651 \value Click The key is clicked (pressed and released).
652 \value Shortcut A shortcut is activated. This value has been added in Qt 5.6.
653*/
654
655/*! \enum QTest::MouseAction
656
657 This enum describes possible actions for mouse handling.
658
659 \value MousePress A mouse button is pressed.
660 \value MouseRelease A mouse button is released.
661 \value MouseClick A mouse button is clicked (pressed and released).
662 \value MouseDClick A mouse button is double clicked (pressed and released twice).
663 \value MouseMove The mouse pointer has moved.
664*/
665
666/*! \fn void QTest::keyClick(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
667
668 Simulates clicking of \a key with an optional \a modifier on a \a widget.
669 If \a delay is larger than 0, the test will wait for \a delay milliseconds
670 before clicking the key.
671
672 Examples:
673 \snippet code/src_qtestlib_qtestcase_snippet.cpp 14
674
675 The first example above simulates clicking the \c escape key on \c
676 myWidget without any keyboard modifiers and without delay. The
677 second example simulates clicking \c shift-escape on \c myWidget
678 following a 200 ms delay of the test.
679
680 \sa QTest::keyClicks()
681*/
682
683/*! \fn void QTest::keyClick(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
684 \overload
685
686 Simulates clicking of \a key with an optional \a modifier on a \a widget.
687 If \a delay is larger than 0, the test will wait for \a delay milliseconds
688 before clicking the key.
689
690 Example:
691 \snippet code/src_qtestlib_qtestcase_snippet.cpp 13
692
693 The example above simulates clicking \c a on \c myWidget without
694 any keyboard modifiers and without delay of the test.
695
696 \sa QTest::keyClicks()
697*/
698
699/*! \fn void QTest::keySequence(QWidget *widget, const QKeySequence &keySequence)
700 \overload
701 \since 5.10
702
703 Simulates typing of \a keySequence into a \a widget.
704
705 \sa QTest::keyClick(), QTest::keyClicks()
706*/
707
708/*! \fn void QTest::keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
709 \overload
710 \since 5.0
711
712 Simulates clicking of \a key with an optional \a modifier on a \a window.
713 If \a delay is larger than 0, the test will wait for \a delay milliseconds
714 before clicking the key.
715
716 Examples:
717 \snippet code/src_qtestlib_qtestcase_snippet.cpp 29
718
719 The first example above simulates clicking the \c escape key on \c
720 myWindow without any keyboard modifiers and without delay. The
721 second example simulates clicking \c shift-escape on \c myWindow
722 following a 200 ms delay of the test.
723
724 \sa QTest::keyClicks()
725*/
726
727/*! \fn void QTest::keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
728 \overload
729 \since 5.0
730
731 Simulates clicking of \a key with an optional \a modifier on a \a window.
732 If \a delay is larger than 0, the test will wait for \a delay milliseconds
733 before clicking the key.
734
735 Example:
736 \snippet code/src_qtestlib_qtestcase_snippet.cpp 28
737
738 The example above simulates clicking \c a on \c myWindow without
739 any keyboard modifiers and without delay of the test.
740
741 \sa QTest::keyClicks()
742*/
743
744/*! \fn void QTest::keySequence(QWindow *window, const QKeySequence &keySequence)
745 \overload
746 \since 5.10
747
748 Simulates typing of \a keySequence into a \a window.
749
750 \sa QTest::keyClick(), QTest::keyClicks()
751*/
752
753/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
754
755 Sends a Qt key event to \a widget with the given \a key and an associated \a action.
756 Optionally, a keyboard \a modifier can be specified, as well as a \a delay
757 (in milliseconds) of the test before sending the event.
758*/
759
760/*! \fn void QTest::keyEvent(KeyAction action, QWidget *widget, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
761 \overload
762
763 Sends a Qt key event to \a widget with the given key \a ascii and an associated \a action.
764 Optionally, a keyboard \a modifier can be specified, as well as a \a delay
765 (in milliseconds) of the test before sending the event.
766*/
767
768/*! \fn void QTest::keyEvent(KeyAction action, QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
769 \overload
770 \since 5.0
771
772 Sends a Qt key event to \a window with the given \a key and an associated \a action.
773 Optionally, a keyboard \a modifier can be specified, as well as a \a delay
774 (in milliseconds) of the test before sending the event.
775*/
776
777/*! \fn void QTest::keyEvent(KeyAction action, QWindow *window, char ascii, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
778 \overload
779 \since 5.0
780
781 Sends a Qt key event to \a window with the given key \a ascii and an associated \a action.
782 Optionally, a keyboard \a modifier can be specified, as well as a \a delay
783 (in milliseconds) of the test before sending the event.
784*/
785
786/*! \fn void QTest::keyPress(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
787
788 Simulates pressing a \a key with an optional \a modifier on a \a widget. If \a delay
789 is larger than 0, the test will wait for \a delay milliseconds before pressing the key.
790
791 \note At some point you should release the key using \l keyRelease().
792
793 \sa QTest::keyRelease(), QTest::keyClick()
794*/
795
796/*! \fn void QTest::keyPress(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
797 \overload
798
799 Simulates pressing a \a key with an optional \a modifier on a \a widget.
800 If \a delay is larger than 0, the test will wait for \a delay milliseconds
801 before pressing the key.
802
803 \note At some point you should release the key using \l keyRelease().
804
805 \sa QTest::keyRelease(), QTest::keyClick()
806*/
807
808/*! \fn void QTest::keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
809 \overload
810 \since 5.0
811
812 Simulates pressing a \a key with an optional \a modifier on a \a window. If \a delay
813 is larger than 0, the test will wait for \a delay milliseconds before pressing the key.
814
815 \note At some point you should release the key using \l keyRelease().
816
817 \sa QTest::keyRelease(), QTest::keyClick()
818*/
819
820/*! \fn void QTest::keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
821 \overload
822 \since 5.0
823
824 Simulates pressing a \a key with an optional \a modifier on a \a window.
825 If \a delay is larger than 0, the test will wait for \a delay milliseconds
826 before pressing the key.
827
828 \note At some point you should release the key using \l keyRelease().
829
830 \sa QTest::keyRelease(), QTest::keyClick()
831*/
832
833/*! \fn void QTest::keyRelease(QWidget *widget, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
834
835 Simulates releasing a \a key with an optional \a modifier on a \a widget.
836 If \a delay is larger than 0, the test will wait for \a delay milliseconds
837 before releasing the key.
838
839 \sa QTest::keyPress(), QTest::keyClick()
840*/
841
842/*! \fn void QTest::keyRelease(QWidget *widget, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
843 \overload
844
845 Simulates releasing a \a key with an optional \a modifier on a \a widget.
846 If \a delay is larger than 0, the test will wait for \a delay milliseconds
847 before releasing the key.
848
849 \sa QTest::keyClick()
850*/
851
852/*! \fn void QTest::keyRelease(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
853 \overload
854 \since 5.0
855
856 Simulates releasing a \a key with an optional \a modifier on a \a window.
857 If \a delay is larger than 0, the test will wait for \a delay milliseconds
858 before releasing the key.
859
860 \sa QTest::keyPress(), QTest::keyClick()
861*/
862
863/*! \fn void QTest::keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
864 \overload
865 \since 5.0
866
867 Simulates releasing a \a key with an optional \a modifier on a \a window.
868 If \a delay is larger than 0, the test will wait for \a delay milliseconds
869 before releasing the key.
870
871 \sa QTest::keyClick()
872*/
873
874/*! \fn void QTest::keyClicks(QWidget *widget, const QString &sequence, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
875
876 Simulates clicking a \a sequence of keys on a \a
877 widget. Optionally, a keyboard \a modifier can be specified as
878 well as a \a delay (in milliseconds) of the test before each key
879 click.
880
881 Example:
882 \snippet code/src_qtestlib_qtestcase_snippet.cpp 15
883
884 The example above simulates clicking the sequence of keys
885 representing "hello world" on \c myWidget without any keyboard
886 modifiers and without delay of the test.
887
888 \sa QTest::keyClick()
889*/
890
891/*! \fn void QTest::mousePress(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
892
893 Simulates pressing a mouse \a button with an optional \a modifier
894 on a \a widget. The position is defined by \a pos; the default
895 position is the center of the widget. If \a delay is specified,
896 the test will wait for the specified amount of milliseconds before
897 the press.
898
899 \sa QTest::mouseRelease(), QTest::mouseClick()
900*/
901
902/*! \fn void QTest::mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
903 \overload
904 \since 5.0
905
906 Simulates pressing a mouse \a button with an optional \a stateKey modifier
907 on a \a window. The position is defined by \a pos; the default
908 position is the center of the window. If \a delay is specified,
909 the test will wait for the specified amount of milliseconds before
910 the press.
911
912 \sa QTest::mouseRelease(), QTest::mouseClick()
913*/
914
915/*! \fn void QTest::mouseRelease(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
916
917 Simulates releasing a mouse \a button with an optional \a modifier
918 on a \a widget. The position of the release is defined by \a pos;
919 the default position is the center of the widget. If \a delay is
920 specified, the test will wait for the specified amount of
921 milliseconds before releasing the button.
922
923 \sa QTest::mousePress(), QTest::mouseClick()
924*/
925
926/*! \fn void QTest::mouseRelease(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
927 \overload
928 \since 5.0
929
930 Simulates releasing a mouse \a button with an optional \a stateKey modifier
931 on a \a window. The position of the release is defined by \a pos;
932 the default position is the center of the window. If \a delay is
933 specified, the test will wait for the specified amount of
934 milliseconds before releasing the button.
935
936 \sa QTest::mousePress(), QTest::mouseClick()
937*/
938
939/*! \fn void QTest::mouseClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
940
941 Simulates clicking a mouse \a button with an optional \a modifier
942 on a \a widget. The position of the click is defined by \a pos;
943 the default position is the center of the widget. If \a delay is
944 specified, the test will wait for the specified amount of
945 milliseconds before pressing and before releasing the button.
946
947 \sa QTest::mousePress(), QTest::mouseRelease()
948*/
949
950/*! \fn void QTest::mouseClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
951 \overload
952 \since 5.0
953
954 Simulates clicking a mouse \a button with an optional \a stateKey modifier
955 on a \a window. The position of the click is defined by \a pos;
956 the default position is the center of the window. If \a delay is
957 specified, the test will wait for the specified amount of
958 milliseconds before pressing and before releasing the button.
959
960 \sa QTest::mousePress(), QTest::mouseRelease()
961*/
962
963/*! \fn void QTest::mouseDClick(QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers modifier = 0, QPoint pos = QPoint(), int delay=-1)
964
965 Simulates double clicking a mouse \a button with an optional \a
966 modifier on a \a widget. The position of the click is defined by
967 \a pos; the default position is the center of the widget. If \a
968 delay is specified, the test will wait for the specified amount of
969 milliseconds before each press and release.
970
971 \sa QTest::mouseClick()
972*/
973
974/*! \fn void QTest::mouseDClick(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0, QPoint pos = QPoint(), int delay=-1)
975 \overload
976 \since 5.0
977
978 Simulates double clicking a mouse \a button with an optional \a stateKey
979 modifier on a \a window. The position of the click is defined by
980 \a pos; the default position is the center of the window. If \a
981 delay is specified, the test will wait for the specified amount of
982 milliseconds before each press and release.
983
984 \sa QTest::mouseClick()
985*/
986
987/*! \fn void QTest::mouseMove(QWidget *widget, QPoint pos = QPoint(), int delay=-1)
988
989 Moves the mouse pointer to a \a widget. If \a pos is not
990 specified, the mouse pointer moves to the center of the widget. If
991 a \a delay (in milliseconds) is given, the test will wait before
992 moving the mouse pointer.
993*/
994
995/*! \fn void QTest::mouseMove(QWindow *window, QPoint pos = QPoint(), int delay=-1)
996 \overload
997 \since 5.0
998
999 Moves the mouse pointer to a \a window. If \a pos is not
1000 specified, the mouse pointer moves to the center of the window. If
1001 a \a delay (in milliseconds) is given, the test will wait before
1002 moving the mouse pointer.
1003*/
1004
1005/*!
1006 \fn template <typename T1, typename T2> char *QTest::toString(const QPair<T1, T2> &pair)
1007 \overload
1008 \since 5.11
1009 Returns a textual representation of the \a pair.
1010*/
1011
1012/*!
1013 \fn template <typename T1, typename T2> char *QTest::toString(const std::pair<T1, T2> &pair)
1014 \overload
1015 \since 5.11
1016 Returns a textual representation of the \a pair.
1017*/
1018
1019/*!
1020 \fn char *QTest::toString(const QVector2D &v)
1021 \overload
1022 \since 5.11
1023 Returns a textual representation of the 2D vector \a v.
1024*/
1025
1026/*!
1027 \fn char *QTest::toString(const QVector3D &v)
1028 \overload
1029 \since 5.11
1030 Returns a textual representation of the 3D vector \a v.
1031*/
1032
1033/*!
1034 \fn char *QTest::toString(const QVector4D &v)
1035 \overload
1036 \since 5.11
1037 Returns a textual representation of the 4D vector \a v.
1038*/
1039
1040/*!
1041 \fn template<typename T> char *QTest::toString(const T &value)
1042
1043 Returns a textual representation of \a value. This function is used by
1044 \l QCOMPARE() to output verbose information in case of a test failure.
1045
1046 You can add specializations or overloads of this function to your test to enable
1047 verbose output.
1048
1049 \note Starting with Qt 5.5, you should prefer to provide a toString() function
1050 in the type's namespace instead of specializing this template.
1051 If your code needs to continue to work with the QTestLib from Qt 5.4 or
1052 earlier, you need to continue to use specialization.
1053
1054 \note The caller of toString() must delete the returned data
1055 using \c{delete[]}. Your implementation should return a string
1056 created with \c{new[]} or qstrdup(). The easiest way to do so is to
1057 create a QByteArray or QString and call QTest::toString() on it
1058 (see second example below).
1059
1060 Example for specializing (Qt ≤ 5.4):
1061
1062 \snippet code/src_qtestlib_qtestcase_snippet.cpp 16
1063
1064 The example above defines a toString() specialization for a class
1065 called \c MyPoint. Whenever a comparison of two instances of \c
1066 MyPoint fails, \l QCOMPARE() will call this function to output the
1067 contents of \c MyPoint to the test log.
1068
1069 Same example, but with overloading (Qt ≥ 5.5):
1070
1071 \snippet code/src_qtestlib_qtestcase_snippet.cpp toString-overload
1072
1073 \sa QCOMPARE()
1074*/
1075
1076/*!
1077 \fn char *QTest::toString(const QLatin1String &string)
1078 \overload
1079
1080 Returns a textual representation of the given \a string.
1081*/
1082
1083/*!
1084 \fn char *QTest::toString(std::nullptr_t)
1085 \overload
1086 \since 5.8
1087
1088 Returns a string containing \nullptr.
1089*/
1090
1091/*!
1092 \fn char *QTest::toString(const QStringView &string)
1093 \overload
1094 \since 5.11
1095
1096 Returns a textual representation of the given \a string.
1097*/
1098
1099/*!
1100 \fn char *QTest::toString(const QUuid &uuid)
1101 \overload
1102 \since 5.11
1103
1104 Returns a textual representation of the given \a uuid.
1105*/
1106
1107/*!
1108 \fn char *QTest::toString(const QString &string)
1109 \overload
1110
1111 Returns a textual representation of the given \a string.
1112*/
1113
1114/*!
1115 \fn char *QTest::toString(const QByteArray &ba)
1116 \overload
1117
1118 Returns a textual representation of the byte array \a ba.
1119
1120 \sa QTest::toHexRepresentation()
1121*/
1122
1123/*!
1124 \fn char *QTest::toString(const QCborError &c)
1125 \overload
1126 \since 5.12
1127
1128 Returns a textual representation of the given CBOR error \a c.
1129*/
1130
1131/*!
1132 \fn template <class... Types> char *QTest::toString(const std::tuple<Types...> &tuple)
1133 \overload
1134 \since 5.12
1135
1136 Returns a textual representation of the given \a tuple.
1137*/
1138
1139/*!
1140 \fn char *QTest::toString(const QTime &time)
1141 \overload
1142
1143 Returns a textual representation of the given \a time.
1144*/
1145
1146/*!
1147 \fn char *QTest::toString(const QDate &date)
1148 \overload
1149
1150 Returns a textual representation of the given \a date.
1151*/
1152
1153/*!
1154 \fn char *QTest::toString(const QDateTime &dateTime)
1155 \overload
1156
1157 Returns a textual representation of the date and time specified by
1158 \a dateTime.
1159*/
1160
1161/*!
1162 \fn char *QTest::toString(const QChar &character)
1163 \overload
1164
1165 Returns a textual representation of the given \a character.
1166*/
1167
1168/*!
1169 \fn char *QTest::toString(const QPoint &point)
1170 \overload
1171
1172 Returns a textual representation of the given \a point.
1173*/
1174
1175/*!
1176 \fn char *QTest::toString(const QSize &size)
1177 \overload
1178
1179 Returns a textual representation of the given \a size.
1180*/
1181
1182/*!
1183 \fn char *QTest::toString(const QRect &rectangle)
1184 \overload
1185
1186 Returns a textual representation of the given \a rectangle.
1187*/
1188
1189/*!
1190 \fn char *QTest::toString(const QUrl &url)
1191 \since 4.4
1192 \overload
1193
1194 Returns a textual representation of the given \a url.
1195*/
1196
1197/*!
1198 \fn char *QTest::toString(const QPointF &point)
1199 \overload
1200
1201 Returns a textual representation of the given \a point.
1202*/
1203
1204/*!
1205 \fn char *QTest::toString(const QSizeF &size)
1206 \overload
1207
1208 Returns a textual representation of the given \a size.
1209*/
1210
1211/*!
1212 \fn char *QTest::toString(const QRectF &rectangle)
1213 \overload
1214
1215 Returns a textual representation of the given \a rectangle.
1216*/
1217
1218/*!
1219 \fn char *QTest::toString(const QVariant &variant)
1220 \overload
1221
1222 Returns a textual representation of the given \a variant.
1223*/
1224
1225/*!
1226 \fn char *QTest::toString(QSizePolicy::ControlType ct)
1227 \overload
1228 \since 5.5
1229
1230 Returns a textual representation of control type \a ct.
1231*/
1232
1233/*!
1234 \fn char *QTest::toString(QSizePolicy::ControlTypes cts)
1235 \overload
1236 \since 5.5
1237
1238 Returns a textual representation of control types \a cts.
1239*/
1240
1241/*!
1242 \fn char *QTest::toString(QSizePolicy::Policy p)
1243 \overload
1244 \since 5.5
1245
1246 Returns a textual representation of policy \a p.
1247*/
1248
1249/*!
1250 \fn char *QTest::toString(QSizePolicy sp)
1251 \overload
1252 \since 5.5
1253
1254 Returns a textual representation of size policy \a sp.
1255*/
1256
1257/*!
1258 \fn template <typename Tuple, int... I> char *QTest::toString(const Tuple &tuple, QtPrivate::IndexesList<I...> )
1259 \internal
1260 \since 5.12
1261*/
1262
1263/*!
1264 \fn QPointingDevice * QTest::createTouchDevice(QInputDevice::DeviceType devType = QInputDevice::DeviceType::TouchScreen, QInputDevice::Capabilities caps = QInputDevice::Capability::Position)
1265 \since 5.8
1266
1267 Creates a dummy touch device of type \a devType with capabilities \a caps for
1268 simulation of touch events.
1269
1270 The touch device will be registered with the QPA window system interface,
1271 and deleted automatically when the QCoreApplication is deleted. So you
1272 should typically use createTouchDevice() to initialize a QPointingDevice
1273 member variable in your test case class, and use the same instance for all tests.
1274
1275 \sa QTest::QTouchEventSequence, touchEvent()
1276*/
1277
1278/*!
1279 \class QTest::QTouchEventSequence
1280 \inmodule QtTest
1281 \since 4.6
1282
1283 \brief The QTouchEventSequence class is used to simulate a sequence of touch events.
1284
1285 To simulate a sequence of touch events on a specific device for a window or widget, call
1286 QTest::touchEvent to create a QTouchEventSequence instance. Add touch events to
1287 the sequence by calling press(), move(), release() and stationary(), and let the
1288 instance run out of scope to commit the sequence to the event system.
1289
1290 Example:
1291 \snippet code/src_qtestlib_qtestcase_snippet.cpp 25
1292*/
1293
1294/*!
1295 \fn QTest::QTouchEventSequence::~QTouchEventSequence()
1296
1297 Commits this sequence of touch events, unless autoCommit was disabled, and frees allocated resources.
1298*/
1299
1300/*!
1301 \fn void QTest::QTouchEventSequence::commit(bool processEvents)
1302
1303 Commits this sequence of touch events to the event system. Normally there is no need to call this
1304 function because it is called from the destructor. However, if autoCommit is disabled, the events
1305 only get committed upon explicitly calling this function.
1306
1307 In special cases tests may want to disable the processing of the events. This can be achieved by
1308 setting \a processEvents to false. This results in merely queuing the events, the event loop will
1309 not be forced to process them.
1310*/
1311
1312/*!
1313 \fn QTouchEventSequence &QTest::QTouchEventSequence::press(int touchId, const QPoint &pt, QWindow *window)
1314 \since 5.0
1315
1316 Adds a press event for touchpoint \a touchId at position \a pt to this sequence and returns
1317 a reference to this QTouchEventSequence.
1318
1319 The position \a pt is interpreted as relative to \a window. If \a window is the null pointer, then
1320 \a pt is interpreted as relative to the window provided when instantiating this QTouchEventSequence.
1321
1322 Simulates that the user pressed the touch screen or pad with the finger identified by \a touchId.
1323*/
1324
1325/*!
1326 \fn QTouchEventWidgetSequence &QTest::QTouchEventWidgetSequence::press(int touchId, const QPoint &pt, QWidget *widget)
1327
1328 Adds a press event for touchpoint \a touchId at position \a pt to this sequence and returns
1329 a reference to this QTouchEventWidgetSequence.
1330
1331 The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
1332 \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.
1333
1334 Simulates that the user pressed the touch screen or pad with the finger identified by \a touchId.
1335*/
1336
1337/*!
1338 \fn QTouchEventSequence &QTest::QTouchEventSequence::move(int touchId, const QPoint &pt, QWindow *window)
1339 \since 5.0
1340
1341 Adds a move event for touchpoint \a touchId at position \a pt to this sequence and returns
1342 a reference to this QTouchEventSequence.
1343
1344 The position \a pt is interpreted as relative to \a window. If \a window is the null pointer, then
1345 \a pt is interpreted as relative to the window provided when instantiating this QTouchEventSequence.
1346
1347 Simulates that the user moved the finger identified by \a touchId.
1348*/
1349
1350/*!
1351 \fn QTouchEventWidgetSequence &QTest::QTouchEventWidgetSequence::move(int touchId, const QPoint &pt, QWidget *widget)
1352
1353 Adds a move event for touchpoint \a touchId at position \a pt to this sequence and returns
1354 a reference to this QTouchEventWidgetSequence.
1355
1356 The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
1357 \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.
1358
1359 Simulates that the user moved the finger identified by \a touchId.
1360*/
1361
1362/*!
1363 \fn QTouchEventSequence &QTest::QTouchEventSequence::release(int touchId, const QPoint &pt, QWindow *window)
1364 \since 5.0
1365
1366 Adds a release event for touchpoint \a touchId at position \a pt to this sequence and returns
1367 a reference to this QTouchEventSequence.
1368
1369 The position \a pt is interpreted as relative to \a window. If \a window is the null pointer, then
1370 \a pt is interpreted as relative to the window provided when instantiating this QTouchEventSequence.
1371
1372 Simulates that the user lifted the finger identified by \a touchId.
1373*/
1374
1375/*!
1376 \fn QTouchEventWidgetSequence &QTest::QTouchEventWidgetSequence::release(int touchId, const QPoint &pt, QWidget *widget)
1377
1378 Adds a release event for touchpoint \a touchId at position \a pt to this sequence and returns
1379 a reference to this QTouchEventWidgetSequence.
1380
1381 The position \a pt is interpreted as relative to \a widget. If \a widget is the null pointer, then
1382 \a pt is interpreted as relative to the widget provided when instantiating this QTouchEventWidgetSequence.
1383
1384 Simulates that the user lifted the finger identified by \a touchId.
1385*/
1386
1387/*!
1388 \fn QTouchEventSequence &QTest::QTouchEventSequence::stationary(int touchId)
1389
1390 Adds a stationary event for touchpoint \a touchId to this sequence and returns
1391 a reference to this QTouchEventSequence.
1392
1393 Simulates that the user did not move the finger identified by \a touchId.
1394*/
1395
1396/*!
1397 \fn QTouchEventSequence QTest::touchEvent(QWindow *window, QPointingDevice *device, bool autoCommit)
1398 \since 5.0
1399
1400 Creates and returns a QTouchEventSequence for the \a device to
1401 simulate events for \a window.
1402
1403 When adding touch events to the sequence, \a window will also be used to translate
1404 the position provided to screen coordinates, unless another window is provided in the
1405 respective calls to press(), move() etc.
1406
1407 The touch events are committed to the event system when the destructor of the
1408 QTouchEventSequence is called (ie when the object returned runs out of scope), unless
1409 \a autoCommit is set to false. When \a autoCommit is false, commit() has to be called
1410 manually.
1411
1412 \l createTouchDevice() can be called to create a test touch device for use with this
1413 function.
1414*/
1415
1416/*!
1417 \fn QTouchEventSequence QTest::touchEvent(QWidget *widget, QPointingDevice *device, bool autoCommit)
1418
1419 Creates and returns a QTouchEventSequence for the \a device to
1420 simulate events for \a widget.
1421
1422 When adding touch events to the sequence, \a widget will also be used to translate
1423 the position provided to screen coordinates, unless another widget is provided in the
1424 respective calls to press(), move() etc.
1425
1426 The touch events are committed to the event system when the destructor of the
1427 QTouchEventSequence is called (ie when the object returned runs out of scope), unless
1428 \a autoCommit is set to false. When \a autoCommit is false, commit() has to be called
1429 manually.
1430
1431 \l createTouchDevice() can be called to create a test touch device for use with this
1432 function.
1433*/
1434
1435// Internals of qtestmouse.h:
1436
1437/*! \fn void QTest::mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
1438 \internal
1439*/
1440
1441/*! \fn void QTest::mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
1442 \internal
1443*/
1444