summaryrefslogtreecommitdiffstats
path: root/src/testlib
Commit message (Collapse)AuthorAgeFilesLines
* Remove two obsolete #definesLars Knoll2020-09-061-5/+0
| | | | | Change-Id: Icc13408cfdb8ce0db6f274904c3e44f8376cd1e5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | C++20 via P1120 is deprecating arithmetic operations between unrelated enumeration types, and GCC 10 is already complaining. Hence, these operations might become illegal in C++23 or C++26 at the latest. A case of this that affects Qt is in key combinations: a QKeySequence can be constructed by summing / ORing modifiers and a key, for instance: Qt::CTRL + Qt::Key_A Qt::SHIFT | Qt::CTRL | Qt::Key_G (recommended, see below) The problem is that the modifiers and the key belong to different enumerations (and there's 2 enumerations for the modifier, and one for the key). To solve this: add a dedicated class to represent a combination of keys, and operators between those enumerations to build instances of this class. I would've simply defined operator|, but again docs and pre-existing code use operator+ as well, so added both to at least tackle simple cases (modifier + key). Multiple modifiers create a problem: operator+ between them yields int, not the corresponding flags type (because operator+ is not overloaded for this use case): Qt::CTRL + Qt::SHIFT + Qt::Key_A \__________________/ / int / \______________/ int Not only this loses track of the datatypes involved, but it would also then "add" the key (with NO warnings, now its int + enum, so it's not mixing enums!) and yielding int again. I don't want to special-case this; the point of the class is that int is the wrong datatype. Everything works just fine when using operator| instead: Qt::CTRL | Qt::SHIFT | Qt::Key_A \__________________/ / Qt::Modifiers / \______________/ QKeyCombination So I'm defining operator+ so that the simple cases still work, but also deprecating it. Port some code around Qt to the new class. In certain cases, it's a huge win for clarity. In some others, I've just added the necessary casts to make it still compile without warnings, without attempting refactorings. [ChangeLog][QtCore][QKeyCombination] New class to represent a combination of a key and zero or more modifiers, to be used when defining shortcuts or similar. [ChangeLog][Potentially Source-Incompatible Changes] A keyboard modifier (such as Qt::CTRL, Qt::AltModifier, etc.) should be combined with a key (such as Qt::Key_A, Qt::Key_F1, etc.) by using operator|, not operator+. The result is now an object of type QKeyCombination, that stores the key and the modifiers. Change-Id: I657a3a328232f059023fff69c5031ee31cc91dd6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix gcc warning about possible call of printf with nullptrVolker Hilsheimer2020-09-021-2/+6
| | | | | | | | | | Amends fe4794f70ecc4a302b22ad26614203a70c049a13 Depending on the types, the generic QTest::toString version might be used, which returns nullptr. Change-Id: Ic60675057181629d1cf9cb22e7508d57c026a0ad Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deprecate and remove uses of AA_DisableHighDpiScalingTor Arne Vestbø2020-08-312-3/+2
| | | | | | Change-Id: Ibadce68775858c524b998aacad310905ba2c2e8e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Deprecate and remove all uses of AA_UseHighDpiPixmapsTor Arne Vestbø2020-08-311-1/+0
| | | | | | | High-DPI pixmaps are always enabled, and cannot be disabled. Change-Id: I01a006b404e5431582b64ef812974c1c022b39ae Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use build-system to declare tests that are low-DPITor Arne Vestbø2020-08-281-0/+5
| | | | | Change-Id: I6da7204683b3c46232cfc542ed5e28131a82e87d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate int based convert/canConvertLars Knoll2020-08-241-1/+1
| | | | | | | Better to provide the correct meta type to convert to. Change-Id: I8e0d46e4ba482186201c157e302c03874bd38e7b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Deprecate the static int based API in QMetaTypeLars Knoll2020-08-243-7/+7
| | | | | | | | | | | | | And remove one of the type id to name mapping that still existed in QMetaType. QMetaTypeInterface can provide that, so there's no need to have a second copy of the data. qMetaTypeTypeInternal() can still map all the names of all builtin types to ids. That functionality is for now still required by moc and can't be removed yet. Change-Id: Ib4f8e9c71e1e7d99d52da9e44477c9a1f1805e57 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Doc: Mention no_testcase_installs which can be used to prevent installAndy Shaw2020-08-202-0/+9
| | | | | | | Change-Id: If8044a339cab754d427fd7626dd6813c7cc99e56 Pick-to: 5.15 5.12 Fixes: QTBUG-85827 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* CMake: Re-implement configure/qmake's command line handling in CMakeJoerg Bornemann2020-08-171-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | We extend configurejson2cmake to read the "commandline" information from configure.json. This data is then translated to CMake function calls and written it into commandline.cmake files. We extend QtProcessConfigureArgs.cmake to pick up those commandline.cmake files to feed our command line handling code, which is a re-implementation of the command line handling in qt_configure.prf. The command line handler sets INPUT_xxx variables, similar to configure/qmake's config.input.xxx variables. The INPUT_xxx values are translated - to -DFEATURE_xxx=ON/OFF arguments if the input represents a feature, - to corresponding CMake variables if such a variable is known, - or to -DINPUT_xxx=yyy CMake arguments. Configure arguments that have an entry in cmake/configure-cmake-mapping.md are actually implemented. Other arguments are likely to need more work. Task-number: QTBUG-85373 Change-Id: Ia96baa673fc1fb88e73ba05a1afb473aa074b37d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove QVariant(int type, void *data, ...) constructorLars Knoll2020-08-152-2/+2
| | | | | | | | It was marked internal anyway. Use the constructor taking a QMetaType instead. Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QCborValue: add support for QCOMPARE string outputThiago Macieira2020-08-121-3/+142
| | | | | | Change-Id: Ibdc95e9af7bd456a94ecfffd16066c47ea9766d0 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CMake: Properly handle CONFIG += thread aka Threads::ThreadsAlexandru Croitor2020-08-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mkspecs/features/qt.prf adds a dependency on the system threading library if the Qt Core thread feature is enabled. Because qt.prf is loaded by any public or internal Qt project, it's essentially a public dependency for any Qt consumer. To mimic that in CMake, we check if the thread feature is enabled, and and set the Threads::Threads library as a dependency of Qt6::Platform, which is a public target used by all Qt modules and plugins and Qt consumers. We also need to create a Qt6Dependencies.cmake file so we find_package(Threads) every time find_package(Qt6) is called. For the .prl files to be usable, we have to filter out some CMake implementation specific directory separator tokens 'CMAKE_DIRECTORY_ID_SEP' aka '::@', which are added because we call target_link_libraries() with a target created in a different scope (I think). As a result of this change, we shouldn't have to hardcode Threads::Threads in other projects, because it's now a global public dependency. Task-number: QTBUG-85801 Task-number: QTBUG-85877 Change-Id: Ib5d662c43b28e63f7da49d3bd77d0ad751220b31 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
* Fix build of testlib doc snippetsTor Arne Vestbø2020-07-291-2/+1
| | | | | | | | The file src_qtestlib_qtestcase was built twice, causing duplicate main symbols Change-Id: I18750b87eee27603d9f56129fd6c30fddf4a4828 Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* testlib: Set AA_UseHighDpiPixmaps false for low-DPI testsTor Arne Vestbø2020-07-241-0/+8
| | | | | Change-Id: I129118c303527e4aff25c4d5326eefa43c231d44 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* testlib: Add start time and test duration to JUnit XMLTor Arne Vestbø2020-07-243-2/+16
| | | | | | | As defined by https://llg.cubic.org/docs/junit/ Change-Id: Ic7683f3d49c529674f8467d591528d4a65d3add8 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* testlib: Output JUnitXML attributes in right orderTor Arne Vestbø2020-07-241-7/+12
| | | | | | | | | | | | | | | | | | The attributes are, like the elements, maintained in reverse order in the underlying QTestCoreList, so we need to iterate them backwards when printing out the resulting XML to reflect the order they were added. This results in e.g.: <testcase name="passingBenchmark" result="pass"> Instead of: <testcase result="pass" name="passingBenchmark"> Change-Id: Ic2eeab8de05ffedd0c41977358d5b40ff77878b1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* testlib: Track current test suite in JUnit test loggerTor Arne Vestbø2020-07-222-27/+32
| | | | | | | | | Instead of deferring the creation of the test suite until logging stops, we create it up front, matching the logic of adding test elements on test function enter. Change-Id: I78b1ccdfde5493d78ef478d4b3c45d5a49358979 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* testlib: Explicitly name watchdog timer threadTor Arne Vestbø2020-07-221-0/+1
| | | | | | | Simplifies debugging of issues where the watchdog thread is involved. Change-Id: I4862167bca4a942c7d4319a9374f1f83f292d831 Reviewed-by: Simon Hausmann <hausmann@gmail.com>
* testlib: Defer signal dumper start until tests are ready to runTor Arne Vestbø2020-07-223-3/+18
| | | | | | | | | | | | | | | We don't want the signal dumper to pick up signals that our own test machinery produces, such as the ones emitted from the watchdog thread startup and shutdown. This would otherwise produce: tst_Signaldumper::initTestCase() Signal: QThread(7fc969e0d870) started () At startup, and at shutdown even more confusingly: tst_Signaldumper::UnknownTestFunc() Signal: QThread(7fc969e0d870) finished () Change-Id: I9e81fa168eaa92551d38d5576973bbf95ac23364 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QTestlib: Enable comparing QList against initializer lists/arraysFriedemann Kleint2020-07-213-20/+88
| | | | | | | | | | | | | | | | | | | | | It is unnecessary to create a QList container just for comparison. Split out helpers for comparing sequence sizes and sequences from qCompare(QList) and add a template for an array with a non-type template parameter for the size. One can then write something like: const int expected[] = {10, 12,...}; QCOMPARE(QFontDatabase.pointSizes(...), expected) Unfortunately, any commas in such an array will be misread by macro expansion as macro argument separators, so any expected array with more than one entry needs an extra macro expanding __VA_ARGS__. Change-Id: Ie7c8dc20bf669bbb25f6d7f8562455f8d03968c8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Refactor pointer event hierarchyShawn Rutledge2020-07-102-45/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some goals that have hopefully been achieved are: - make QPointerEvent and QEventPoint resemble their Qt Quick counterparts to such an extent that we can remove those wrappers and go back to delivering the original events in Qt Quick - make QEventPoint much smaller than QTouchEvent::TouchPoint, with no pimpl - remove most public setters - reduce the usage of complex constructors that take many arguments - don't repeat ourselves: move accessors and storage upwards rather than having redundant ones in subclasses - standardize the set of accessors in QPointerEvent - maintain source compatibility as much as possible: do not require modifying event-handling code in any QWidget subclass To avoid public setters we now introduce a few QMutable* subclasses. This is a bit like the Builder pattern except that it doesn't involve constructing a separate disposable object: the main event type can be cast to the mutable type at any time to enable modifications, iff the code is linked with gui-private. Therefore event classes can have less-"complete" constructors, because internal Qt code can use setters the same way it could use the ones in QTouchEvent before; and the event classes don't need many friends. Even some read-accessors can be kept private unless we are sure we want to expose them. Task-number: QTBUG-46266 Fixes: QTBUG-72173 Change-Id: I740e4e40165b7bc41223d38b200bbc2b403e07b6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOSTor Arne Vestbø2020-07-081-1/+1
| | | | | Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Use QList instead of QVector in qtbaseJarek Kobus2020-07-073-14/+13
| | | | | | | | Fixes all other QVector occurrences Task-number: QTBUG-84469 Change-Id: I5f9311298d341a9a3061a6a640539583d1618939 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Help qtestlib with int -> qsizetype changesLars Knoll2020-07-061-2/+17
| | | | | | | | | | | | | | | Make sure we can handle qsizetype as an integer when appending test data. This is required for backwards compatibility with Qt 5, so people don't have to rewrite all their test cases. QCOMPARE can handle mixed types, tthe only method that requires manual changes now is QTEST(list.size(), "testrow_expecting_int"). Change-Id: I40723b239e0160cefc05745aa35a75de8599ac08 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Remove unnecessary ; after function implementationsLars Schmertmann2020-07-061-1/+1
| | | | | | Task-number: QTBUG-82978 Change-Id: Iea3bcaec1ef9f4bd0f73e5dccca33354650f5bf4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Cleanup qtestspontaneevent.h for Qt 6Lars Schmertmann2020-07-061-41/+0
| | | | | | | | | This change is motivated by the comment from bc087db59: Qt 6: remove everything except QSpontaneKeyEvent::setSpontaneous() Task-number: QTBUG-82978 Change-Id: I5f46ca366c193c06235f88022ec22c6848fbb7b0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Use Q_DECL_UNUSED_MEMBER instead of Q_UNUSEDLars Schmertmann2020-07-061-23/+19
| | | | | | | Task-number: QTBUG-82978 Change-Id: I7ff71e10b61cf5c2528ebef81cc49c648385fc33 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Only use one macro per lineLars Schmertmann2020-07-031-2/+6
| | | | | | | | | Also add a ; where it is missing. Task-number: QTBUG-82978 Change-Id: Ic5d2a07363c25ab641d234baca89bc62238458cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* CMake: Add "cmake" keyword for test blacklistingAlexandru Croitor2020-07-012-1/+9
| | | | | | | | | | | | | | Certain tests fail only on CMake configurations. We need the capability to ignore these failures, without removing the qmake-built-Qt coverage for now. The keyword is enabled when Qt is built with CMake. So it doesn't matter if the final test is built with CMake or qmake. Task-number: QTBUG-85364 Change-Id: I157fe3d9254b589ef1e84022c01f4487ff834d27 Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Doc: Update docs with cmake package informationNico Vertriest2020-06-301-0/+1
| | | | | | Task-number: QTBUG-85179 Change-Id: I70dda9b906ecd0b8d8f4d88b0562af8e6c428143 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Use QList instead of QVector in testlibJarek Kobus2020-06-253-6/+6
| | | | | | Task-number: QTBUG-84469 Change-Id: Icbc3c3130399296f6b5a7e9a313ad4737669de00 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Port Q_STATIC_ASSERT(_X) to static_assertGiuseppe D'Angelo2020-06-191-2/+2
| | | | | | | | | | | | | | | | | There is no reason for keep using our macro now that we have C++17. The macro itself is left in for the moment being, as well as its detection logic, because it's needed for C code (not everything supports C11 yet). A few more cleanups will arrive in the next few patches. Note that this is a mere search/replace; some places were using double braces to work around the presence of commas in a macro, no attempt has been done to fix those. tst_qglobal had just some minor changes to keep testing the macro. Change-Id: I1c1c397d9f3e63db3338842bf350c9069ea57639 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Introduce QInputDevice hierarchy; replace QTouchDeviceShawn Rutledge2020-06-162-14/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have seen during the Qt 5 series that QMouseEvent::source() does not provide enough information: if it is synthesized, it could have come from any device for which mouse events are synthesized, not only from a touchscreen. By providing in every QInputEvent as complete information about the actual source device as possible, we will enable very fine-tuned behavior in the object that handles each event. Further, we would like to support multiple keyboards, pointing devices, and named groups of devices that are known as "seats" in Wayland. In Qt 5, QPA plugins registered each touchscreen as it was discovered. Now we extend this pattern to all input devices. This new requirement can be implemented gradually; for now, if a QTWSI input event is received wtihout a device pointer, a default "core" device will be created on-the-fly, and a warning emitted. In Qt 5, QTouchEvent::TouchPoint::id() was forced to be unique even when multiple devices were in use simultaneously. Now that each event identifies the device it came from, this hack is no longer needed. A stub of the new QPointerEvent is added; it will be developed further in subsequent patches. [ChangeLog][QtGui][QInputEvent] Every QInputEvent now carries a pointer to an instance of QInputDevice, or the subclass QPointingDevice in case of mouse, touch and tablet events. Each platform plugin is expected to create the device instances, register them, and provide valid pointers with all input events. If this is not done, warnings are emitted and default devices are created as necessary. When the device has accurate information, it provides the opportunity to fine-tune behavior depending on device type and capabilities: for example if a QMouseEvent is synthesized from a touchscreen, the recipient can see which touchscreen it came from. Each device also has a seatName to distinguish users on multi-user windowing systems. Touchpoint IDs are no longer unique on their own, but the combination of ID and device is. Fixes: QTBUG-46412 Fixes: QTBUG-72167 Task-number: QTBUG-69433 Task-number: QTBUG-52430 Change-Id: I933fb2b86182efa722037b7a33e404c5daf5292a Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port testlib from QStringRef to QStringViewLars Knoll2020-06-112-2/+2
| | | | | | Task-number: QTBUG-84319 Change-Id: I780945c8923c0a03e9c0a32d039da0c793f650fd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Long live std::pair!Giuseppe D'Angelo2020-06-101-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make QPair an alias for std::pair, and qMakePair just a forwarder towards std::make_pair. Why? Fundamentally to ditch a bunch of NIH code; gain for free structured bindings, std::tuple and std::reference_wrapper compatibility, and so on. Breakages: * Some that code manually forward declares QPair. We don't care about it (<QContainerFwd> is the proper way). * Some code that overloads on std::pair and QPair. Luckily it's mostly centralized: debug, metatypes, testing macros. Just remove the QPair overload. * Usages of qMakePair forcing the template type parameters. There are a handful of these in qtbase, but only one was actually broken. * std::pair is NOT (and will never likely be) trivially copiable. This is agreed to be a mistake done by practically all implementations in C++11, can can't be fixed without breaking ABI. Some code using QPair assuming it's trivially copiable may break; exactly one occurrence was in qtbase. * QMetaType logic extracts the type names in two different ways, one by looking at the source code string (e.g. extracted by moc) and one via some ad-hoc reflection in C++. We need to make "QPair" (as spelled in the source code) be the same as "std::pair" (gathered via reflection, which will see through the alias) when compared. The way it's already done e.g. for QList is by actually replacing the moc-extracted name with the name of the actual type used in C++; do the same here. On libc++, std::pair is actually in an inline namespace -- i.e. std::__1::pair; the reflection will extract and store "std::__1::pair" so we need an ad-hoc fix to QMetaType. [ChangeLog][QtCore][QPair] QPair is now an alias to std::pair, and does not exist as a class in Qt any more. This may break code such as functions overloaded for both QPair and std::pair. Usually, the overload taking a QPair can be safely discarded, leaving only the one taking a std::pair. QPair API has not changed, and qMakePair is still available for compatibility (although new code is encouraged to use std::pair and std::make_pair directly instead). Change-Id: I7725c751bf23946cde577b1406e86a336c0a3dcf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove winrtOliver Wolff2020-06-062-15/+6
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Doc: Fix issues with Qt Test documentation configurationTopi Reinio2020-05-281-2/+2
| | | | | | | | Remove '/' as an example directory. We do not want to retrieve the directory tree of the entire system. Change-Id: I1caa7ef659dfe326515a4d81193682dacb373856 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Never include windows.h directly in Qt codeLars Knoll2020-05-271-1/+1
| | | | | | | Please use qt_windows.h instead, so we avoid having min/max defined. Change-Id: Ic1b29666c427bf24556da5494af45ee5953ae827 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Document how to use CMake for Qt TestLibKai Koehne2020-05-265-30/+19
| | | | | | Task-number: QTBUG-73058 Change-Id: I6e29a83a1346ea0d2f94fcf445e1de9c07072aa6 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Licenses: Remove reference to change in Qt 5.4Kai Koehne2020-05-221-3/+2
| | | | | | | Qt 5.4 is not documented anymore since quite some time. Change-Id: I6811ead502178f7acbed8cf450e42d7fd33ae29b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* cmake: QTestCase: enable threading supportFabian Kosmale2020-05-151-0/+1
| | | | | Change-Id: I55a9b57172659ae420890556e55810bf7f4a725c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Close memory leak in QTestLib support for item model testingVolker Hilsheimer2020-05-121-4/+14
| | | | | | | | | | | | QTest::toString allocates memory by calling qstrdup; that memory must be freed by the caller. Change-Id: I218bc57b3312fdd9195fb49eaed7d20df4bf717c Fixes: QTBUG-84081 Coverity-Id: 186979 Covierty-Id: 186980 Pick-to: 5.15 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QTest::ignoreMessage(): interpret the message in UTF-8Edward Welbourne2020-05-081-2/+2
| | | | | | | | | | | | The message to ignore is given in source code, hence UTF-8; it was being ingested as local 8-bit, which lead to problems when a debug message wasn't 7-bit clean and the system's native encoding wasn't UTF-8. Modified QtTest's selftest to check encoding failure. Pick-to: 5.15 Change-Id: I898744a450115b6d2ee992f1d3b36d8efaeeff7e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Enable warnings-are-errors also for snippetsKai Koehne2020-05-071-0/+2
| | | | | | Pick-to: 5.15 Change-Id: I6b3645924e4f090c7887ce0d6296a71dc8f8159d Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Snippets: Fix dependency issuesKai Koehne2020-05-071-3/+0
| | | | | | | | | | | | | | | | The widget snippet was sometimes ignored, because the printsupport dependency was not explicit in the top-level src.pro file. This lead to a situation that, if printsupport by chance was already built, it was tested, otherwise silently ignored. This shows that having requires(qtHaveModule()) inside src/ is actually harmful, and they are therefore removed from snippets.pro. Also, the dependencies for the snippets projects are now moved to a central place so that the correctness is easier to check. Pick-to: 5.15 Change-Id: Ice051fa04848040e206c78361fbbcf680383c6b2 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-051-0/+3
|\ | | | | | | Change-Id: I003c0d6271c6444748bf30b4331eca3fb2410f44
| * Doc: Fix compilation of testlib snippets if sql, widgets are missingKai Koehne2020-05-051-0/+3
| | | | | | | | | | Change-Id: Ibcc872408ba829085809737004d9d3186bd20bab Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devQt Forward Merge Bot2020-05-043-18/+22
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/text/qlocale.cpp src/network/access/qnetworkaccessmanager.cpp Regenerated tests/auto/testlib/selftests/float/CMakeLists.txt Change-Id: I5a8ae42511380ca49a38b13c6fa8a3c5df8bed01
| * QCOMPARE: treat values as equal if qFuzzyIsNull(each)Edward Welbourne2020-04-302-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We hope this shall avoid some flaky failures noticed in quick tests, e.g. tst_QQuickMenu::Material::subMenuPosition(cascading,flip) was recently seen failing with 3.88e-11 != 0. This required some revision to test data in the testlib selftest for floats; the resulting expected output differs in details but not in which tests pass or fail. QEMU, naturally, made life difficult, requiring special-case code in the test-driver. [ChangeLog][QtTestLib][QCOMPARE] QCOMPARE() now treats its values as equal when qFuzzyIsNull() is true for both of them. Change-Id: Icc6ad5164b609937eddbe39cc69120f0abf0f3b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>