summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtesteventloop.h
Commit message (Collapse)AuthorAgeFilesLines
* QTestEventLoop: add enterLoop(std::chrono::milliseconds) overloadAhmad Samir2023-03-031-4/+6
| | | | | | | Task-number: QTBUG-110059 Change-Id: Ibf1d76afd313e390103be4a22e44af7fb41ace1b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add QTest::currentTestResolved() and use in testlibEdward Welbourne2022-09-221-1/+1
| | | | | | | | | | | | | | | | | | The QTRY_* macros and QTestEventLoop have (since 6.3) been exiting their loops early if the test has failed. Where that was appropriate, they should also have been exiting early on skip. [ChangeLog][QtTest] Added QTest::currentTestResolved(), which is true if the test has failed or skipped. The QTRY_*() macros and QTestEventLoop now use this, rather than QTest::currentTestFailed(), to test whether they should stop looping, so that they also do so on a skip. Task-number: QTBUG-104441 Change-Id: Ibf3d5a095b35e6670bc3daf756f05b66f7f3ef9b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Skip early return from test loops during cleanup()Edward Welbourne2022-09-221-1/+1
| | | | | | | | | | | | | | | | The QTRY_* macros and QTestEventLoop exit early if the test has resolved; however, in the cleanup phase of a test, even if the test has failed, these loops should continue as normal. [ChangeLog][QtTest] During the cleanup() phase of a test, the QTRY_* macros and QTestEventLoop now ignore the test resolution, in contrast to when they are used from the test itself, which (since 6.3.0) exits the loops early if the test has failed. Pick-to: 6.4 6.3 Fixes: QTBUG-104441 Change-Id: I2673161967cbbc57815155af698a9338ab98a686 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Apply Q_CONSTINIT where beneficialSona Kurazyan2022-09-011-1/+1
| | | | | | | | | | Applied Q_CONSTINIT to variables with static storage duration, but skipped the POD types with core constant initializers. Task-number: QTBUG-100486 Change-Id: Iaabf824e9cb0f29a405a149912200d4e4b3573c1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Use a precise timer in QTestEventLoop if timeout is sub-secondVolker Hilsheimer2022-05-311-1/+2
| | | | | | | | | | | | QTestEventLoop is used by QSignalSpy::wait. If tests want to verify that a signal gets emitted within a second or less, we should use a precise timer to reduce the chance of timer imprecision breaking the test. Change-Id: I2a2ca3bbdcaf032288f1fdc2aecc6afd05a6c76c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QTestEventLoop: stop when the test failsEdward Welbourne2021-08-051-4/+6
| | | | | | | | | | | | | | | | | | | | | | It makes no sense for the event loop of a test to keep running after a test has failed. This lets test code simply use the usual testlib macros to compare and verify values in asynchronous tests that would otherwise need to hand-test values and send a signal on failure (that the main test can connect to an event-loops quit() or equivalent). For example, QLocalSocket's benchmark simply uses the usual macros, without doing anything to stop its event loop if they fail, with the sad result that, when a test fails, it does so repeatedly and then times out, causing the test program to be killed without running later tests. With this change, that test code (once converted to use QTestEventLoop) is able to exit gracefully on the first failure. [ChangeLog][QtTest][QTestEventLoop] The QTestEventLoop new exits its event loop as soon as the test is known to be failing. Task-number: QTBUG-91713 Change-Id: If0d455741668722034906763025dda496d2afbb4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix ### Qt 6 commentVolker Hilsheimer2020-09-101-5/+6
| | | | | | | | | | | | | The inLoop boolean is unused, so remove it. At the same time, there is another boolean that might just as well become a bitflag, so that we can add more members in the future, should the need arise after all. Since we then need to explicitly initialize the member, add a standard QObject constructor. Change-Id: I51245829c1b1192fde62592fb972da6ea2a88e11 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QTestLib: Use member initializationFriedemann Kleint2019-07-111-5/+4
| | | | | | | | Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: Iba0834dc89cbfc215acc5873f31fa6eeed74177d Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
* testlib: Mark unused member variable for future removalKari Oikarinen2018-06-051-4/+1
| | | | | | | | | inLoop is only set, never read and it is private. Since the class is public, it can't be removed yet, but add a comment so that it will be removed when possible. Change-Id: I5e212194cb65626fce2b4c7b68801a73dbe3f500 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Testlib: Rename qtest_global.h to qttestglobal.hUlf Hermann2018-03-211-1/+1
| | | | | | | | | | | | | This follows the naming convention for global headers and causes qttestglobal.h to be added to the top of the generated QtTest header. It is necessary to have it there when other headers depend on features defined in configure.json. [ChangeLog][QtTest] The qtest_global.h header is now deprecated. Include qttestglobal.h instead. Change-Id: Iaed639d4e13dd99cee6387fce9d15d6e55b0b1e8 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-3/+3
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtTest: Add missing overrideAlexander Volkov2016-12-011-1/+1
| | | | | Change-Id: Ibb924f11b82577fb67aa7a1a30b81f4d8d7d36fc Reviewed-by: hjk <hjk@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QtTestLib: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-061-3/+3
| | | | | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Since QtTestLib has a lot of templates and macros, not all uses of 0 as nullptr might have been detected by the headersclean check. Task-number: QTBUG-45291 Change-Id: I21e9d8822e3a708010938e8d5ef2fd42ae6c8c68 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Make QTestEventLoop::exitLoop() thread-safeRoland Winklmeier2014-10-311-0/+7
| | | | | | | | | | | | | | | | | | | QTestEventLoop::exitLoop() is used by QSignalSpy to stop event processing when the connected signal has been received. The design of QSignalSpy requires QTestEventLoop::exitLoop() to be thread-safe, which it wasn't. When QSignalSpy is connected to a signal in a different thread, exitLoop() was called from the thread which emitted the signal and not the one in which QTestEventLoop is running. This caused troubles when killing the internal timer. This patch adds a check in the beginning of exitLoop(). If it is called from a different thread, it will post an event into the message queue in which QTestEventLoop is running and execute it there. Change-Id: Icb8c8ff2f5344800ee6c6125b98c677c7a196c32 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Add QSignalSpy::wait() method.David Faure2012-07-251-3/+4
| | | | | | Change-Id: I1f3b49e3dee19bf0b1d2933c6e6ad7972186e0d0 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-251-1/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qtbase Qt moduleJyri Tahtela2011-05-241-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Initial import from the monolithic Qt.Qt by Nokia2011-04-271-0/+136
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12