summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
Commit message (Collapse)AuthorAgeFilesLines
* Fix warning about discarded return value in QTranslator testVolker Hilsheimer2020-09-171-13/+13
| | | | | | | | Use QVERIFY in test functions, and (void)tr.load outside. Change-Id: I18d2eb3aeaf00f9f2bbe75d0a2d8b12569b541e1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Deprecate implicit QPixmap conversion to QBitmapVolker Hilsheimer2020-09-171-1/+1
| | | | | | | | | | | | | | | | It is lossy, so should be requested explicitly, using a dedicated fromPixmap factory function. Deprecate the constructor and assignment operator, and make the constructor explicit. [ChangeLog][QtGui][QBitmap] Implicitly constructing and assigning to a QBitmap from a QPixmap has been deprecated, and the respective constructor has been made explicit. Use the fromPixmap factory function instead. Change-Id: I68ce85b26c901415137b664a1db687021d48bae0 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Normalize roundingAllan Sandfeld Jensen2020-09-161-1/+1
| | | | | | | | Change the rounding of negative half values to match standard C++ round, this will also allow future optimizations. Change-Id: I8f8c71bed1f05891e82ea787c6bc284297de9c5c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QEventDispatcherWin32: create internal window on constructionAlex Trotsenko2020-09-162-0/+43
| | | | | | | | | | | | | | | | | When QCoreApplication object is instantiated, creation of the internal message window is delayed until QEventDispatcherWin32::processEvents() is called or socket/event notifier is registered. But, if the user uses a native event loop, posted events are not delivered and timers do not work. This problem was fixed in a4ac4b326318ed9034466305222280ed8d1651b5 for QWindowsGuiEventDispatcher in the same way. So, the risk of regression is minimal. Change-Id: I7bbb721d96046f64d21a7b0e553e46798b37189c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Use qint64 for value of that type in tst_QDateTime millisecond testsEdward Welbourne2020-09-151-71/+91
| | | | | | | | | | | | The test was previously using int; I shall be wanting to add tests that exercise the bounds of qint64. Clean up the layout of the test-row additions in the process of making a trivial change to them all. Also const the QFETCH() types so we catch any use of non-const methods on the values fetched. Change-Id: I4b0187de71f5f14b39b4eabe8afd12a196f73d23 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix tst_QElapsedTimer::elapsed() flaky testJarek Kobus2020-09-151-11/+23
| | | | | | | | | | | | | | | Instead of using imprecise QTest::qSleep() to estimate the elapsed time, we trigger a single shot PreciseTimer and gather all the data in lambda. We wait for lambda to be executed - we give it twice as much time as is in theory needed. Afterwards we verify all the data collected in lambda. Task-number: QTBUG-82903 Change-Id: I0147b7cd2aaf4bf58a216caff167d2db8712541a Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* CMake: Fix building with -DQT_FEATURE_gui=OFFAlex Richardson2020-09-1523-29/+161
| | | | | | | | | | Some CMake files currently assume that QtGui is always enabled and we get a configure-time failure without these changes. Task-number: QTBUG-86053 Change-Id: I28e32c180c32221f32519017bac6b518a19d5983 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add a QMetaAssociationUlf Hermann2020-09-152-27/+288
| | | | | | | | | | This requires refactoring of QMetaSequence, as they share a lot of common functionality. QMetaAssociation provides a low level interface to an associative container. Task-number: QTBUG-81716 Change-Id: I273e00abd82f1549ba8803c323d82aa3a2d12ded Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tests: fix json test for AndroidAssam Boudjelthia2020-09-152-3/+2
| | | | | | | | | test.bjon file doesn't exist, however, it's still included in json.qrc. That causes the test to fail on Android because it's using that resource file. Change-Id: I1e93076069073a1a621459a7d90aec5c0c03f768 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Tests: fix qlogging build fail for AndroidAssam Boudjelthia2020-09-151-7/+6
| | | | | | | | | The macro BACKTRACE_HELPER_NAME is defined inside a block with #ifdef __GLIBC__ which is not defined on Android, thus causing the test to fail on Android. Change-Id: I55e9b3e3bae2da182481239ad88107c36e3bd438 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Blacklist tst_QTimeLine::interpolation on Windows in generalMitch Curtis2020-09-151-1/+1
| | | | | | Task-number: QTBUG-61037 Change-Id: Ie44c7355e2aefbbd16cef95f1a093302bd789e45 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Use UTF-8 when converting 8 bit data in QTextStreamLars Knoll2020-09-152-3/+11
| | | | | | | | | This was overlooked when doing the conversion to use UTF-8 as the standard 8 bit encoding for text. Fixes: QTBUG-54942 Change-Id: Ib7b1b75b4d694648ab7143f6930b6bb1dcad19c9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove deprecated APILars Knoll2020-09-151-4/+4
| | | | | | | And replace it's few remaining usages Change-Id: I2dfbbaa5259acfece028606bef1e872c5692f9fe Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove the SAX parser from QtXmlLars Knoll2020-09-151-1/+0
| | | | | | | | It has been deprecated and will live in qt5compat from now on. Fixes: QTBUG-86480 Change-Id: I3744c7cee058d51d0fce633a174ab1a0f9235d2c Reviewed-by: Karsten Heimrich <karsten.heimrich@qt.io>
* Trim trailing 0s from QTime construction, where neither use nor ornamentEdward Welbourne2020-09-151-153/+153
| | | | | | | | The seconds and milliseconds default to 0; so omit them when they're zero, unless there's nearby code that contrasts nicely with them. Change-Id: Iea049015e976f5a5209fe87a2cbfdae9de49a559 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add qHash implementation for QPointMitch Curtis2020-09-151-0/+3
| | | | | | | | | [ChangeLog][QtCore][QPoint] Added qHash() implementation. Change-Id: I65332e7aafab53af40a6e11457b9b457196d584c Fixes: QTBUG-86457 Reviewed-by: Thorbjørn Lindeijer <bjorn@lindeijer.nl> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Purge Q_{STDLIB,COMPILER}_UNICODE_STRINGSEdward Welbourne2020-09-145-40/+4
| | | | | | | | | These were now always defined, hence redundant. Leave the #define in place so that we can verify we actually do always define it, in a #else of an existing #if check on it. Change-Id: Iea4c3dbc8f9982268bcf81da5ef17fe2ebf5c462 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use default-constructed QTime() where QTime(0, 0) is intendedEdward Welbourne2020-09-141-35/+43
| | | | | | | | | | QTime() is invalid. Only the seconds and milliseconds are optional, for valid times. Use startOfDay() for zoned times, QTime(0, 0) for fixed-offset ones. Change-Id: I3b65d5c3733ac83dc3a6c214859c3f56a480bb94 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove some unused private methods and replace anotherEdward Welbourne2020-09-141-90/+90
| | | | | | | | | | | | | Nothing used defDateTime(), nothing but it used defTime(). The only other use of defDate() were from one test, which might as well make it a local variable. QDateTime's default is invalid, making invalidDateTime() redundant, and the invalidDate() and invalidTime() it called had no other users. Change-Id: I0e07ee58478bfe8ba680eafb52e2f73a962edd33 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix compiler warnings about missing overridesLars Knoll2020-09-132-2/+2
| | | | | Change-Id: I52bf9fe45607f4a99cafa441bd78dfe5f7adb0e1 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>
* Remap QMetaType ids to create more space for builtin typesLars Knoll2020-09-121-1/+1
| | | | | | | | | | | We were starting to run out of space for builtin core types. Remap the type id's to create lots of additional space. We now reserve the first 64k id's for Qt, and have 16k id's for Qt Core. That should hopfully be enough for a while ;-) Fixes: QTBUG-85914 Change-Id: I0dab6bf23652e46a9557d9b38af7990b68c572b6 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* cmake: Re-enable qcoreapplication and qtimer testsTor Arne Vestbø2020-09-124-2/+95
| | | | | | | | They were disabled in ad0e3e26fabe0574889c5cf3a26a145a7f5d9c98, but that was probably accidental. Change-Id: Ia9cbccfbeecfe84768c3465f5699ed44b7f932a5 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Provide methods for adding values to a sequential iterableUlf Hermann2020-09-122-9/+22
| | | | | | | | | | | Provide functionality to add and remove values, so that you can use a sequential iterable as stack or queue if the underlying container supports this. To this end, provide a way to specify whether the value should be added or removed at the beginning or the end of the iterable. Change-Id: If63d302f3ca085e56d601116ce4dfaa6b94a0c4f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QMetaContainer: Add an "input" iterator capabilityUlf Hermann2020-09-121-2/+4
| | | | | | | | | For completeness' sake we should expose this. The iterators provided by QIterable and friends will check the category at runtime, and should give sensible feedback. Change-Id: I778894f340c862f79a18c6c5607bcbba98dd7598 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* [QtCore] Fix QDateTime unit test: time zone of system was usedAndreas Buhr2020-09-111-10/+9
| | | | | | | | | | | | | | | | Test data for QDateTime unit tests was constructed in system's local time, which made unit test outcome dependent on the time zone of the system running the tests. This led to failing unit tests on systems with libc6 version 2.31 or newer. A QDateTime in a timezone, which has daylight saving time, was created and then used in Hawaii's time zone,which has no daylight saving time. Newer glibc checks this and returns errors. This patch changes the behavior to create the test data in a specified time zone setting. Task-number: QTBUG-80441 Change-Id: I0330b647fa011be99141dde09001ff2d58bd3a5f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fix warnings coming from using the deprecated overload of qCheckSumLars Knoll2020-09-111-2/+2
| | | | | | | Change-Id: I719c2d56a690fd245d3917045de4005f118c688b Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Revert "Remove timeStep parameter from QAnimationDrive::advanceAnimation"Lars Knoll2020-09-111-2/+2
| | | | | | | | | | This reverts commit f51b690e91bb2d7c8a03c5cef42abca37d97f8bb. The commit made all animation tests in qtdeclarative on macOS flaky. Change-Id: I4ccaa879df7e2ba7e253657de01cbabc9b2c655f Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Rename QMetaSequence's "elements" to "values"Ulf Hermann2020-09-112-45/+45
| | | | | | | | | | This is so that they are in line with the "value_type" usually found in containers. Associative containers have "key_type" and "mapped_type" and we will use those names for access to elements in QMetaAssociation. Using "value" as name for sequential containers improves consistency. Change-Id: I628b7e1446bb2d56843b843bca72d279a6b247e6 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* [QtCore] QDateTime: switch from newRow to addRow in unit testsAndreas Buhr2020-09-111-4/+4
| | | | | | | | | Instead of doing string formating first and then using QTest::newRow, we can do both at the same time using QTest::addRow Change-Id: Ia5c90eb705a806e37b96a1fa174a6557f91bee6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* [QtCore] Adapt QDateTime unit tests to use QByteArrayAndreas Buhr2020-09-111-8/+8
| | | | | | | | | | | To not have to bother with encodings, a few QStrings are changed to QByteArrays. This way, a few calls to QString::fromLatin1 and to QString::toLocal8Bit can be removed Change-Id: Ia0cf27fc2a86f9842ed0f3ebe47b050bb8a3f4e6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Remove most compiler warnings about missing overridesLars Knoll2020-09-1153-304/+317
| | | | | | | | | | | | Remove around 1000 compiler warnings about missing overrides in our auto tests. This significantly reduce the compiler warning noise in our auto tests, so that one can actually better see the real problems inbetween. Change-Id: Id0c04dba43fcaf55d8cd2b5c6697358857c31bf9 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QTimer::remainingTime(): get rid of QTest::currentTestFailed()Jarek Kobus2020-09-101-8/+11
| | | | | | | | | | | | | Looks this is redundant in fact and unneeded. The check can never be evaluated to true, since if so, it would mean it had failed in the previous iteration, in which we already handled the exit from the loop. Fixed also some comments. Task-number: QTBUG-83419 Change-Id: I4fe56bfac39cd58b1166967f3ccb80cdff882748 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Introduce QProcess::startCommand(QString, OpenMode)Joerg Bornemann2020-09-101-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The removal of the QProcess::start(QString, OpenMode) leads to more porting work than anticipated. A call like QProcess p; p.start(cmdline); must be transformed in the following cumbersome way: QProcess p; QStringList args = QProcess::splitCommand(cmdline); QString program = args.takeFirst(); p.start(program, args); This patch revives QProcess::start(QString, OpenMode) and renames it to QProcess::startCommand. This is still source-incompatible, but the transformation is much simpler: QProcess p; p.startCommand(cmdline); [ChangeLog][QtCore][QProcess] Added QProcess::startCommand(QString, OpenMode) as replacement for the removed QProcess::start(QString, OpenMode). Change-Id: I5499bbb39a025e115042c43a4cc63affddae585c Reviewed-by: hjk <hjk@qt.io>
* Remove '\0' space reservation logic in QStringAndrei Golubev2020-09-101-1/+2
| | | | | | | | | Changed QString to use implicit element reserved by QArrayData Task-number: QTBUG-84320 Change-Id: If517500b3f0e71bb8d2989c64815a634aa8dd554 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Adapt QDate unit tests to not take into account system localeAndreas Buhr2020-09-101-14/+13
| | | | | | | | | | | | QDate was changed to consistently use the C local in serialization and parsing in git commit 5ba66c5622e9e0da87a5037399b375d7e8cee554. This commit reflects this change in the unit tests. Task-number: QTBUG-80441 Change-Id: Ib21a215ef0e36c9eaa2c161b92c6877a50ae6f06 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Fix possible corner cases in qarraydataops.hAndrei Golubev2020-09-101-4/+217
| | | | | | | | | | | | | | | Updated moveNonPod function to behave correctly under exceptions being thrown. This is the version that was implemented at some point but then got changed prior to merge. Added tests for moveInGrowthDirection (which uses moveNonPod in general case) to verify that range movements are correctly done Updated QCommonArrayOps access modifier from private to protected to allow testing of internal stuff by subclassing Task-number: QTBUG-84320 Change-Id: Idb994a72ee601762e32248670cdc7819aaca0088 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Make Q*ArrayOps erase aligned with std::vector::eraseAndrei Golubev2020-09-101-11/+7
| | | | | | | | | | | Scoped GrowsBackwards-optimized erase to only be applied when erase starts at the beginning of the element range. In other cases, old "left-shifting" erase is used to align with std::vector::erase invalidation policy Task-number: QTBUG-84320 Change-Id: I2e7f3b96b056bc371119eb2d36cc7c74af52c394 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix flaky QTimer::remainingTime() testJarek Kobus2020-09-101-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we used not so accurate QTest::qWait(50) to measure the accuracy of more precise timer's interval. In addition, the checked range for remainingTime (50, 200) was probably wrong, since by definition it couldn't be more than 150, as we started the timer with interval of 200 and waited at least 50. In this fix we have additional "tester" timer to measure remainingTime of "tested" timer. The "tester" is a singleShot timer with interval of 50, and is started together with "tested" timer. Whenever the "tested" timer timeouts, it restarts the "tester" timer - this is done desired number of times (2 by default, like in the original test). The test itself lies now inside tester's lambda. We fix the tested range (at least 1, no more than 150). The minimum value could in theory be greater, but it's enough to test that it's not overdue. Finally, we wait for expected number of test runs. We give it twice as much time as is in theory needed. Task-number: QTBUG-83419 Task-number: QTBUG-58519 Change-Id: I43836d787d804f22bb66515ebb215d040189c4f3 Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QProcess/Unix: introduce setChildProcessModifier()Thiago Macieira2020-09-082-43/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][Source-Incompatible Changes] QProcess::setupChildProcess() was removed. To execute code in a child process, use QProcess::setChildProcessModifier() [ChangeLog][QtCore][QProcess] Added setChildProcessModifier() function with which one can provide code to be run in the Unix child process between fork() and execve(). With this function, it is no longer necessary to derive from QProcess in order to execute actions in the child process. Another reason is that we can tell whether the std::function carries a valid target much more easily than we can tell whether QProcess was overridden. The setupChildProcess() virtual function does not need to be marked final, since no overrider could ever return an inaccessible private class. This also makes sure the error presented to the user is about the return type, not about attempting to override a final. Clang: error: virtual function 'f' has a different return type ('void') than the function it overrides (which has return type 'QProcess::Use_setChildProcessModifier_Instead') GCC: error: conflicting return type specified for 'virtual void MyProcess::setupChildProcess()' note: overridden function is 'virtual QProcess::Use_setChildProcessModifier_Instead QProcess::setupChildProcess()' ICC: error: return type is neither identical to nor covariant with return type "QProcess::Use_setChildProcessModifier_Instead" of overridden virtual function "QProcess::setupChildProcess" MSVC is not relevant since it doesn't compile to Unix. Change-Id: Ia8b65350cd5d49debca9fffd15f801161363aea7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Fix failures in tst_qdatetime under non-english localesMarcel Krems2020-09-091-2/+2
| | | | | | | | | QDateTime::toString uses the C locale since 5ba66c5622e9e0da87a5037399b375d7e8cee554 So don't expect locale specific day- and month-names. Task-number: QTBUG-80441 Change-Id: I08f53b6b33ed9e7eaaa58df4ca6a966c4ba9ef24 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Deliver Quit event when calling QCoreApplication::quit()Tor Arne Vestbø2020-09-072-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of QCoreApplication::quit() directly calling exit(0), which would leave QGuiApplication and client code out of the loop, we now send the Quit event, and let it pass through event delivery, before finally ending up in QCoreApplication::event(), where we call exit(0). This has the advantage that QGuiApplication can ensure all windows are closed before quitting, and if any of those windows ignore the close event the quit will be aborted. This aligns the behavior of synthetic quits via QCoreApplication::quit() with spontaneous quits from the platform via QGuiApplicationPrivate::processApplicationTermination. Clients who wish to exit the application without any event delivery or potential user interaction can call the lower level exit() function directly. [ChangeLog][QtGui] Application termination via qApp->quit() will now deliver Quit events to the application, which in turn will result in application windows being closed as part of the application quit, with an option to cancel the application quit by ignoring the close event. Clients who explicitly want to exit the application without any user interaction should call QCoreApplication::exit() explicitly. Task-number: QTBUG-45262 Task-number: QTBUG-33235 Task-number: QTBUG-72013 Task-number: QTBUG-59782 Change-Id: Id4b3907e329b9ecfd936fe9a5f8a70cb66b76bb7 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Clean up QTextBoundaryFinder and qunicodetoolsLars Knoll2020-09-071-2/+0
| | | | | | | | | | | Make QTBF ready for Qt6 by using qsizetype in the API and use QStringView where it makes sense. Change the exported API of qunicodetools to use QStringView as well and use char16_t internally. Change-Id: I853537bcabf40546a8e60fdf2ee7d751bc371761 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Round float->qfloat16 to evenAllan Sandfeld Jensen2020-09-061-2/+68
| | | | | | | | Calibrated to match F16C and ARM-FP16 hardware conversions. Change-Id: I3bdd4d3db3046fee4aeb24e4ce8b9bc9a06e0397 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Get rid of hasPendingEvents() and flush()Lars Knoll2020-09-062-8/+0
| | | | | | | They are unused. Change-Id: I77383f2be45551401ed9c2f88285511134cc8b0d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Make test pass on machines with many coresLars Knoll2020-09-051-1/+1
| | | | | | | | | | Just starting 20 threads to test this won't cut it if the machine you're testing on has an ideal thread count of 16 or larger. Change-Id: Icba8f00aa836fec6da41c71b318e9e17bdd47c0e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Fix flaky QFutureWatcher::startFinish() testJarek Kobus2020-09-031-11/+22
| | | | | | | | | | | | | | | | | | Since waiting for a spy employs polling, it may happen that while waiting for a startedSpy we had received already a signal for finishedSpy. This explains current flakiness. The fix is to connect to lambdas instead and update the hit count accordingly. Inside lambdas we also ensure the correct order for started / finised signals. After waitForFinished() unblocks we ensure that possible pending asynchronous signals (started / finished) are processed and check the final state. Task-number: QTBUG-83076 Change-Id: I16963ef9c011cb613d7b409d3e3032303a942336 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove timeStep parameter from QAnimationDrive::advanceAnimationVolker Hilsheimer2020-09-031-2/+2
| | | | | | | | | | | | | | Addresses ### Qt 6 comment, and documentation pointing out that the parameter value is ignored. It wasn't ignored in the code, but that's the kind of change we can make now. With this change, QUnifiedTimer::updateAnimationTimers is only called with -1 as the currentTick input parameter, also from Qt Declarative. Make it default, so that leaf modules can be fixed. Once that it done, the parameter can be removed completely. Change-Id: I80c57ff92f3b615b932dd73d711cf6397347efd8 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Reimplement QSequentialIterable using QMetaSequenceUlf Hermann2020-09-032-33/+50
| | | | | Change-Id: Ie721a5f0caa697c4bf15a81f3762cf79d3c54f5a Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Long live QKeyCombination!Giuseppe D'Angelo2020-09-036-0/+335
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>