summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestsystem.h
Commit message (Collapse)AuthorAgeFilesLines
* testlib: Move qtestsystem helpers to their respective modulesTor Arne Vestbø2018-07-161-99/+4
| | | | | | | | | | | | | Having the helpers in each respective module lets us implement the helpers using private APIs without forcing the test to add private dependencies. It also makes it easier to test Qt using a third party testing framework (for running the test suite), while still using the helpers for ensuring tests behave expectedly. Change-Id: I2a6ce24526ed345f3513548f11da05c7804c203f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-05-031-17/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
| * qtestlib: restore qWaitForWindowActive() its original semanticsGatis Paeglis2018-05-021-17/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch removes a bad hack for Unity issue described in QTBUG-67757. The workaround from 243a0660e10d13b8bd6eb4f90e5695aefab4611f caused even more problems, see QTBUG-63542. Besides causing more problems, the usage of this hack was inconsistent. The goal was to get stable geometry before continuing further in the test function. The same logic should have been used in qWaitForWindowExposed(). It was never documented that only qWaitForWindowActive() has this tweak. Also this hack was needed only for Unity, instead being unconditionally executed for all platforms. Task-number: QTBUG-67757 Change-Id: I7b7fb4b09151c4ab4807282006d7f956b18f60ad Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Kari Oikarinen <kari.oikarinen@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-03-081-2/+2
|\| | | | | | | Change-Id: Idf471ca5c6cf211813466b539ce45bdc1ae9b97c
| * Revert "Make qWaitForWindowActive more robust"Ville Voutilainen2018-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 2eec3272c78a3af1e362906654aa6d50b33a4c50. The change to qWaitForWindowActive causes regressions in qtdeclarative, so we need a better fix for the problems we have with window waiting. Task-number: QTBUG-66866 Change-Id: I8300dabc870d6aeaa9ba6bfcf3d64146b13c1955 Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-02-281-2/+2
|\| | | | | | | Change-Id: I1ce43c8a214a869c5c4ac4245bb92c88c6bc6999
| * Make qWaitForWindowActive more robustVille Voutilainen2018-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Based on the information we got from Unity developers, we need to check for window's frame geometry to be set, not just window's position to be set. On various window managers, a window is 'ready' once the frame geometry is set. This fixes autotest flakiness of tests that use qWaitForWindowActive. Task-number: QTBUG-66216 Change-Id: Icb664e7b802b474919f3b058c00681574522ccbe Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Remove superfluous call from qWaitForKari Oikarinen2018-02-141-3/+1
|/ | | | | | | | The remaining time will be fetched again after checking the predicate, so the read value was never used. Change-Id: I627152116ea579577e490ecefbaee02fec4aabdc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix spelling in qWaitFor commentTor Arne Vestbø2017-10-121-1/+1
| | | | | Change-Id: I0ac67de3371ee36c21e124e88845aaae63a73f6e Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Ensure result of all QTest::qWaitFor are verifiedTor Arne Vestbø2017-10-051-5/+6
| | | | | | | | | The qWaitFor functions themselves can not trigger a test failure, as that will not result in the test function exiting early, so every single call to qWaitFor needs to be wrapped in a QVERIFY. Change-Id: Id15a1549f31d06cdbf788e1d84ea431c28636ec8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Workaround GCC 6 parsing error ("used but never defined")Thiago Macieira2017-09-271-3/+16
| | | | | | | | | | | GCC 7 and other compilers compile this code just fine. GCC 6 fails, so this is clearly a compiler bug. So revert the implementation of the qWait() function back to the original, to make the problem disappear. qtestsystem.h:58:42: error: ‘bool QTest::qWaitFor(Functor, int) [with Functor = bool (*)()]’ used but never defined [-Werror] Change-Id: I0b48fc8e90304e0dacc3fffd14e8110138cc9f45 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Fix build: move Q_REQUIRED_RESULT to the right positionThiago Macieira2017-09-271-1/+1
| | | | | | | | | | | | | If you're using GCC 7 or Clang 4, Q_REQUIRED_RESULT expands to [[nodiscard]] that must appear in as specific place on the line. qcompilerdetection.h:1182:29: error: attribute ignored [-Werror=attributes] qtestsystem.h:58:12: note: in expansion of macro ‘Q_REQUIRED_RESULT’ static Q_REQUIRED_RESULT bool qWaitFor(Functor predicate, int timeout = 5000) ^~~~~~~~~~~~~~~~~ Change-Id: I0b48fc8e90304e0dacc3fffd14e80ede168d5c6b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* testlib: Add qWaitFor to wait for predicateTor Arne Vestbø2017-09-251-28/+39
| | | | | | | | Reduces duplication of logic and allows other primitives to be built on top. Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-03-211-3/+3
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/eglfs/eglfs-plugin.pro Change-Id: Id76cdbb41b7758572a3b8ea4dcb40d49bac968db
| * Use the same timeout value for all QTest::qWaitForWindow*() functionsMarc Mutz2017-03-081-3/+3
| | | | | | | | | | | | | | Some were 5s, others 1s. Pick one (the higher). Change-Id: I81929d4f49c2e41b4d4b75c3e2bf8ff75af868ad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Revert "testlib: Add qWaitFor to wait for predicate"Friedemann Kleint2017-02-231-39/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 3b38392844dd9e145a4783445fd3c96e84bb94d1. The change caused test compile failures with MSVC2015 in qqmlsettings; a variable was not captured in the lambda expression. This appears to be a compiler bug of MSVC. Task-number: QTBUG-59096 Change-Id: I3bf5288eb005b2e1661819bb33bc54fb944d0150 Reviewed-by: Liang Qi <liang.qi@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | testlib: Add qWaitFor to wait for predicateTor Arne Vestbø2017-02-211-28/+39
| | | | | | | | | | | | | | | | Reduces duplication of logic and allows other primitives to be built on top. Change-Id: Ia100014cfb0c09ac2f47c3a156d0c76f0fddafa8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-161-3/+3
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/plugin/qlibrary_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp Change-Id: I632c400d909f8c204f55743aadc7886af2f15dfb
| * Use Qt::PreciseTimer for the QDeadlineTimers in QTest::qWait*Thiago Macieira2017-02-151-3/+3
| | | | | | | | | | | | | | | | | | QDeadlineTimer will eventually support CLOCK_MONOTONIC_COARSE on Linux, so let's be safe before that change appears. Change-Id: I9b423f1b71194205b27afffd14a383a7e9f66a9d Reviewed-by: Stéphane Fabry, Cutesoft <stephane.fabry@gmail.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2017-01-301-18/+18
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/network-chat/peermanager.cpp src/widgets/util/qsystemtrayicon.cpp src/widgets/util/qsystemtrayicon_qpa.cpp src/widgets/util/qsystemtrayicon_win.cpp src/widgets/util/qsystemtrayicon_x11.cpp Change-Id: I1c026df83818c0ccaf956980370e7522960627db
| * Improve QTest::qWait() precision and switch to QDeadlineTimerAllan Sandfeld Jensen2017-01-251-18/+18
| | | | | | | | | | | | | | | | | | Do not wait up to the timeout ms after already having waited several times. At the same time upgrade to using the QDeadlineTimer which is designed for this purpose. Change-Id: Iaf5e4f4655605d5143ce91040c6eb6706752e504 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use closest QWindow when waiting for a widget to become active/exposedTor Arne Vestbø2016-12-171-2/+2
|/ | | | | | | | | A child widget without a native handle would previously not be treated as exposed or active, even if the closest QWindow actually was, resulting in qWaitFor returning false and QVERIFY failing. Change-Id: I9df41cbac7aeab63bfa59d8ac77880591393c085 Reviewed-by: Simon Hausmann <simon.hausmann@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>
* 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>
* Fix QtTest function-unused warnings found by Clang 3.4Thiago Macieira2014-01-171-1/+1
| | | | | | | | The front-end functions in the QTest namespace are declared static inline, so the compiler can complain. Make it not do so. Change-Id: I4036c85010e02ef22a8071ed05e49173dfc64729 Reviewed-by: Jason McDonald <macadder1@gmail.com>
* qWaitForWindow* default timeouts are 5 secondsShawn Rutledge2013-03-231-2/+2
| | | | | | | | | A widget window can be expected to show up faster, but on a busy CI machine, OpenGL windows can take longer than 1 second. Change-Id: I572cc86bf4d8beebcc565db8d6f2ff78e55c2ac0 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: David Faure (KDE) <faure@kde.org>
* 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>
* Remove QWindow pos, geometry and size as properties; pos->positionShawn Rutledge2012-11-081-1/+1
| | | | | | | | | | | Abbreviated properties are to be avoided. But all 3 of these properties are redundant from the QML perspective; and because QRect, QPoint and QSize are (wisely) not QObjects, it's not possible to bind to _their_ properties, which make these QWindow properties less useful than users might assume that they are. Change-Id: I19c00b54b1d2712f9418e8bcf56e35a8008b89ef Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix build when libQtGui is not availableHarald Fernengel2012-11-011-1/+5
| | | | | Change-Id: I9e35d9302f58d283459f7e625c4e0b87fd1dc2bf Reviewed-by: Friedemann Kleint <Friedemann.Kleint@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>
* Deprecate qWaitForWindowShown QWidget* overload since 5.0.Stephen Kelly2012-08-271-2/+2
| | | | | | | | It is already documented as deprecated in 5.0, so marking it as deprecated since 6.0 is silly. Change-Id: If72cc81bdad18c907022c48b9aa8e7d87eb88e59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove qWaitForWindowShown(QWindow*) overload.Stephen Kelly2012-08-231-6/+0
| | | | | | | | The QWindow* overload was introduced for Qt 5.0, but is unused already. Change-Id: Ic07f19eac87bc93a589017407668760fceb2f632 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Deprecate the qWaitForWindowShown(QWindow *) method.Friedemann Kleint2012-07-251-2/+3
| | | | | | | | | | | | | | While the qWaitForWindowShown(QWidget *) is inherited from Qt 4.8, the qWaitForWindowShown(QWindow *) was introduced in Qt 5. As it is identical to qWaitForWindowExposed() and removed already, it can be deprecated in Qt 5. Remove its usages in qtbase. Change-Id: I28788d120ad687a49f02b2b44de6b38a2832fe5c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Implement waitForWindowExposed and friends for widget windows.Friedemann Kleint2012-07-201-10/+26
| | | | | | | | | | | | | | - Implement waitForWindowExposed() for toplevel windows. - Implement waitForWindowShown(QWidget *) and mark as deprecated in line with waitForWindowShown(QWindow*). - Use in tests. - Simplify tests (collapse waitForExposed, setActive into setActiveWindow, waitForActive), remove most hard-coded timeouts. - Stabilize graphicsview tests by using waitForWindowActive. Change-Id: Ic7c061e2745b36f71a715ee4e47c0346b11a91e8 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Implement qWaitForWindowShown using qWaitForWindowExposed.Friedemann Kleint2012-07-121-2/+4
| | | | | | | Deprecate qWaitForWindowShown for Qt 6 as it is just a wrapper. Change-Id: I0f8195679679120bd402e273fed4d331dc926708 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Make qWaitForWindowShown more robust on XLaszlo Agocs2012-05-291-0/+14
| | | | | | | Try ensuring the window has received its valid position from the WM. Change-Id: Ibd75bc19ae820765bfaadd30c22e77a19cd28849 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Fix broken qWaitForWindowShown() behaviorCharles Yin2012-03-161-3/+23
| | | | | | | | | | qWaitForWindowShown() should check window->isActive() instead of window->isExposed() and return false if timeout. Add two new qWaitForWindowActive() and qWaitForWindowExposed() functions. Change-Id: Idd9601805c2e84b0d36ddd5471031b627d289953 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Improved qWaitForWindowShown().Samuel Rødal2012-03-151-11/+11
| | | | | | | | | Made faster by actually waiting for the window to be exposed, using similar waiting logic as qWait(). Should speed up autotests that use it quite a bit. Change-Id: I628c6110a554fdbbf5bed7e91f57c2fe341113ed Reviewed-by: Lars Knoll <lars.knoll@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>
* Make QTest::qWait() handle DeferredDelete eventCharles Yin2011-11-151-0/+2
| | | | | | | | | | | The QTest::qWait() function does not handle DeferredDelete, in this case all deleteLater() calls before the qWait() won't be processed during the wait. Add an explicit sendPostedEvents(0, QEvent::DeferredDelete) to fix this problem. Task-number:QTBUG-22633 Change-Id: I2c5574b4e7d3c070fad6382dc36ddfd1dfac50d6 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* hack to allow qWaitForWindowShown to be used in test cases that use QWindowMatthew Cattell2011-09-121-0/+7
| | | | | | | Change-Id: Id51aaf81d898f9159e4587613f5e34c3de9a5808 Reviewed-on: http://codereview.qt-project.org/4690 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Stabilize autotests using QTest::qWaitForWindowShown on non-X11.Rohan McGovern2011-08-181-4/+1
| | | | | | | | | | | | | | X11 is currently the only platform with a "real" implementation of QTest::qWaitForWindowShown. All others merely process events for some fixed interval, and assume that this is sufficient for the window to be placed. In practice, the current interval is too short for slower machines. Change-Id: I956cd747d0b30577f5072a9a08da88dabc76906c Reviewed-on: http://codereview.qt.nokia.com/3060 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@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/+95
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