summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* QTestlib: Fix custom toString() implementations for QList comparisonFriedemann Kleint2021-01-071-11/+11
| | | | | | | | | | | | d25589e0529732996e405aaff8d6c46b012e1601 mistakenly changed the code to use toString() from the QTest namespace. Call toString() unqualified and move the compareSequence() helper out of the internal namespace. Fixes: QTBUG-89737 Pick-to: 6.0 Change-Id: I8452a0aead7771ad13a5b95438b54e202ccce76b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Replace QtTest headers with QTestDavid Skoland2020-12-225-5/+6
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTestLib: add a abort-on-fail environment variableGiuseppe D'Angelo2020-12-042-11/+47
| | | | | | | | | | | | | | | | | | | | | When debugging a spurious failure it's extremely useful to run the test repeadtly into a debugger until a failure appears. When that happens, one wants to immediately start debugging. In so far, this has only been possible by placing breakpoints inside Qt itself (when a failure is logged). Add another way: an env variable, similar to QT_FATAL_WARNINGS, that makes any failure fatal (terminate() gets called. Bonus: you can control the termination handler!) [ChangeLog][QtTestLib][QtTest] When the QTEST_FATAL_FAIL environment variable is set to a non-zero value, a test immediately aborts its execution. This is useful to debug intermittent failures. Change-Id: If2395f964ea482c30b8c8feab98db7fdee701cd3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* QTestLib: allow for non-zero values in env variablesGiuseppe D'Angelo2020-12-042-2/+16
| | | | | | | | | | The usual behavior for env variables is that any nonzero value means "enable", so do the same for a couple of QTestLib env vars. While at it: document them. Change-Id: I854285df5d7af5be771f9d6532ddec5d8a6f8987 Pick-to: 6.0 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Replace discouraged Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPEAndreas Buhr2020-11-301-2/+2
| | | | | | | | | | | | | | Q_MOVABLE_TYPE was conceived before C++ had move semantics. Now, with move semantics, its name is misleading. Q_RELOCATABLE_TYPE was introduced as a synonym to Q_MOVABLE_TYPE. Usage of Q_MOVABLE_TYPE is discouraged now. This patch replaces all usages of Q_MOVABLE_TYPE by Q_RELOCATABLE_TYPE in QtBase. As the two are synonymous, this patch should have no impact on users. Pick-to: 6.0 Change-Id: Ie653984363198c1aeb1f70f8e0fa189aae38eb5c Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Doc: Use explicit linkage with target_link_librariesKai Koehne2020-11-301-1/+1
| | | | | | | | | | | | | | The Professional CMake book suggests always using explicit linkage with target_link_libraries, so let's use that. Whether to use PUBLIC or PRIVATE depends on the context. But let's be conservative and advise on using PRIVATE by default. Task-number: QTBUG-88935 Pick-to: 6.0 Change-Id: I12b80ee85be9f6916f1e4dea6b1c9cb29e03c20f Reviewed-by: Craig Scott <craig.scott@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Doc: explain how to create a test touch device for use with touchEventMitch Curtis2020-11-201-1/+7
| | | | | | Change-Id: Ib60eb0754449da7c50f8632ebd5228ddbe8389f1 Pick-to: 6.0 6.0.0 5.15 5.12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Fix documentation warnings for Qt TestTopi Reinio2020-11-194-4/+12
| | | | | | Task-number: QTBUG-86295 Change-Id: If3c48bee8c898a228128ade18fbdeaa2b8de8b20 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Update landing pages and module pages in qtbaseJerome Pasion2020-11-172-7/+6
| | | | | | | | | | -Qt SQL, Qt D-BUS, Qt GUI, Qt OpenGL, Qt Widgets, Qt Test, Qt Concurrent, Qt XML, Qt Network, Qt Core -language edits for consistency, add links Task-number: QTBUG-87155 Change-Id: Ic61350c9fa15090c802a42d8e9116219591eba73 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QTest: don't wait before sending mouse event: increment the timestampShawn Rutledge2020-11-171-25/+18
| | | | | | | | | | Tests can run faster now, but we still expect calculations based on the timestamp (such as QEventPoint::velocity()) to be correct. Change-Id: Ie962604c9ebd139384dcd89a157de66b4b773cc9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QFileInfo: mark constructors as explicitGiuseppe D'Angelo2020-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | These look like leftovers (API flaws). Construction of QFileInfo from QString (or similar) should be not implicit, as QFileInfo construction is expensive (might hit the file system), and this may have users overlook APIs (for instance build a QFileInfo out of QDirIterator::next(), instead of using ::fileInfo(); using QDir::entryList instead of entryInfoList; etc.). Leave an opt-out mechanism to ease porting. Fix a handful of usages around qtbase, with at least a couple of them likely to be actual "sloppy" code. [ChangeLog][Potentially Source-Incompatible Changes][QFileInfo] Most QFileInfo constructors are now explicit. The QT_IMPLICIT_QFILEINFO_CONSTRUCTION macro is provided to keep old code working. Change-Id: Ic580e6316e67edbc840aa0c60d98c7aaabaf1af6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Stop copying events in testsVolker Hilsheimer2020-11-121-8/+13
| | | | | | | | It's unnecessary, and copying QEvents is a bad practice since it's a polymorphic class. Change-Id: Ieb6de106084f838c5e6c8a0643c54fd3c7f4a7a8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove QTest::lastMouseButtonShawn Rutledge2020-11-112-4/+0
| | | | | | | Followup to b3e91b66b9175c1c3ff5f73f3ac231f74f9bf932 Change-Id: Icd7ceb8cb671705ab77641133d0d799ea091f1a3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QSignalSpy: Use QMetaType instead of metatype id in initArgsFabian Kosmale2020-11-101-6/+4
| | | | | | | | | | | | | | | The RegisterMethodArgumentMetaType had been changed to take a QMetaType instead of a type id in 0161f00e5043090f22b23de9822c09062b17d675. Unfortunately, the usage of it in QSignalSpy was missed. This patch adjusts the metacall to correctly use a QMetaType. Moreover, use parameterMetaType instead of parameterType to benefit from metatypes which are already resolved at compile time. Task-number: QTBUG-88260 Fixes: QTBUG-88356 Change-Id: Id8fa46581a005d62818971ea24d8aa2e39dcd6d0 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Rename "Porting" pages to "Changes"Jerome Pasion2020-11-092-3/+3
| | | | | | | | | | | | | | The content in the porting guides are closer to a changelog than a porting guide. At this point, it is easier for maintainers and contributors to write in a changelog than a guide. This change should help with readability and is closer to the usage of "Changes" in documentation. Part of a rename in other submodules. Task-number: QTBUG-87156 Change-Id: Ib59de7976fae19e7b39962e80161df6628e4070b Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix a few qdoc warningsVolker Hilsheimer2020-11-061-1/+2
| | | | | Change-Id: I7cc284ec56f02049d43a23c81659db94bfc3ff42 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QtTestLib: Update porting guideMårten Nordheim2020-11-031-1/+16
| | | | | | | | | Few breaking changes. Some things moved header, but as they didn't change namespace, naming or signature, and the old headers now include the 'new' headers, it is SC anyway. Change-Id: I6b0556049f6d9203dcf7420317a14992fbe85a80 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Unfix QTest touch API documentationMårten Nordheim2020-11-021-1/+1
| | | | | | | | | Partial revert of 5866b82e240915b9b8d2be7394af560877111ee3. The function is still in the QTest namespace. Change-Id: I5e25b405baf07e61781ca4a527601ef0bf8ce6a4 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove unnecessary cast-to-int for parameter to QBitArrayMårten Nordheim2020-11-021-1/+1
| | | | | | | It was ported to qsizetype after the cast was introduced Change-Id: I00caff1d960f403990f93fcec6a7969e62b4cc99 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Doc: Prefer versioned CMake library targetsv6.0.0-beta3Kai Koehne2020-11-011-1/+1
| | | | | | | | The non-versioned one's do miss some properties. It's therefore best to not advocate using them. Change-Id: I53645e65ed4de4e0100e59905c024cdfe40be0c5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* testlib: Add private API to add test loggerTor Arne Vestbø2020-10-313-8/+25
| | | | | | | Allows adding test loggers outside of testlib. Change-Id: Iabcc780e441de96032a05fc0a386dd52e2f2f404 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* testlib: Let logger report whether it is logging to stdoutTor Arne Vestbø2020-10-313-5/+13
| | | | | Change-Id: I7df61b4fdc8c431a73c4b399e2f620923a7c7217 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* CMake: Cleanup module and plugin define situationAlexandru Croitor2020-10-301-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QT.<module>.DEFINES assignment in pri files needs to take into account the module name when computing the define name. This is the MODULE value that qmake specifies. In CMake that would be the value of CONFIG_MODULE_NAME. Previously the value of the define was computed in qt_internal_module_info() without taking into account the module name. While qt_internal_module_info() ended being used also for plugins and other target types, the defines computed by it were meant to be used only for Qt modules. Thus remove the <result>_define assignment from qt_internal_module_info and move its computation directly into qt_internal_add_module, taking into account the value of CONFIG_MODULE_NAME. The only other use of module_define was in qt_internal_add_plugin but that was merely a long overdue copy-paste error, qmake doesn't propagate QT_FOO_LIB defines for plugins. As result, a define special case in testlib is not needed anymore, because the define is now computed properly. Finally, QT_FOO_LIB should not be used while building the Qt module itself, so instead of using PUBLIC_DEFINES option of qt_internal_extend_target, use target_compile_definitions(INTERFACE) directly. Change-Id: I4d44f7461bac2f0c09aec3e995d02dfe36e00883 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* CMake: Regenerate qtbase projects to use correct CONFIG_MODULE_NAMEsAlexandru Croitor2020-10-302-1/+3
| | | | | | | | Also sneak in testlib's misisng QMAKE_MODULE_CONFIG values. Task-number: QTBUG-88025 Change-Id: I76a37b8d8dbf7f294f91e32a5edbc52f5c83555b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Fix documentation for QTest touch APIsVolker Hilsheimer2020-10-291-10/+10
| | | | | Change-Id: Ifd9a3161e8ee422f8b0ce3adba8ae1b029c096d1 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QAbstractItemModelTester: don't rely on hasChildren()David Faure2020-10-271-4/+5
| | | | | | | | | | | | | | | | | | | Dynamic models which use fetchMore to asynchronously fill subdirs (like KDirModel) return true in hasChildren() for dirs that are expected to have children (so that the "+" shows in the treeview) but do not actually have children readily available. They will be inserted later on once the async listing job is done (as a result of fetchMore triggering that job). So QAbstractItemModelTester should use rowCount instead, to find out if there are children present. This detected a bug in QConcatenateTablesProxyModel: it returned a non-zero rowCount for its items, while it's flat. Change-Id: Idcdc86159f1fc79ed5297075dfcf30c09896287a Pick-to: 5.15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* testlib: Spit out crash backtraces to stderrTor Arne Vestbø2020-10-231-2/+2
| | | | | | | | Ensures that the backtrace is interleaved with the header and footer that we print ourselves. Change-Id: I728f4a05be31e345687cbb5fefe49f76dbe8ae36 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-3/+3
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Another round of replacing 0 with nullptrAllan Sandfeld Jensen2020-10-073-5/+5
| | | | | | | | | This time based on grepping to also include documentation, tests and examples previously missed by the automatic tool. Change-Id: Ied1703f4bcc470fbc275f759ed5b7c588a5c4e9f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Replace Q_DECL_UNUSED with [[maybe_unused]]Allan Sandfeld Jensen2020-10-031-7/+7
| | | | | | | Use C++17 attribute directly Change-Id: Id853e7a5117065e4adb549f81303c1820fe198ce Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Properly deprecate QProcess::pidVolker Hilsheimer2020-10-011-1/+1
| | | | | | | | | | | Address an old ### Qt 5 comment. The method has been documented as deprecated and replaced by QProcess::processId since at least Qt 5.9, so we can first properly flag it as such for 5.15.2, and remove it from Qt 6 in a follow-up commit. Change-Id: Ic4e3351740617083b16723db8eef7a341bccfbf6 Pick-to: 5.15 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QTestResult: Don't pass a nullptr file to addFailure()Ulf Hermann2020-09-301-3/+5
| | | | | | | | addBFail() asserts on the file being non-null. The convention seems to be "Unknown File" for cases where we cannot determine the file. Change-Id: I3a4d0130352d77d75f264fad6f3bd47c6700ef4c Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Doc: Update CMake snippets to Qt 6Kai Koehne2020-09-251-2/+2
| | | | | | | Change-Id: I53021781a25c141db5d5fc6771192cd8d6ed732a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix qdoc warning from broken snippetVolker Hilsheimer2020-09-231-1/+1
| | | | | Change-Id: Ieaf7676dd7406363dfd970528dd13e65b9af87c3 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Regenerate projects to use new qt_internal_ APIAlexandru Croitor2020-09-233-20/+20
| | | | | | | | | | | Modify special case locations to use the new API as well. Clean up some stale .prev files that are not needed anymore. Clean up some project files that are not used anymore. Task-number: QTBUG-86815 Change-Id: I9947da921f98686023c6bb053dfcc101851276b5 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Doc: Correct link errors qtbaseNico Vertriest2020-09-212-2/+2
| | | | | | Task-number: QTBUG-86295 Change-Id: I27f6bbdadffb08a8794520a14dfe0e2334979575 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Output QSysInfo::productType() and productVersion() in test config lineMitch Curtis2020-09-181-1/+2
| | | | | | | | | | This makes it easier to know which values to use in BLACKLIST files for a flaky test, for example. Pick-to: 5.15 Change-Id: I12af99d68f97e016aa42be9ae9d70de5fc0a58ed Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Add links to Qt 6 changes files from module indexPaul Wicking2020-09-181-0/+4
| | | | | | Task-number: QTBUG-84051 Change-Id: Iac25df135c9d73a990b41243e08cd38ea78296a4 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
* Doc: Add porting guide documentsPaul Wicking2020-09-161-0/+46
| | | | | | | | Also add existing such docs to the new document group Task-number: QTBUG-84051 Change-Id: I76f033f0846e09943f249d2beeb1606869eef382 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Make QTRY_IMPL() exit its loop if the test failsEdward Welbourne2020-09-141-3/+3
| | | | | | | | | | | | | | | | | | Some tests, particularly the asynchronous ones that depend on the QTRY_*() macros, have call-backs in which a test can fail, but the macro used to test for failure only returns from the call-back, so the test doesn't know to fail. Make sure the QTRY_*() macro gives up if that happens, so that the test function at least gets control back and can notice that it's failed. Even if they don't check, they'll fail sooner, where they might otherwise have been stuck in a loop that would never exit until the watchdog timer shoots the test down (and Coin ends up with a debugger back-trace and no output from later tests). Change-Id: I622a53117de5e97d23dd22e04e5cd20361a54651 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Make QStringList an alias to QList<QString>Lars Knoll2020-09-122-9/+0
| | | | | | | | | | | | | | | | | | Fix our API, so that QStringList and QList<QString> are the same thing. This required a bit of refactoring in QList and moving the indexOf(), lastIndexOf() and contains() method into QListSpecialMethods. In addition, we need to ensure that the QStringList(const QString&) constructor is still available for compatibility with Qt 5. Once those two are done, all methods in QStringList can be moved into QListSpecialMethods<QString>. Change-Id: Ib8afbf5b6d9df4d0d47051252233506f62335fa3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Rename QLibraryInfo::location() to path()Lars Knoll2020-09-121-1/+1
| | | | | | | | As per ### Qt6 comment. Also rename the LibraryLocation enum to LibraryPath. Change-Id: I556025a19c5bcdf2ff52598eaba32269522d4128 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Partially revert "Inline QTest::qSleep()"Lars Knoll2020-09-122-19/+0
| | | | | | | | | | | | | | | | | | This change partially reverts change a0e0b51001edfc1c7aea113c472ce995efa833fd. Replacing the QTest specific sleep function with QThread::msleep() was not a good idea. The reason is that QThread::msleep() will force the thread to sleep to x mseconds, even if a signal woke the thread in the meantime. This would cause qWaitFor() to not call processEvents(), in some cases, leading to flakyness and test failures in tests that rely on timing, such as the animation tests in Qt Qml. Change-Id: I0ad132cdf32be5813b2e73552d772251fe1d7f89 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Compile snippets only when running testsPaul Wicking2020-09-102-13/+17
| | | | | | | | | | Turn snippets projects into subdirs with libraries to avoid messy dependencies. Fixes: QTBUG-86497 Pick-to: 5.15 Change-Id: Idb2c43f97d56c9b8d9992617ef716bde40fff5b7 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: explain how to blacklist QML tests on certain platformsMitch Curtis2020-09-101-2/+20
| | | | | | Change-Id: Icd505175805820c64593d7eb8f580a51008e2e1a Pick-to: 5.15 5.12 Reviewed-by: Daniel Smith <Daniel.Smith@qt.io>
* Port from devicePixelRatioF() to devicePixelRatio()Morten Johan Sørvig2020-09-101-6/+6
| | | | | | | This ports all of QtBase. Change-Id: If6712da44d7749b97b74f4614a04fac360f69d9e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* 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>
* Refactor testlib touch functions into qtestsupport_gui and _widgetsShawn Rutledge2020-09-081-160/+5
| | | | | | | | | | | | | Because we removed public setters from QTouchEvent and QEventPoint in 4e400369c08db251cd489fec1229398c224d02b4 and now it's proposed to give QEventPoint a d-pointer again, the implementation of QTouchEventSequence needs to start using QMutableEventPoint: being a friend will no longer be enough, because the member variables won't be accessible in the future. But because we have separate test libs for Gui and Widgets, it needs to be further refactored into two classes. Change-Id: I0bfc0978fc4187348ac872e1330d95259d557b69 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Inline QTest::qSleep()Lars Knoll2020-09-062-7/+2
| | | | | | | Simply use QThread::msleep() to implement it. Change-Id: I37c255fc70951715edc489d9f67669b01af380b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Remove two obsolete #definesLars Knoll2020-09-061-5/+0
| | | | | Change-Id: Icc13408cfdb8ce0db6f274904c3e44f8376cd1e5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>