summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* TestLib: Fix license headers in qabstractitemmodeltester.*Kai Koehne2018-05-072-10/+32
| | | | | Change-Id: Ide05bcdd30cd5f672949aacd5564a4a73c38366d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* 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>
* Fix win32-clang-msvc build due to -Werror,-Wunused-private-fieldSergio Martins2018-03-231-3/+14
| | | | | | Task-number: QTBUG-63512 Change-Id: Ie1507faffc11be09d9ce5e95c3b537dd65bb6978 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Make QCOMPARE(-inf, -inf) and QCOMPARE(NaN, NaN) succeedThiago Macieira2018-03-211-1/+11
| | | | | | | | | | | | This will make two floating points containing NaN compare as equal, instead of the regular nan != nan IEEE behavior (which isn't very useful in a unit-test framework). Note that this does not apply to indirect comparisons, for example via QVariant. Change-Id: I39332e0a867442d58082fffd150851acfdd18c23 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Testlib: Add a feature for the item model testerUlf Hermann2018-03-214-2/+33
| | | | | | | | It depends on QAbstractItemModel, so we need to switch it off if itemmodel is unavailable. Change-Id: I97246767a5e387b7a2cee90c34125a8411ef1c4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Testlib: Rename qtest_global.h to qttestglobal.hUlf Hermann2018-03-2121-24/+23
| | | | | | | | | | | | | 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>
* qtestlib/Unix: Output function time and total time in case of a crashFriedemann Kleint2018-03-211-4/+8
| | | | | | | | This helps to distinguish timeouts from real crashes in COIN. This is already done for Windows. Change-Id: I4daeafa36f50482d20cea4bd1106647081ff7abe Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Modernize the "regularexpression" featureUlf Hermann2018-03-203-7/+9
| | | | | | | | | | | | | Use QT_CONFIG(regularexpression), disentangle it from QT_BOOTSTRAPPED, switch it off in the bootstrap build, remove the #ifdefs from qregularexpression.{h|cpp}, and add QT_REQUIRE_CONFIG(regularexpression) to the header. qregularexpression.{h|cpp} are already correctly excluded in tools.pri if !qtConfig(regularexpression). Change-Id: I21de154a6a118b76f99003d3acb72ac1e220d302 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* logging: Clarify and document how we look for the presence of a consoleTor Arne Vestbø2018-03-071-6/+4
| | | | | | | | | | | | | The privately exported qt_logging_to_console() function has been renamed to shouldLogToStderr, and exported in the QtPrivate namespace for QtTestLib. [ChangeLog][Important behavior changes][Logging (including qDebug and qWarning)] The QT_LOGGING_TO_CONSOLE environment variable has been deprecated. Use the more specific QT_ASSUME_STDERR_HAS_CONSOLE or QT_FORCE_STDERR_LOGGING, depending on your usecase. Change-Id: Ie29228eeac3b700c3de94fee022d5d66d9b5c210 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* 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>
* qtestlib: fix support for pressing multiple mouse buttonsGatis Paeglis2018-03-012-8/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a37785ec7638e7485112b87dd7e767881fecc114 went in, it become apparent that multi mouse button state handling in qtestlib is non-existent, for details see QTBUG-64030 and QTBUG-63786. What happened behind the scenes often was not what one would expect based on the provided QTest::mouse* input sequence - events went missing, incorrect events were generated, each subsequent test function started with a state set from the function that run earlier. It is easy to see how a minor change in one test could easily affect outcome of other tests. With a37785ec7638e7485112b87dd7e767881fecc114, Qt platform plugins are now responsible for sending explicit mouse button type and state information; qtestlib should take full responsibility now as well. But using the new API from a37785ec7 alone in qtestlib is not sufficient. We need to reset mouse state between each new test function run (we do this at function scope as that fits with the current qtestlib API user expectations). This patch implements the necessary reseting logic. Updated tst_qwindow.cpp::generatedMouseMove() to use QTest::mouse* APIs. That test requires pressing multiple buttons, it was not possible with QTest::mouse* APIs before this patch. Added an auto test for multiple mouse button pressing/release in tests/auto/testlib/selftests/mouse/. And few other tests which are currently QSKIP-ed, but should be considered when re-designing qtestlib APIs. Task-number: QTBUG-64030 Change-Id: I39fdcbc73a467a7463ce2aed622bf22484095635 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Add doc for QSKIPNico Vertriest2018-02-282-0/+113
| | | | | Change-Id: Ib8cd1b4926652984b41b5a05bf4dbf3214f2856f Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* 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>
* un-crash QPlainTestLogger::printMessage()Jan Arve Sæther2018-02-221-6/+5
| | | | | | | | | | | | | | | | | | Commit cf4a6111150d866424ee07bda80a1d38f24ea02d refactored out test identifier buildup into a standalone function, but it returned the QTestCharBuffer as a value type, which ultimately caused it to crash: Unfortunately QTestCharBuffer is not copied correctly: Since it uses the default copy ctor it will copy the buf pointer and create a deep copy of the staticBuf pointer. When the dtor was later called it would then end up calling free(buf) (where buf pointed to the staticBuf of the original QTestCharBuffer). Task-number: QTBUG-66607 Change-Id: Ifa290658be6f077a0d6613451c26aeeffc8df41c Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6ffb358822db2e0d30fb34853c3222cd866d57c5) Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Linux-syscall-note exception to 3rdparty testlib documentationKai Koehne2018-02-221-3/+3
| | | | | Change-Id: Ib2e0ee2b7397e65ebd79a92fc83c9e08780d626e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* testlib: Pass on log message context to loggersTor Arne Vestbø2018-02-215-20/+47
| | | | | Change-Id: I1e0bb09d4f96b45f1e9757ea25ae3aba1ae42447 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Merge remote-tracking branch 'origin/5.9' into 5.11Liang Qi2018-02-141-2/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/animation/qvariantanimation.cpp src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/corelib/io/qprocess_win.cpp src/corelib/json/qjsonarray.cpp src/corelib/tools/qsimd_p.h src/corelib/tools/qtimezoneprivate_p.h src/corelib/xml/qxmlstream_p.h src/gui/kernel/qsimpledrag.cpp src/gui/kernel/qsimpledrag_p.h src/plugins/generic/generic.pro src/plugins/platforms/cocoa/qcocoamenu.mm src/widgets/styles/qmacstyle_mac.mm tests/auto/concurrent/qtconcurrentmap/BLACKLIST tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp tests/auto/gui/kernel/qwindow/BLACKLIST tests/auto/widgets/dialogs/qmessagebox/BLACKLIST Change-Id: I508d686cf20f7f8cc6a7119b9bc7c3bbb505c58e
| * Doc: Mention exact Qt version the third party attributions apply toKai Koehne2018-01-191-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We do add, remove or update third party code in minor releases, sometimes even in patch level releases. However, the documentation is supposed to be valid for all existing Qt 5 versions, but doing this for attributions would require infrastructure we don't have. Therefore rather make it explicit which Qt version the attributions apply to. Also mention since when Qt is available under LGPLv3 (starting with Qt 5.4). Task-number: QTBUG-65665 Change-Id: I328b5bf0c143f78ea61aad51f0644c3cbb6dee49 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | testlib: Split out test identifier buildup into standalone functionTor Arne Vestbø2018-02-131-19/+28
| | | | | | | | | | Change-Id: I99aa106d5aab8f299e61835680709e4fd856defe Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix typosJarek Kobus2018-02-131-1/+1
| | | | | | | | | | Change-Id: Id625efea998f2b4dce9970b903830dc3b3efcd3d Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | testlib: Don't set QT_LOGGING_TO_CONSOLETor Arne Vestbø2018-02-101-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QtTestLib has its own message handler installed via qInstallMessageHandler, so there is no need to set QT_LOGGING_TO_CONSOLE to force stderr output, as that's what QPlainTestLogger::outputMessage uses anyways. And in the case of using other testlib outputs such as XML, we're not going to hit any of the code paths that would check QT_LOGGING_TO_CONSOLE. The only relevant exception is Windows, which checks stderrHasConsoleAttached(), which is affected by QT_LOGGING_TO_CONSOLE, but Qt Creator actually has an explicit inversion of this existing code, to prevent it from setting QT_LOGGING_TO_CONSOLE, so that output ends up in OutputDebugStringA and can be read and distinguished from the debugger's output. See QTCREATORBUG-16161. Change-Id: Ia8a9b00b221ec5691b52485586f172c9261bf299 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | doc: Fix remaining clang parsing errors in QtTestMartin Smith2018-01-187-27/+81
| | | | | | | | | | | | | | | | This update also corrects all the remaining qdoc warnings in the mnodule. Change-Id: I1cea2cb1dd515d075a1e49a52ca78fc407c3a324 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Long live QAbstractItemModelTester!Giuseppe D'Angelo2018-01-094-3/+947
| | | | | | | | | | | | | | | | | | | | | | | | | | AKA the model tester, living in QtTestLib now. Underwent some significant refactoring from the original modeltester: in particular, it will stop testing illegal indices. [ChangeLog][QtTestLib] Added QAbstractItemModelTester, a class to help testing item models. Change-Id: I0e5efed7217330be11465ce3abb3590f3f2601a4 Reviewed-by: David Faure <david.faure@kdab.com>
* | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2018-01-041-13/+11
|\ \ | | | | | | | | | Change-Id: I644cd82b0d952b7d139e0228bf5017f147db77e7
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-041-13/+11
| |\| | | | | | | | | | Change-Id: I3fa5c9e216201bdf7da260c395f65d7fb95cba0b
| | * Correct "developer-build" in QtTest black list featuresThiago Macieira2018-01-021-1/+1
| | | | | | | | | | | | | | | | | | | | | Q_AUTOTEST_EXPORT is *always* defined. Change-Id: I39332e0a867442d58082fffd150560a6042056fb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| | * Update MSVC versions because 2017 is 19.11 too (and 19.12)Thiago Macieira2018-01-021-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | So invert the list and let "msvc-2017" be the latest, at least until we know about a different version. Change-Id: I39332e0a867442d58082fffd1504c316e27f51d0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | doc: fix signatures and missing module headersMartin Smith2017-12-144-45/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The update adds the moduleheader variable to the qdocconf file for qttestlib.qdocconf and qmake.qdocconf. The problem with qmake is that it doesn't have a module header file, but it does have qmake_pch.h, which is used here. This update also corrects several \fn commands in the qttestlib docs. Change-Id: I2202b9db96390bac1ee491ca8a99ca9010057ce3 Reviewed-by: Martin Smith <martin.smith@qt.io> Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | | Add command line switch to help outputJan Murawski2017-12-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add the command line switch added in change 184c5470f534119b27c1a4caec29d699aba9c234 on qtdeclarative to the help output of the qmltestrunner application. Change-Id: I9f42719500e0039afa6a5b0f1f365611855229b3 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* | | QtTestLib: port away from QRegion::rects()Marc Mutz2017-12-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Use begin()/rectCount() instead. Change-Id: I08cef424bf24ecf3c058e9b87411f2a5775ffb33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | | qtest_gui.h: remove incorrect #ifdefGatis Paeglis2017-11-301-3/+0
| | | | | | | | | | | | | | | | | | | | | Originated from 6c06e14a49773ce5572935864ed6b9be219c610 Change-Id: Id93f33c8a00850c7b41593c85521d75e5293b36b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | qtestmouse: do not qWait for mocked events on macOSGatis Paeglis2017-11-302-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This logic initially was copied from QTest::mouse* widget overload (by d130382776e8b9db491385a0db45a3daaa79890c) which uses QCursor::setPos() to generate mouse move events via the windowing system. The QCursor API was later removed by 1762bf3394219db3a7a9cc99306f4111e6cb8492, but now the redundant qWait logic remained. Later this stray qWait was incorrectly moved to apply for all mouse event types (by 268f41ec70fd70d4aa44a5043d1a4e678df4c5b5), when originally it was needed (arguably) only for mouse move events due to usage of QCursor. This patch also removes the waitForEvents() function as it is not a documented qtestlib API (in qtestlib only the documented functions should be considered public API, no matter what you can find in the header files). Removal does not affect binary compatibility as this is not an exported symbol. And if somebody has used this non public API, updating code is trivial. Change-Id: Id1dec10f5cf276cee1ac0e8c8f8ba2edc493b667 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-11-233-2/+115
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/network/access/qhttp2protocolhandler_p.h src/network/kernel/kernel.pri src/network/ssl/qsslkey_qt.cpp src/plugins/platforms/cocoa/qcocoascreen.mm src/plugins/platforms/windows/accessible/iaccessible2.cpp src/plugins/platforms/windows/accessible/iaccessible2.h src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h src/widgets/widgets/qmenu_p.h tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp tests/auto/other/qaccessibility/tst_qaccessibility.cpp tests/auto/testlib/selftests/expected_cmptest.lightxml tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/testlib/selftests/expected_cmptest.xml Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-11-092-1/+114
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qwindow.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/windows/qwindowssystemtrayicon.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp tests/auto/corelib/io/qtemporarydir/tst_qtemporarydir.cpp tests/auto/widgets/kernel/qaction/tst_qaction.cpp Change-Id: Ifa515dc0ece7eb1471b00c1214149629a7e6a233
| | * testlib: start sharing common helper functionsGatis Paeglis2017-11-042-1/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... by moving them in QTestPrivate namespace (qtesthelpers_p.h). This header file is a convenient staging area for helper APIs, eventually some could be moved to public QTest API. This header file utilizes the same pattern as other qtestlib header files - wrapping functions with QT_${LIBNAME}_LIB to automatically enable certain APIs based on what is in the projects dependencies, e.g. QT += widgets. Change-Id: Ic0266429939c1f3788912ad8b84fc6e0d5edd68b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
| * | Testlib: Fix developer-build with clang 4v5.10.0-beta4Robert Loehning2017-11-061-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | "implicit conversion increases floating-point precision: 'float' to 'double'" Change-Id: Id6f4315316e63c849f1a5ddb6c77abc2bab0b2a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| * | Make QCOMPARE print QColor alpha values on failureMitch Curtis2017-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when two colors are equal except for their alpha values, QCOMPARE produces the following failure message: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #ff0000 Expected (colorB): #ff0000 By using the HexArgb format instead of the default HexRgb, we can see the full hex string, with alpha values included: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #88ff0000 Expected (colorB): #ffff0000 Task-number: QTBUG-55574 Change-Id: Id82c60a1b473ac6025a6f6ac560fce95a910d782 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Remove references to obsolete platformsJake Petroules2017-11-051-17/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ultrix and reliant have not seen a release since 1995. dgux not since 2001. bsdi not since 2003. irix not since 2006. osf not since 2010. dynix... unclear, but no later than 2002. symbian needs no mention. All considered obsolete, all gone. sco and unixware are effectively obsolete. Remove them until someone expresses a real need. Change-Id: Ia3d9d370016adce9213ae5ad0ef965ef8de2a3ff Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-10-172-11/+26
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/fortuneclient/client.cpp examples/network/fortuneserver/server.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h src/plugins/platforms/cocoa/qcocoabackingstore.h src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoascreen.h src/plugins/platforms/ios/qiosbackingstore.h src/plugins/sqldrivers/oci/qsql_oci.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
| * | QTest: make toString(QHostAddress) workThiago Macieira2017-10-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | I don't know why this needs to be a template specialization instead of overload, like all the other toString overloads. With GCC 7, it was calling QTest::toString<QHostAddress>, which returns nullptr. Change-Id: I638cf58bfa7b4e5fb386fffd14ea7add0eef8f87 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@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>
* | | qpa: enhance mouse event with type and button dataGatis Paeglis2017-10-101-6/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ... and deprecate QWSI APIs that accepts mouse event without mouse button/ type data. In the early days of Qt5 it was decided to centralize mouse button/type handling in QGuiApplication (because of limitation of some now unknown platform). This has proven to be problematic as mouse handling details differ across platforms (e.g on X11 we do not receive mouse release event when closing popup windows or ordinary windows that are closed from the mouse press event). Instead of hacking around platform specific behaviors in Qt Gui, we should move this task back to platform plugins (similar to how this was done in Qt4 with native APIs sending mouse details directly to QApplication). There are even cases where it simply is not possible to deduce (from QGuiApplication) which button caused the event (e.g. when more than one button is involved and some event goes missing). Besisdes, throwing away information which is already available at QPA level (for free) and trying to deduce it again at Qt Gui level seems impractical, fagile (as probably noticed by people fixing all the unexpected issues) and adds unnecessary complexity. Note: Removing the deprecated QWSI APIs from offscreen plugin depends on fixing autotests that rely on QOffscreenCursor::setPos() logic. For the convenience of testing use QT_QPA_DISABLE_ENHANCED_MOUSE to restore to the old code path where QGuiApplication does the mouse state deducing. Other platforms have similar issues. I do not have all supported platform available on my desk, so other platform maintainers will need to take care of porting those platforms to the new APIs. And mainly, I don't want to deal with all the hacks that other platforms have added to workaround this broken mouse logic. In Qt6 we need to remove deprecated code path from QGuiApplication. This patch: - Extends QWindowSystemInterfacePrivate::MouseEvent ctor with QEvent::Type and Qt::MouseButton. We use this extra data when processing mouse events in QGuiApplication. This actually is similar to KeyEvent, where we do pass the type (press or release) to QtGui. - Refactors QGuiApplicationPrivate::processMouseEvent and qtestlib to use the new APIs. Task-number: QTBUG-59277 Task-number: QTBUG-62329 Task-number: QTBUG-63467 Change-Id: If94fd46a7cccfea8264dcb1368804c73334558b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | QTestLib: flush DeferredDelete events between every testDavid Faure2017-10-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes qtestlib behave more like real Qt applications with an event loop, where exiting the application does indeed flush deleteLaters. And since every test method is supposed to be independent from other test methods, we should even cleanup between tests. For "app less" tests, no flushing happens. Real life use cases: * A unittest for some code (e.g. KIO job) which uses a socket, runs an event loop until the socket communication is done, and ends. However slotDisconnected() does, as recommended, socket->deleteLater(). So the test finishes before the socket has a chance to actually get deleted, and memory leak tools flag a memory leak, which doesn't actually happen outside the unittest. * Deleting a QWebEngineView with deleteLater is even worse than a memleak, it leads to an assert (from a global object destructor) in QtWebEngine if the view deletion hasn't actually been processed. Change-Id: I18fc822fd26988a0fa4e75313c1947fcaa7d9e56 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | | Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-09-266-31/+67
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qguiapplication.cpp src/platformsupport/input/libinput/qlibinputpointer.cpp src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h src/plugins/platforms/cocoa/qcocoawindow.h src/testlib/qtestsystem.h Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
| * | testlib: Add qWaitFor to wait for predicateTor Arne Vestbø2017-09-254-28/+64
| | | | | | | | | | | | | | | | | | | | | | | | 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.9' into 5.10Liang Qi2017-09-201-2/+0
| |\| | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/util/qcompleter.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmdisubwindow.cpp Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
| | * Testlib: Do not list unsupported optionChristian Stenger2017-09-131-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This option is listed when displaying the help of Quick tests, but was never actively supported as it had been removed before Qt5.0 was finally released. Change-Id: I4cdf8d86471ab72e289f27a07a5f04c0338bfdbd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>