summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* tst_QNetworkReply try stabilize autoDeleteReplies testsMårten Nordheim2022-04-291-2/+6
| | | | | | | | | | | | | | | | | | The http test data hasn't always been stable but for some reason it fails far more than usual. Originally the domain was a non-existing one, because it would then work on any machine (even if not in CI) and would finish() (with error) after failing to look up the domain in DNS. However, some machines in CI, for some reason, take too long to do this and end up failing the test. So, we change the URL to point to the network server in CI. This should, at the very least, finish quickly when running in CI. Pick-to: 6.3 6.2 5.15 Fixes: QTBUG-102952 Change-Id: I3b3f6fa23acf78fefdb69ff9ae7722f15e5f1736 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Implement support for '0b' prefix in toInt() etcMarc Mutz2022-04-281-4/+1
| | | | | | | | | | | | | | | | | | | | [ChangeLog][QtCore][QByteArray/QByteArrayView/QLatin1String/QString/QStringView] The string-to-integer conversion functions (toInt() etc) now support the 0b prefix for binary literals. That means that base = 0 will recognize 0b to mean base = 2 and an explicit base = 2 argument will make toInt() (etc) skip an optional 0b. [ChangeLog][QtCore][Important Behavior Changes] Due to the newly-introduced support for 0b (binary) prefixes in integer parsing, some strings that were previously rejected as invalid now parse as valid. E.g., Qt 6.3 with autodetected bases would have tried to parse "0b1" as an octal value and fail, whereas 6.4 will parse it as the binary literal and return 1. Fixes: QTBUG-85002 Change-Id: Id4eff72d63619080e5afece4d059b6ffd52f28c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Optimize the QPalette::resolve from the other paletteJiDe Zhang2022-04-281-0/+8
| | | | | | | | | If all the palette's colors are resolved, nothing needs to be done in QPalette::resolve(const QPalette &other). Change-Id: I1573cfa5b5cd1e7eb15f3242aff6ab92e9f8c84b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QHttp: Fix handling of redirect loaded from cacheMårten Nordheim2022-04-271-0/+59
| | | | | | | | | | | | | | | In some situations when loading a redirect from cache which would lead to a real request we would not emit the finished() signal because the replyFinished function has a pre-condition that the response did not originate from the cache. However, after the initial redirect was loaded from the cache we never unset the 'loadingFromCache' boolean, so it was still true after the request had been made to the real target. Pick-to: 6.2 6.3 5.15 Change-Id: I015a2ebae4af4bd17392182c3951e875a7b353c4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QNetworkReply: update decompress error message and handlingMårten Nordheim2022-04-272-3/+39
| | | | | | | | | | | The error message was quite vague since it would then not require any additional translations. However, in hindsight this was a mistake since now developers just thought their downloads were being corrupted. Pick-to: 6.2 6.3 Fixes: QTBUG-101942 Change-Id: Ie9af42510ca027d15248e5bcf21e836e709898d9 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* tst_qitemdelegate: make it more robustGiuseppe D'Angelo2022-04-271-2/+1
| | | | | | | | | Remove a processEvents() call followed by a QCOMPARE and turn it into a QTRY_COMPARE. Otherwise it seems to be randomly failing on Ubuntu 22.04. Change-Id: I3c1b9d55c857c79ffd36aeb98971db60267adace Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix qlocale_unix's handling of uiLanguages to take script into accountEdward Welbourne2022-04-271-0/+6
| | | | | | | | | | | | | | | Some languages have, in the same territory, locales for more than one script. In such cases, since we ignored the script, we got the one that is used by default, instead of the one actually asked for. Take the script into account. Added TODO comment in test listing the known examples of this; manually tested before and after the fix to verify the prior code was indeed getting it wrong and now does do it right. Change-Id: Iaf9201d6992bc39e6e9346ef8b7c69d418db7253 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Return more specific entries before less in QLocale::uiLanguages()Edward Welbourne2022-04-271-12/+12
| | | | | | | | | | | | | | | | | | The documentation overtly listed entries in this order but the code gave less specific entries before more specific (and the tests verified the same). This is now reversed. [ChangeLog][QtCore][QLocale] uiLanguages() now prefers more specific locale names over less specific ones, matching its own documentation, except where the system backend supplies them in some other order. This means a translation with the expected script and/or territory as well as language will be used in preference to a generic one for just the language, rather than only as a fall-back when the more generic one is missing. Fixes: QTBUG-102796 Change-Id: I3c7b3627afb51246df5a6ad0230e23b60af78071 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tests: Blacklist tst_QLocalSocket::threadedConnection on WindowsAlexandru Croitor2022-04-271-0/+3
| | | | | | | | | | | As well as processConnection. These tests cause flaky failures on Windows. Pick-to: 6.3 Task-number: QTBUG-102880 Change-Id: Ie4bfe2ef40ad44efcfd0d83711ce257d1244ecdc Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Don't declare type 'id' in the global namespace in a public headerTor Arne Vestbø2022-04-272-0/+77
| | | | | | | | | | | It's not necessary, and it breaks the qttools build (where we have a global variable named 'id'), and thus will most certainly build a lot of existing user code. Amends e47c22480fe84c100019cd92d0296f0dd2a7f3f1. Change-Id: I97a91c2cb23fdae65143cf14c81570cf88d529d5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* rhi: Make QRhiRenderTarget's rp getter functional with swapchainsLaszlo Agocs2022-04-261-0/+1
| | | | | | | | | | | | | | | | | swapchain->currentFrameRenderTarget()->renderPassDescriptor() is not functional at the moment, it returns null. This is because no backend ensures that the internal renderpass descriptor object is exposed via that getter in a QRhiSwapChainRenderTarget. Whereas in a QRhiTextureRenderTarget this would work by design because there the setter must be called by the user. Fix this up, providing better API symmetry, and also reducing the need to pass along QRhiRenderPassDescriptor objects seprately alongside a QRhiRenderTarget in some places, e.g. in Qt Quick. Change-Id: I42c4e9aaee3202c1d23bd093d840af80c5f8cd0f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Clear tst_QSettings of deprecation warningsEdward Welbourne2022-04-262-7/+5
| | | | | | | | | | | Assorted QMetaType and QVariant methods deprecated in Qt 6 were still in use - the deprecation warnings were suppressed by setting QT_DISABLE_DEPRECATED_BEFORE=0 - fix them and clear that suppression. Change-Id: I1aa8f45dcb5a18449b060b346c80ad70536896ab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSettings::testVariantTypes(): modernize list initializationsEdward Welbourne2022-04-261-10/+6
| | | | | Change-Id: Ia84cd7590f9bcc95a790efb1e1dab46ab368cd2d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Convert tst_QSettings::testVariantTypes()'s macro body into a lambdaEdward Welbourne2022-04-261-13/+18
| | | | | | | | | Retain the macro, so as to automate checking QTest::currentTestFailed() after return from the lambda. Change-Id: If5873a533224ea3b809cef02255642a7d071d642 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up tst_QSettings::testVariantTypes()Edward Welbourne2022-04-261-27/+26
| | | | | | | | | | | | | | | | | | | | | Give the macro and its parameters clearer names, wrap the macro body in do {...} while (0), use QCOMPARE() rather than QVERIFY()ing comparisons, convert the result type to QMetaType::Type rather than QVariant's deprecated equivalent, save one macro parameter by using decltype() on another. Simplify one check by pulling out a common sub-expression as a local variable. In the process, give the settings keys meaningful names rather than just "key" with a numeric suffix. Ideally this test would be reworked to be data-driven, instead of using macros, but the use of qvariant_cast<> to convert a read-back value, along with the variable type of the input value compared to the result of that cast, precludes this (as far as I can see). Change-Id: I4e083cd0dea14d723910873829352e15740006bd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rearrange tst_QSettings::testVariantTypes()Edward Welbourne2022-04-261-24/+24
| | | | | | | | | | | | Move the large block unrelated to the macro-driven parts to before the macro is defined. This makes it clearer that it has nothing to do with the macro-driven part of the test. This is, in any case, a more basic test of behavior, so may as well go first. Rename the tested key in the process. Change-Id: I783fcd812e36320e9bb9765bab3ec09b56d6e6e6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Remove two unused resource files from tst_qsettingsEdward Welbourne2022-04-264-8/+0
| | | | | | Change-Id: Ia54fa1ffa6e739496667d1486ee7e5658cd6a74f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Inline a shared data-driven test table in tst_QSettingsEdward Welbourne2022-04-261-88/+23
| | | | | | | | | | | Move its static populateWithFormats to before the class is declared and make the _data() methods that call it (including one that did so via another) inline so that we can see which are this simple - and thus which aren't. Change-Id: I71863244ba0e4bd188424b6a3f8d86d5d9f635a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up includes involving tst_qmetatype_common.hEdward Welbourne2022-04-263-13/+8
| | | | | | | | | | | The functions it defines depend on many many types in QtCore for which it did not have a #include; both files that included it thus had to pull in QtCore to compile. Put that #include where it belongs and clean out many specific QtCore includes that it makes redundant. Change-Id: Ie9d9ec325d4879d771cb14baecb06fecbdaf62c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* rhi: Add a feature flag for non-fill polygon modesLaszlo Agocs2022-04-221-1/+2
| | | | | | | | It's one thing that this is not part of OpenGL ES, but it is optional even with Vulkan, with some mobile GPUs not offering the feature at all. Change-Id: I4e2c6642eccb0793e69074b4b6eeb2b7cef3516e Reviewed-by: Christian Strømme <christian.stromme@qt.io>
* Add support for unwrapping QFuture<QFuture<T>>Sona Kurazyan2022-04-211-0/+267
| | | | | | | | | | | | | | | | Added QFuture::unwrap() for unwrapping the future nested inside QFuture<QFuture<T>>. QTBUG-86725 suggests doing the unwrapping automatically inside .then(), but this will change the return type of .then() that used to return QFuture<QFuture<T>> and might cause SC breaks. Apart from that, QFuture::unwrap() might be helpful in general, for asynchronous computations that return a nested QFuture. [ChangeLog][QtCore][QFuture] Added QFuture::unwrap() for unwrapping the future nested inside QFuture<QFuture<T>>. Task-number: QTBUG-86725 Change-Id: I8886743aca261dca46f62d9dfcaead4a141d3dc4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* tst_QNetworkProxyFactory cleanup genericSystemProxy skippingMårten Nordheim2022-04-211-10/+5
| | | | | | | | | Instead of having Q_UNUSED and QSKIP in the test itself, we just skip in the _data function. Change-Id: I9da3d3104ec25e2645e5770e6392bd46958da072 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QApplication: deliver activation events for non-widget windowsRichard Moe Gustavsen2022-04-211-0/+48
| | | | | | | | | | | | | | | | | | Problem: if you create a hybrid Widgets and Quick Controls application, you would need to use QApplication rather than QGuiApplication. But in that case, the QQuickWindows would never receive window activation events from QApplication. And this causes problems for controls, since, for example, the palettes in use there will never update upon activation changes, and instead sometimes get stuck as e.g QPalette::Inactive after application startup. This patch will make sure that we send out activation events also for QWindows that are not QWidgetWindows. Pick-to: 6.3 6.2 Change-Id: I649f5c653081c0c5249f4faf28a7de2c92f17421 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QDockWidget parenting and dock permissionsAxel Spoerl2022-04-193-2/+603
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check DockWidgetArea permissions of QDockWidgetGroupWindows with single dock widget. Obtain a dock widget's tab position from a dock widget group window if it can't be established otherwise. Remove hardcoded assumption that a dock widget is in the left dock. Both cases have lead to inconsistent entries and dangling pointers in QDockAreaLayoutInfo::item_list. Remove warning: QMainWindowLayout::tabPosition called with out-of-bounds value '0', which becomes obsolete by the fix. Create a QDockWidgetGroup window prepered to become a floating tab, whenever a dock widget is being hovered over. Store it in item_list so it can be found and deleted when required. No longer call e->ignore() after propagating close events to the first dock widget and thus preventing others from receiving the event. Add logging category qt.widgets.dockwidgets Update dock widget autotest with tests to check the fixes mentioned: plugging, unplugging, hiding, showing, closing and deleting. Blackist closeAndDelete, floatingTabs test on macos, QEMU, arm, android due to flaky isFloating() response after a dock widget has been closed or plugged. QSKIP dockPermissions and floatingTabs test on Windows due to mouse simulation malfunction. QSKIP hideAndShow test on Linux in case of xcb error (QTBUG-82059) Fixes: QTBUG-99136 Pick-to: 6.3 6.2 Change-Id: Ibd353e0acc9831a0d67c9f682429ab46b94bdbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* wasm: add fps counter to the rasterwindow testMorten Sørvig2022-04-192-0/+9
| | | | | | Change-Id: Iddda72287119bc3ee6495d746ac75d64ff0c2f2c Reviewed-by: Lorn Potter <lorn.potter@gmail.com> Reviewed-by: David Skoland <david.skoland@qt.io>
* tst_qstringapisymmetry: check toInt() etc also with base != 0Marc Mutz2022-04-171-0/+119
| | | | | | | | | | | This shows we're lacking support for the 0b prefix, and, as it turns out, there's a request for it. Task-number: QTBUG-85002 Pick-to: 6.3 Change-Id: Ie201c84bf906a7e482b929301699ceb429b53c14 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* QDate(Time): add a addDuration methodGiuseppe D'Angelo2022-04-142-14/+27
| | | | | | | | | | | | | | | | To complement the existing addSecs / MSecs / etc., add a function that takes any compatible std::chrono::duration. QTime also features similar functions, but it's also "unique" in that it uses modular arithmetic (it wraps around in case of "overflow"). I'm not so sure that adding durations to a QTime object therefore makes sense, and I'm not doing it in this patch. [ChangeLog][QtCore][QDate] Added addDuration(). [ChangeLog][QtCore][QDateTime] Added addDuration(). Change-Id: I02aa37ff024d7f56fa976dc8f4f73523bdba8d94 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QFutureCallOutEvent: de-export againMarc Mutz2022-04-141-1/+7
| | | | | | | | | | | | A previous commit Q_CORE_EXPORTed this class so it could be used in tst_qevent. But we can also keep it Q_AUTOTEST_EXPORTed and make the testing of the class subject to QT_BUILD_INTERNAL on the test side. That's what this patch does. Change-Id: I9bd5f80ada856b7db4b39dfb59b32bd825416c13 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QEvent: start to de-inline copy ctor and clone() of all subclassesMarc Mutz2022-04-142-2/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's no advantage to them being inline: Absent de-virtualisation, clone() is only supposed to be called through the vtable, and the copy ctor is only supposed to be used in the implementation of clone(). And when the compiler de-virtualises, we don't want the code duplication associated with inlining. Enforce this by introducing new macros to hide the boilerplate. This fixes missing out-of-line dtors in: - QSinglePointEvent - QApplicationStateChangeEvent - QFutureCallOutEvent Wrong covariant return in: - QFutureCallOutEvent And missing clone() reimplementations in: - QCloseEvent - QIconDragEvent - QShowEvent - QHideEvent - QDragEnterEvent - QDragLeaveEvent While these don't carry extra data or members, a dynamic_cast of the result of clone() as well as using the expected covariant return value would fail: QShowEvent *e = ~~~; QShowEvent *e2 = e->clone(); // ERROR: converting QEvent* to QShowEvent* Check that reimplementing clone() is binary compatible (covariant returns may change the numerical pointer value returned, cf. https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B). The copy-assignment operator stays inline for the time being, as the goal is to = delete it in the future. This patch covers, roughly, QtCore and QtGui. [ChangeLog][QtGui][QEvent subclasses] Fixed missing clone() reimplementations on QCloseEvent, QIconDragEvent, QShowEvent, QHideEvent, QDragEnterEvent, and QDragLeaveEvent. Task-number: QTBUG-45582 Task-number: QTBUG-97601 Change-Id: Ib8a0519dbe85a7a8da61050d48be338004dfa69a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime: add conversions for time_point and zoned_timeGiuseppe D'Angelo2022-04-131-0/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C++20, QDateTime is a direct equivalent of a sys_time<milliseconds> time point. (Before, it might not have been, because system_clock before C++20 was not guaranteed to be tracking Unix time, AKA UTC time without leap seconds.) To be specific, sys_time<milliseconds> corresponds to a QDateTime using the Qt::UTC timespec. This patch: 1) adds named constructors taking time_points: * a generic one taking any time_point convertible (via clock_cast) to a system_clock (this obviously includes system_clock, but also e.g. utc_clock) * another couple taking local_time, interpreted as a duration from 1/1/1970 in local time. 2) adds a named constructor from zoned_time (i.e. a sys_time + a timezone), that we can easily support via QTimeZone. 3) add conversion functions towards sys_time, matching the existing to(M)SecsSinceEpoch() functions. [ChangeLog][QtCore][QDateTime] QDateTime can now be constructed from std::chrono::time_point objects (including local_time), as well as from std::chrono::zoned_time objects. Moreover, they can be converted to std::chrono::time_point using system_clock as their clock. Change-Id: Ic6409bde43bc3e745d9df6257e0a77157472352d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDate: add conversions for std::chrono calendaring classesGiuseppe D'Angelo2022-04-131-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | std::chrono::year_month_day and related classes offer very convenient to specify dates. This patch adds implicit constructors to QDate to support this convenience, e.g.: // YYYY-MM-DD, DD-MM-YYYY, MM-DD-YYYY formats: QDate d1 = 1985y / December / 8; QDate d2 = 8d / December / 1985; QDate d3 = December / 8d / 1985; // Indexed weekday: QDate d4 = 2000y / January / Monday[0]; QDate d5 = 2000y / January / Monday[last]; and so on. These are all implemented using the conversion from the std calendaring classes to sys_days. Conversions between sys_days and QDate are also added, since they're basically "for free". I don't expect "ordinary" users to stumble upon it, but it's worthy mentioning that std::chrono::year *does* have a year zero (hence, year_month_day in year 0 or below are offset by one with the corresponding QDate). I've left a note in the documentation. [ChangeLog][QtCore][QDate] QDate (and therefore QDateTime) is now constructible using the year/month/day/week classes available in the std::chrono library. Moreover, it now features conversions from and to std::chrono::sys_days. Change-Id: I2a4f56423ac7d1469541cbb6a278a65b48878b4a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractProxyModel: do not access invalid indexesGiuseppe D'Angelo2022-04-131-0/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractProxyModel::headerData tries to do the "smart" thing and map sections in the proxy to sections in the source. However there's no "mapSectionToSource" virtual. Instead, to map horizontal headers, the code builds a proxy index at row 0 and section N, maps it to the source, and finds out which source column it gets mapped to. (Same story for the vertical headers). ... in general this can obviously fail, say you've got a "horizontal scrambling" proxy model, but in the common case this is OK. Except, if the proxy is empty (e.g. 0 rows or columns). In this case, it asks for an illegal index, and if you reimplemented index() yourself (which you must, since it's a pure virtual in QAPM) and you do bounds checking, you'll not be pleased at the result. This turns out to be a massive API liability. To fix this somehow properly, we can decide that empty models don't get the section remapped (easy). Less easy is the fact that, when the model does get some data, we have to emit headerDataChanged() otherwise the views will get broken. So add this logic too. Note that QAPM does not normally forward any source model's signal -- a subclass has to connect to them and handle them explicitly. That's *another* API liability, all over the place -- data(), headerData(), flags(), etc. What I mean by this is that one can create a valid QAPM (by implementing its pure virtuals) that however is immediately broken by the convenience that QAPM provides for the rest (data(), headerData(), etc.). This commit doesn't try and change this in any way, but I'm less and less convinced of the usefulness of QAPM in its current shape. Change-Id: I45a8c2139f2c1917ffbf429910fdb92f005f4feb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Faure <david.faure@kdab.com>
* QVarLengthArray: add missing (size, value) ctorMarc Mutz2022-04-131-0/+12
| | | | | | | | | | | Extend the corresponding test in tst_containerapisymmetry. [ChangeLog][QtCore][QVarLengthArray] Added (size, value) constructor. Fixes: QTBUG-102469 Change-Id: I4802eebe6ba1a6835e4d6f41e1d3db2a0d7c7894 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QDateTime: add support for std::chrono::duration arithmeticGiuseppe D'Angelo2022-04-131-1/+20
| | | | | | | | | | | | | | | | | | | QDateTime represents a specific point in time, so arithmetic with durations makes perfect sense. Moreover, we can finally equip QDateTime with a subtraction operator, to calculate the duration between two QDateTime objects. [ChangeLog][QtCore][QDateTime] QDateTime now supports arithmetic between QDateTime objects and std::chrono::duration objects. A duration can be added to or subtracted from a QDateTime, yielding another QDateTime; and two QDateTime objects can be subtracted from each other, yielding the duration between them. Change-Id: I656419f3bb9418c49f0e2fd0800c3dbaaf6aff32 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* wasm: make rasterwindow use non-deprecated APIMorten Johan Sørvig2022-04-121-3/+3
| | | | | | Pick-to: 6.3 Change-Id: I17f2c9517cb8b8e7103fc40068580f953ceb6aff Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
* QTimeZone: add construction from std::chrono::time_zone*Giuseppe D'Angelo2022-04-121-0/+48
| | | | | | | | | | | A time_zone represents a timezone identified by its IANA ID. This allows for a straightforward conversion to QTimeZone. [ChangeLog][QtCore][QTimeZone] QTimeZone can now be constructed from a std::chrono::time_zone pointer. Change-Id: I093d9fc2e989475d30730a9dcdef491903a2aeb2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Skip test that fails with Address Sanitizer enabledDimitrios Apostolou2022-04-121-0/+7
| | | | | | | | | | | | | | These particular testcases request huge buffers from malloc() .This is intentional and the test expects malloc() to return NULL. Address sanitizer catches this and considers it a problem. Could also be skipped in runtime by setting the environment variable: ASAN_OPTIONS=allocator_may_return_null=1 Task-number: QTBUG-89400 Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qsslsocket: remove tons of deprecation warningsMarc Mutz2022-04-121-65/+78
| | | | | | | | | | | | | | | | | The TLS v1.0 and v1.1 enums are all deprecated since 6.3. At the same time, the test requires their use, because none of the peers seeem to implement TLS v1.2, yet (cf. e.g. QTQAINFRA-4499). Fix by copying the relevant enum values into global variables and using those. This is a selective way to deal with the issue. The use of the enums is so widespread in the test that the alternative would have been to globally suppress deprecation warnings, which, however, may suppress warnings we may actually want to fix. Pick-to: 6.3 Change-Id: I4186be72209527fc404f3ba0a5a15f9719c64698 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Ensure that readAllStandardError() doesn't crash on assertJarek Kobus2022-04-091-0/+10
| | | | | | | | | | | Ensure that it's safe to call readAllStandardError() when process channel mode is set to MergedChannels. Pick-to: 6.3 6.3.0 Task-number: QTBUG-102177 Task-number: QTCREATORBUG-27196 Change-Id: I01073255d9347dee4654d602802a12d341372b73 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* xcb: get geometry correctly for rotation with RAndR 1.5Liang Qi2022-04-081-0/+60
| | | | | | | | xcb_randr_get_crtc_info() returns already rotated size. Pick-to: 6.3 Change-Id: I33eacf988b44cea77411ad79ae24fef7e8e1564e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: compare with screen name instead of old monitor infoLiang Qi2022-04-081-1/+1
| | | | | | | | | because the old xcb_randr_monitor_info_t was invalid very often during update. Pick-to: 6.3 Change-Id: I8c0bda93bde4e816fc98cde1a7205c6369ab39e1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Android: use BCP 47 tag to create a correct Locale for QTimeZone::displayName()Ivan Solovev2022-04-081-0/+52
| | | | | | | | | | | | | | | | | | Before the patch we tried to create a java Locale object by passing the human-readable language, territory and variant strings. However, the Locale constructor accepts ISO-defined codes. Fix it by using a factory method Locale.forLanguageTag() [0] that constructs a Java Locale object based on BCP 47 tag. [0]: https://developer.android.com/reference/java/util/Locale#forLanguageTag(java.lang.String) Fixes: QTBUG-101460 Pick-to: 6.3 6.2 5.15 Change-Id: If414c66cf0e5b7e8299ffc3a6038b6f9eb79d5ec Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
* Fix assertion failure when parsing a doubly-invalid date-time textEdward Welbourne2022-04-071-1/+14
| | | | | | | | | | | | | | | | | | | | | | | When the date-time string falls in a spring-forward (so is invalid) and one of the fields of the parsed string doesn't match the format it's meant to (e.g. a single-digit seconds field when format ss was specified), a check that the current fall-back date-time is between the minimum and maximum for the parser object failed, triggering an assertion. In any case, an invalid default-value wasn't useful to the code that parsed a single section of the date-time string, so brute-force the current value to a valid date-time (when possible) using the usual round-trip via milliseconds since the epoch. Added the test-case which first revealed the problem, plus a couple more informed by it, to exercise the same code-paths with fewer things failing. Fixes: QTBUG-102199 Pick-to: 6.3 6.2 5.15 Change-Id: I658308614505ef25f4c97d0de6148acb54a65a0f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Don't use QSKIP() when merely eliding part of a testEdward Welbourne2022-04-071-25/+23
| | | | | | | | | | | | | | | | | Use of QSKIP() means the whole test is skipped; when all applicable parts of a test have passed and some part of the test is inapplicable, merely report that it is skipped, rather than discarding the PASS for all the parts that do work. In the process, eliminate a spurious layer of indentation; the earlier test only needed a scope to contain its declaration, a goal adequately achieved by the scope of the if constexpr block. Task-number: QTBUG-99123 Pick-to: 6.2 6.3 Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tst_QTcpSocket: remove redundant includeTimur Pocheptsov2022-04-071-4/+0
| | | | | | | | ... a leftover from the initial patch-set not required in the one that merged. Change-Id: I0c5e94d8a0409faf4f7f9a354e98e239f7186da3 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Replace uses of _qba with _baSona Kurazyan2022-04-072-4/+6
| | | | | | | Task-number: QTBUG-101408 Change-Id: I5175428c2be934b09f45bd06b0b47643003e25c7 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Replace uses of _qs with _s in testsSona Kurazyan2022-04-0723-99/+142
| | | | | | Task-number: QTBUG-101408 Change-Id: If092a68828a1e8056259cf90d035d9a87989244b Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* CI: Blacklist failing networks tests for QNX qemuPasi Petäjäjärvi2022-04-073-0/+29
| | | | | | | | | | | | | Most likely related to qemu network configuration which cannot be modified. Reason is that in QNX there is tool which can be controlled qemu configuration, and it does not provide options for more finer grade network configuration. Pick-to: 6.2 6.3 Task-number: QTBUG-101274 Change-Id: I660466e36252e902a2314fb3f4988c531cda9214 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Add literal operators for QString/QByteArray to StringLiterals namespaceSona Kurazyan2022-04-072-30/+80
| | | | | | | | | | | | [ChangeLog][QtCore] Added literal operators for _s and _ba for QString and QByteArray respectively in the Qt::Literals::StringLiterals namespace. Task-number: QTBUG-101408 Change-Id: I5cd4e7f36f614ea805cfecc27b91c5d981cd3794 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Q[Multi]Hash: fix squeeze()Ivan Solovev2022-04-061-1/+94
| | | | | | | | | | | | | | | | | | | When calling QHash::reserve(), or when creating the internal QHashPrivate::Data structure, the value 0 for the size parameter is reserved for performing the squeeze operation. However commit 8a984ab772dd194e39094e728b869e65912912a7 broke it, by using the 0 value in QHashPrivate::Data constructors as a mark that no resizing needs to be done. This patch reverts the problematic commit (also applying some later fixes to the code), and adds the missing tests for Q[Multi]Hash::squeeze(). Pick-to: 6.3 6.2 Change-Id: Id644df7b2beb008e6a37b2c89b709adfbd893e25 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>