summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
...
* QJsonDocument: fix comparison of valid vs defaultThiago Macieira2020-08-121-0/+61
| | | | | | | | | | | | [ChangeLog][QtCore][QJsonDocument] Fixed a bug that caused QJsonDocument's equality operator to crash if one of the operands was default-constructed and the other wasn't. Fixes: QTBUG-85969 Change-Id: I5e00996d7f4b4a10bc98fffd1629f835f570ef6b Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io> (cherry picked from commit e790af0e0a030dea597bbc9489170b5ba1cf9e46) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QSharedPointer: do allow calling deleters on null pointersThiago Macieira2020-07-311-2/+31
| | | | | | | | | | | | | | I don't know why std::shared_ptr allows this, but why not. [ChangeLog][Important Behavior Changes] QSharedPointer objects will now call custom deleters even when the pointer being tracked was null. This behavior is the same as std::shared_ptr. Fixes: QTBUG-85285 Change-Id: I24006db8360041f598c5fffd161c260df0313b55 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> (cherry picked from commit 95afe6b244dbd9623a92399d1bed0b9f52aa1e65) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QNAM: Remove network connectivity pre-checkMårten Nordheim2020-07-301-9/+0
| | | | | | | | | | | | | | | | | | | | The connectivity pre-check has been around for a long time, and it has caused various issues in that time. Certain scenarios, like using certain VPN configurations, might confuse the OS into thinking you don't have and network connectivity at all and abort the connection. Especially noticeable/frustrating when the connection was going to a host inside the local network. The negative impact of this change would at worst be that we might try to connect and it will wait some amount of time before the OS tells us the connection failed in situations where it would previously have been aborted before it started. But the false-negatives are not really an OK sacrifice in that case. Fixes: QTBUG-84907 Change-Id: I37fc69051e39df3c1a1fecb56ef54521a4d3d0c3 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit a0bfa4e1f8e223927cbb285bb17d1a00a5c2d4b6)
* Make qfloat16 helper functions consistent with float/double versionsAllan Sandfeld Jensen2020-07-281-1/+1
| | | | | | | | | | | Infinite is only when the mantissa is 0, everything else is NaN. std::isnormal returns false on zero. Change-Id: I897fc0dc3b8a9c557bb1922ea7ca8df501e91859 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit d782df48612a932f03a579c889670d34c26e9574) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix buffer overflow in XBM parserAllan Sandfeld Jensen2020-07-241-0/+38
| | | | | | | | | | | | | | Avoid parsing over the buffer limit, or interpreting non-hex as hex. This still leaves parsing of lines longer than 300 chars unreliable Change-Id: I1c57a7e530c4380f6f9040b2ec729ccd7dc7a5fb Reviewed-by: Robert Loehning <robert.loehning@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit c562c1fc19629fb505acd0f6380604840b634211) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QPluginLoader: Fix MachO stub testsTor Arne Vestbø2020-07-222-5/+12
| | | | | | | | | The -arch_blank argument to lipo is no longer supported. Change-Id: I47efcb3633f23b7a18d66211bc16d5c9dbc067c8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 15a5d1996fff52e50bb2d0f768f459990b266531) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ensure styles always get to polish the application paletteTor Arne Vestbø2020-07-212-0/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before 0a93db4d82c051164923a10e4382b12de9049b45 we would polish the application palette even when it was the default palette, as we always recreated the system palette each time a style was set. After the change we skipped polishing the palette unless it was set by the user, under the assumption that the style would set its own default palette if it wanted to override the system palette. This turned out to break the style's ability to slightly tweak the palette via polish (versus the more full on standardPalette approach). We now polish both the default palette and user palettes, and we do so as part of the normal palette update logic. This ensures that the style also gets a chance to polish the palette when the platform theme changes. The polish will not have an effect on the resolve mask of the palette, as the polish is conceptually the same as a base palette, and should not affect e.g. Qt::AA_SetPalette. Fixes: QTBUG-85469 Fixes: QTBUG-85188 Change-Id: I869e9c442b177de4f1dc49eb75220709306f4d12 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 0bf120f5fd197cd215cd9520a494b162887d1ec4) Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Deprecate QTimeLine's curveShape in favor of its easingCurveEdward Welbourne2020-07-161-11/+11
| | | | | | | | | | | | | | | QEasingCurve has a richer variety of curves and curveShape was already implemented by changing the easingCurve property. [ChangeLog][QtCore][QTimeLine] Deprecated QTimeLine's curveShape property in favor of the easingCurve property. Change-Id: I7261c0f24d7e02bc94624f0b74d699df62de1a52 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io> (cherry picked from commit d6502614d0f04695bdb362778ecfc0dbc0b3de21) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Check returns of hex2int in get_hex_rgbRobert Loehning2020-07-151-0/+3
| | | | | | | | | | | Avoids undefined behavior when trying to shift negative values. Fixes: oss-fuzz-21860 Fixes: oss-fuzz-23968 Change-Id: I879c97624e3f8ba9cf01e0a3a682379cd8c4a199 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3094bcc3c5a30635289f534884965d39ac35a11a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Tests: Use QVERIFY instead of QCOMPARE for empty listsFriedemann Kleint2020-07-148-15/+15
| | | | | | Change-Id: I4da02fa11583eca3844bf42efcdf818b8bbd6a94 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> (cherry picked from commit 773a6bffd78b363577d27604e17f4ee08ff07e77)
* Fix passing QDBusUnixFileDescriptors over peer-to-peer connectionsSteffen Kieß2020-07-131-2/+3
| | | | | | | | | | | | | | | | | | | | Passing QDBusUnixFileDescriptors over peer-to-peer connections currently does not work, because QDBusConnectionPrivate::setPeer() does not set this->capabilities (unlike QDBusConnectionPrivate::setConnection() which is executed for bus connections). Keep track of whether the connection already has been authenticated, and once the connection does get authenticated, update this->capabilities. Note that sending a message directly after connecting (before any message has been received from the peer) might still fail if the message contains a QDBusUnixFileDescriptor. Fixes: QTBUG-85396 Change-Id: Ib83213ebcd3255fb091c6faefb3618745b8d736c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6d880185b1483b4efb3e358815060537d91b0de4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix buffer overflowRobert Loehning2020-07-102-0/+9
| | | | | | | | Fixes: oss-fuzz-23988 Change-Id: I4efdbfc3c0a96917c0c8224642896088ade99f35 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e80be8a43da78b9544f12fbac47e92c7f1f64366) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix floating point clip rectangle rounding in raster and opengl paint engineJani Hautakangas2020-07-082-0/+106
| | | | | | | Fixes: QTBUG-83229 Change-Id: If94028f27c9085e391acb9c423cde1b7c12bca36 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit d9cc1499954829faf9486fb72056e29f1bad58e3)
* Export the letter and word spacing settings set on the default formatAndy Shaw2020-07-072-0/+73
| | | | | | | | | | | | When the default format has letter and word spacing set then these should be exported in the HTML's body tag. This also adds support for the reading of letter-spacing and word-spacing set too, so that the same html outputted can be read back in. Fixes: QTBUG-83718 Change-Id: Ic4afca21eb05efb779dbf99c6b3c13373e851f15 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 96cea3b1681dd24a0ec3a53078b78f902e3211a6)
* Fix QUrl::toDisplayString(PreferLocalFile) returning an encoded pathDavid Faure2020-07-021-0/+28
| | | | | | | | | | | | | | It's supposed to return the same as toLocalFile(), for local files, which means passing QUrl::FullyDecoded just like QUrl::toLocalFile() does. But a few code paths were testing component formatting options without masking other FormattingOptions like RemovePassword, so this had to be fixed. Fixes: QTBUG-84594 Change-Id: I82f15148b6d93516200f9ad6258d474e7f10924a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit eb546469849d2bf560f41b14366832e1f8b22456)
* QTabBar: make sure the tab is repainted after releasing mouseWang Chuan2020-07-021-0/+38
| | | | | | | | | | | | | | The tab has to be repainted even f the mouse release event happened outside the tab bar, otherwise it will look like the tab is still pressed. As a drive-by, replace the repaint() call with update(); there is no need for synchronous painting in an event handler. Fixes: QTBUG-81637 Change-Id: Ia55182be906511ac3b462f00add8a621c6c05fc3 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c513b1214e38829e9bc23bb2ef948f5c388071a7)
* Fix delivery of MouseMove events to newly opened popup windowsVolker Hilsheimer2020-07-022-0/+189
| | | | | | | | | | | | | | | | | | | | | | | | | Amend d934fd7f54eae24ea3f719890e2c4dbbc445049d, which was too naive in assuming that any change to the popup stack while a popup had been pressed into should result in mouse move events to be delivered without buttons. Instead, add a new flag that is set explicitly when the qt_popup_down widget is closed, and remove buttons from the move move events only when that flag is set. Add the sorely missing test case as well, even if we have to accept that not all behavior can be tested reliably. Ie. on macOS, the simulated mouse event differs from the event we do get from the QPA plugin or the system; on Xcb, some of the behavior depends on the window manager. This is something we could try to clean up for Qt 6. Change-Id: Ibf0a0a6fb7d401915057365788947e5a35aa20c3 Fixes: QTBUG-84926 Task-number: QTBUG-82538 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Liang Qi <liang.qi@qt.io> (cherry picked from commit ab6861b01ff9c14fd1648cb725da17d1ebf3faea) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QCborMap: remove the optimization not to detach from non-const find()Thiago Macieira2020-06-301-0/+62
| | | | | | | | | | | | | | | | | | All our tests were find() == end() or !=, which depends on the evaluation order of the arguments to operator==(). If end() is called first, then the detach happens before find() and all is well. But if find() is called first, it may return end() before end() detaches. [ChangeLog][QCborMap] Fixed a bug that could cause the iterator returned from a failing key search with find() not to match end(). Now, every call to find() will detach in shared QCborMaps; to avoid this, use constFind() and constEnd(). Fixes: QTBUG-84583 Change-Id: I552d244076a447ab92d7fffd161793496a8d03a8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 727fab7d291d8d6e1b61a7faec4b4318f714d1e0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip proxy widgets that can't take focus when (back)tabbingVolker Hilsheimer2020-06-301-0/+46
| | | | | | | | | | | | | | | Fixes regression introduced in b4981f9d4ca914c6ecaa49bfdd69e51806a3671a, due to which it was possible to back-tab into a widget even though it or its focusProxy had a NoFocus policy. As a drive-by, split the complicated if-statement up a bit for improved readability. Change-Id: Ib0ac2604076e812e340b11534c23ae8ae958d082 Fixes: QTBUG-76924 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit 0dbd2dd86389c0705dbe9f518aed12f609ed09a1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Http: Fix POST-to-GET redirects still uploading or transmitting CLMårten Nordheim2020-06-301-1/+73
| | | | | | | | | | | | | | | CL = Content-Length The uploadByteDevice was kept after a redirect which caused the internals to assume that we had to upload the data. Even if this was not the case we still transmitted the Content-Length header from the first request which was now stored in two places. Fixes: QTBUG-84162 Change-Id: Ic86b1ef0766ffcc50beeed96c1c915b721d40209 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 306ebe03ea13c6e0ac8de46e46d0859384954567) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fuzzing: Add fuzz target for QCryptographicHash::resultRobert Loehning2020-06-292-0/+50
| | | | | | | | Change-Id: Ifc12358dd8cb932fe62c13975554d753a4f1afd9 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 873c09978814741d987ce54cbfa46d3688f29447) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix conversion of QVariant() in QJsonArrays and Objects (through CBOR)Thiago Macieira2020-06-242-3/+46
| | | | | | | | | | | | | | | | | | | | | | When I wrote the QCborValue to QJsonValue conversion, I used QJsonValue::Undefined because it allowed to keep some level of compatibility in CBOR, despite the function documentation saying that CBOR undefineds became JSON nulls. Which they did. But when we converted QJson{Array,Object} to be backed by CBOR classes, that Undefined meant the insertion into the array/object actually deleted the entry. [ChangeLog][JSON] Fixed a regression from 5.14 that caused values of default-constructed QVariants in QVariantLists, QVariantMaps and QVariantHashes to disappear when converting to JSON via fromVariant{,List,Map,Hash}. Fixes: QTBUG-84610 Change-Id: Ic0987177fe463f352db9bd84993f116e2bdacc75 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cb1c66bd204c12d848f47de6411d31edbafaf008) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Deprecate QByteArray's methods taking QStringSona Kurazyan2020-06-2413-13/+25
| | | | | | | Change-Id: I5aba5a91f288173c2d4f1bd3538191757abd3202 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Fuzzing: Test svg imagesRobert Loehning2020-06-221-0/+3
| | | | | | | Change-Id: I1467d07eaaa1233417cd3a18fd65ec3322181984 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> (cherry picked from commit 96065b722711d5cf42542bef65d80b25a627f23c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* long_name_onDemandCerts_member - stop testing/using the deprecated APITimur Pocheptsov2020-06-151-22/+0
| | | | | | | Change-Id: I3d7ea78627afcd0225e717d243da49fd70b58461 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit b7724048f9afa8b3c6bbb35f2eb71b766bb68f8c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fuzzing: Don't try to load huge valid imagesRobert Loehning2020-06-151-1/+10
| | | | | | | | | | They are justified in using huge memory. Change-Id: Id16d2ea67cfac0e031d05258173391e222b41097 Reviewed-by: Albert Astals Cid <albert.astals.cid@kdab.com> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 927a82f5e0d0e8a174cbb027c58412e13f7067c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_qsslcertificate - suppress a deprecation warningTimur Pocheptsov2020-06-121-0/+4
| | | | | | | | | | | | In Qt 5 we have to work with the esisting API (QSslCertificate::verify), taking only the peer's chain and the name. We already have a private API to have a CA's list as an additional parameter, the proper fix in Qt6 will also introduce a public complement for this. Change-Id: Ib1f75c3056b135c6e6d42f977b5a7034fca658ee Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 56187f1e457e5516e840db699ee4d254528be09a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* long_name_onDemandCerts_static - stop testing/using the deprecated APITimur Pocheptsov2020-06-121-25/+0
| | | | | | | Change-Id: Ia937fc393b2dbc2602a93f2b3a71328a805ec1a6 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8a65cd8dcdb08c18230de3b2c73b4d127d6e88c5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix breakage of QPushButton on macOS when a style sheet was setVolker Hilsheimer2020-06-111-0/+41
| | | | | | | | | | | | | | | | | | | | | | Amends comment 6e1d70ae12baae4610356ec7b69635ad75a97b4e, which introduced SE_PushButtonBevel so that QPushButton could ignore clicks outside of the button's bevel. In the macOS style, make sure that the framerect we pass to NSButton::alignmentRectForFrame is the rect we receive from QPushButton in the style options. The frame property of the shared NSButton* object might not be initialized. In the style sheet style, handle SE_PushButtonBevel the same ways as Contents and FocusRect, as it is not a separately styleable property. Change-Id: I12eb1b046c864a02b34d276e6352e2e16d44231e Fixes: QTBUG-84852 Fixes: QTBUG-84879 Task-number: QTBUG-81452 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> (cherry picked from commit f9940b15f7f0fde731431626172939b9821fd660) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Also check QStringView(std::nullptr_t) for constexpr'nessMarc Mutz2020-06-111-0/+8
| | | | | | | Change-Id: I85967caa014fa93d2cd3f26b63e4a85414f6a803 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c549ff3fd4e0ae770e6728f541db2a257d4eabd8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslSocket - stop using qrand (to suppress a warning)Timur Pocheptsov2020-06-101-7/+6
| | | | | | | | | | | | Whoever wrote this test, was a PROPER hacker: trying to force a TLS implementation not to properly compress some data, they generated a sequence of bytes in a very fancy manner, something like 255 0 0 0 255 0 0 0 123 0 0 0 255 0 0 0 - yeah, it's really a random sequence of bytes, surely, it's impossible to compress! Meh. Change-Id: Ia10ae18a40b5b8f006c45147b06fe5be6efcb129 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 7d989648151c577c1706ca85acf70edca4b91363) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QSslSocket - do not test the deprecated APITimur Pocheptsov2020-06-101-108/+2
| | | | | | | | | | | We deprecated several setters on QSslSocket, no need to test them then (and I'm removing them in Qt 6 anyway, so changing the test is the phase 1). Change-Id: I5807abfb280cbacd4fcc19468793f9d1f3b2ff20 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit d9b2115060aa8eb79c7ad3ab57c99c4a3c15467c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Win: Choose a suitable font in tst_QTextLayout::textWidthVsWIdthEskil Abrahamsen Blomfeldt2020-06-081-0/+3
| | | | | | | | | | | | | | | | | | The default font on Windows 10 (Segoe UI) will return the wrong minimum right bearing at some sizes, which will cause us to skip the textWidthVsWIdth() test at some scale factors, since we cannot trust the layout to be perfect in this case. Based on experiment, Arial is more accurate, so in order to avoid skipping the test, we default to this on Windows instead. (Note: The problem has not been observed with the default fonts on Linux or macOS, so we only do this for Windows specifically.) Task-number: QTBUG-84415 Change-Id: I8cdb5d0d9922915a6ed1574d62a561dda0e1dc5d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 18e8519dcdf36b211b39c131c0d6e08b5921a03c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix to crash in QWindow::event when delete this called on closeEventMiika Pernu2020-06-051-0/+19
| | | | | | | | | | | | | Starting from Qt 5.11 QWindow::event is called after QDialog::closeEvent which would cause a crash if "delete this" was called on closeEvent. The commit that changed this was e0b5ff4ad583befbecbcbe462998e3ed80899531. Added a check before QWindow::event call utilizing QPointer to prevent the function call in case object is destroyed by a user in close event handler. Change-Id: I64a4a0f3271714e55bf7e806177f0d8b39b67fa3 Fixes: QTBUG-84222 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 036c3c19e7da5f1a280750d3c68a0cff38678029)
* QEventDispatcherWin32: retrieve PM_REMOVE value as a bit flagAlex Trotsenko2020-06-031-0/+38
| | | | | | | | | | | | | | | Windows unexpectedly passes PM_NOYIELD flag in wParam parameter to the hook procedure, if ::PeekMessage(..., PM_REMOVE | PM_NOYIELD) is called from the event loop. So, to ignore undocumented flag, we should interpret wParam as a bit field. Thanks to Robin Lobel for research. Fixes: QTBUG-84562 Change-Id: Ib16d7d747aebc9a3628e4ee67478c4d3edeb96f1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 33e6e5fac3c86805b1b4e744462645cac8c8a044) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Rework QLocale and QDateTime tests that expect CET abbreviationEdward Welbourne2020-06-032-42/+11
| | | | | | | | | | | | | | | | | | | | | | | The name CET is locale-dependent; but QLocale doesn't know about localization of time zone names. Such abbreviated zone names are, in any case, potentially ambiguous - various zones around the world have collisions - so they can't be relied on. QTimeZone's various backends have differing handlings of how to abbreviate zone names (MS's provides no abbreviated names at all); and it appears macOS actually follows the relevant localizations. So it is hopeless to hard-code the expected zone abbreviations. Changed the tests to consult QTimeZone for the abbreviation and compare what it gets with the results of checks which should match this. This is less stringent, but it is at least robustly correct, thereby getting rid of assorted kludges and #if-ery. Task-number: QTBUG-70149 Change-Id: I0c565de3fd8b5987c8f5a3f785ebd8f6e941e055 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 449b347644a34ab37720874bf9f8bcffe2ea425e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMimeType::suffixForFileName shouldn't lowercase the file suffixDavid Faure2020-06-021-0/+6
| | | | | | | | | | | | | | It was returning a lowercased suffix because it was extracting it from the pattern (*.txt) rather than from the filename ("README.TXT"). This broke expectations on the application side, since this method is documented to return a suffix from the given filename. Ref: https://bugs.kde.org/show_bug.cgi?id=402388 Change-Id: I7dae13db31280249d3f592fa9592c4067804e22d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 4f1ebf666e36020c501e6d3b20d70320b45ab2ec)
* Make tst_QTextLayout::textWidthVsWIdth() more robustEskil Abrahamsen Blomfeldt2020-05-291-0/+15
| | | | | | | | | | | | | | | | Some fonts misreport the minimum right bearing, and in those cases we may not be able to do a perfect text layout inside the bounds set. This is a limitation we have chosen to accept. To avoid random failure when testing this, we detect the case and skip the test if we see that it may fail. Fixes: QTBUG-84415 Change-Id: I6b53ea2631c5c6e476e2902b5514829a2141796f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 4e5d686a87c4e86aae42d1a5921eec22151f12a5) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix ExtendedRgb and Rgb encoding comparisonsAllan Sandfeld Jensen2020-05-281-0/+20
| | | | | | | | | ExtendedRgb should be treated as Rgb as it can be an automatic upgrade. Change-Id: I2942a1067ed5cacb2f60f303f467887cb44c36dd Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit d80a98d52548b1081ba3f980252fe9aee89bc1f8) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Make QDateTimeParser recognize local time offsetsAndrei Golubev2020-05-281-1/+39
| | | | | | | | Fixes: QTBUG-84209 Change-Id: Iedbc7beafcaa55c72fec3ac5a5f519c6ed5f7770 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit cfbb30decda13fb630127246af5bea32c5f4da57) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTextMarkdownImporter: allow nesting text span formattingShawn Rutledge2020-05-271-2/+112
| | | | | | | | | | | | | | | | The bold+italic combination indicated by ***triple stars*** requires this; but it enables combinations of italics, bold, strikeout, anchor text (and associated link formatting), image alternate text, and inline code formatting (monospace). A code span overrides the formatting from surrounding spans (which might be a bug to fix in another patch, if we compare to how md2html formats code nested in bold-italics for example), but the format stack restores state when any char format span ends. Task-number: QTBUG-81306 Change-Id: I289556fa53de400eb50a4d159b9b344eafc517da Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 3373aa8b351691d395cd15c634ca1b60fd688c6a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* moc: handle include directives in enumsFabian Kosmale2020-05-274-2/+61
| | | | | | | | | | | | When including files, moc inserts a MOC_INCLUDE_BEGIN and MOC_INCLUDE_END token into the token stream. Those are already handled in the toplevel Moc::parse function, but parseEnum lacked support so far. Pick-to: 5.15 Fixes: QTBUG-80578 Change-Id: I35c8fd959347d94af20090b3a505dd9e6bfaff88 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* QApplication: don't let synthesized wheel events grab the mouseVolker Hilsheimer2020-05-261-18/+56
| | | | | | | | | | | | | | | | | | | | | | | | | Following bc205d81e7c0cc33ee1f5b72c3745c958f3f2aa7, kinetic scrolling worked also for nested scroll areas, but since the first scrollbar that accepted the event became the wheel grabber, changing direction on the touch pad would not deliver the event to the other scroll bar. That logic lives in QAbstractScrollArea, which never sees the event once the series is grabbed by the scrollbar. The refactoring of the wheel event dispatching for Qt 6 fixed that already, by handling synthesized events explicitly, before any of the wheel grabbing logic kicks in. Adapting this change ensures that the widget that accepts the first spontaneous event becomes the wheel grabber, which is now the scroll area. The logic there can now forward the event to the correct scroll bar. Include the auto-test extension to cover direction changes. Change-Id: I3f20055047abf6e15d7859e6be7df2a2c5492087 Task-number: QTBUG-79102 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (adapted from commit 92df790f46b3a8b17aec2f385d6472fd3f8647f6)
* QApplication: deliver all wheel events to widget that accepts the firstVolker Hilsheimer2020-05-261-0/+127
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For kinetic wheel events, Qt tries to make sure that all events in the stream go to the widget that accepted the first wheel event. It did so by directing all events from the stream to the widget from which the spontaneous event was returned as accepted. However, that widget might have passed the event on to some other widgets; e.g QScrollArea forwards wheel events from the viewport to the relevant scroll bar. The event might then have come back accepted only because parent propagation kicked in (the scrollbar might not accept the event, so the parents get a chance, and some parent's scrollbar ultimately accepts the event). In this scenario, the wheel widget would be the viewport under the mouse, when it should have been the scrollbar of the parent. The next events from the stream were then delivered to a widget that didn't scroll; and parent propagation is not (and should not be) implemented for the case where Qt has a wheel widget. Instead, make the first widget that accepts any initial wheel event the wheel widget, even if the event was not spontaneous. With this change, all events from the stream are delivered to the widget that actually handled the event. That has the effect that ie. a viewport of a scroll area only gets the first event; all following events are delivered directly to the scrollbar. The test case added simulates the different scenarios - nesting of scroll areas, classic wheel events and a stream of kinetic wheel events. [ChangeLog][QtWidgets][QApplication] Wheel events from a device that creates an event stream are correctly delivered to the widget that accepts the first wheel event in the stream. Change-Id: I5ebfc7789b5c32ebc8d881686f450fa05ec92cfe Fixes: QTBUG-79102 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit bc205d81e7c0cc33ee1f5b72c3745c958f3f2aa7) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QString: fix an aliasing issue in remove(QString)Marc Mutz2020-05-211-0/+10
| | | | | | | | | | | | Even in Qt 5, remove() can be passed an alias to *this. In Qt 6, with the advent of substring sharing, this will become even more pronounced. Use the same fix as was already used in QString::insert(). Change-Id: I1a0d3d99fd7dff6e727661646d2cbfdc94df2682 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit b655734965155146290f3f3a9205243af11e42fb) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QTextDocumentLayout test with certain fontsEskil Abrahamsen Blomfeldt2020-05-211-5/+2
| | | | | | | | | | | | | | | | | | If there is a negative right bearing on the last character of the string, it will stretch past the tab position (which aligns the advance position, and not the right edge of the glyph). For certain fonts, this would cause the actual ideal width to be calculated as 301 instead of 300 (which is the right alignment edge set in the code). In 5.15, this test now also passes on WinRT, so remove the QEXPECT_FAIL. Fixes: QTBUG-46206 Task-number: QTBUG-68297 Change-Id: I03e8b8fb86e9ebe5337d3ba3384ade73d2ccdd69 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> (cherry picked from commit 8231614661e1eecaabcf33d1e332809556e86089) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* tst_QDialogButtonBox: Port away from QAbstractButton::animateClick()Friedemann Kleint2020-05-211-40/+38
| | | | | | | | | | Use QAbstractButton::click(). Refactor and polish the tests to use QTRY_VERIFY() instead of qWait(), speeding them up. Task-number: QTBUG-81845 Change-Id: I119bede8143ec1db5f5250517dee38b576d5a8d2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 512be78e010ef269d76983a976ba904eae986702)
* Fix bug in QTextLayout::min/maxWidth for WrapAtWordBoundaryOrAnywhereJan Arve Sæther2020-05-211-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | In that specific wrapping mode, it will first try a normal word wrap. If it doesn't fit within the specified line width it will discard the result of that and try WrapAnywhere by calling layout_helper() recursively. The problem was that at the point it called itself again it had already adjusted eng->maxWidth: eng->maxWidth += line.textWidth; This was not restored, but carried on to the recursive call to layout_helper(), so the end result was that the maximumWidth would accumulate text widths from parts of the same line twice. Due to the same recursive behavior the minimumWidth also had a problem: It always returned the width of the widest word because it took the qMax() of the minimum widths of the two passes, (WordWrap and then WrapAnywhere) effectively making the minimum width always be the width of the widest word (even though it could wrap at finer granularity). Task-number: QTBUG-77337 Change-Id: Ie7e9c17b157506352c2da38cc7f4a8dfa1283966 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> (cherry picked from commit 8d6d1d6fea1d262f97f088eb92441cececad3f88) Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Don't move focus away from previous proxy in QWidget::setFocusProxyVolker Hilsheimer2020-05-211-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | This amends 23b998fa454ca021aa595f66d2e1964da4a119a4, and the commits 3e7463411e549100eee7abe2a8fae16fd965f8f6 and 947883141d9d8b3079a8a21981ad8a5ce3c4798e. This change restores the pre-5.13.1 behavior of setFocusProxy to not move focus away from a previously set focus proxy. With the previous changes, focus would move away from a proxy when a new proxy is set, if the old proxy had focus. While there are arguments in favor of this behavior, it is a change of behavior that shouldn't be introduced to 20+ years old functionality in order to fix the real bugs addressed by the initial commits. Instead, move focus only to the new proxy when the focus widget was the widget that gets a focus proxy. [ChangeLog][QtWidgets][QWidget] setFocusProxy no longer moves focus away from a previously set focus proxy, restoring pre-Qt 5.13.1 behavior. Change-Id: Icf2ad7cba5b860014aeef91cb274c442a2ab9d42 Fixes: QTBUG-83720 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit a8fee0bf431bb940da1684f59d0dee1e3ba5cede)
* QWidget: fix regression when changing focus proxy while it has focusVolker Hilsheimer2020-05-211-0/+94
| | | | | | | | | | | | | | | | | | | | | | | This follows up on commits 3e7463411e549100eee7abe2a8fae16fd965f8f6 and 947883141d9d8b3079a8a21981ad8a5ce3c4798e. The changing of the pointer of QApplicationPrivate does not transfer focus properly. It updates the pointer, but it doesn't deliver events or update the widget hierarchy's focus chain. The result is that multiple line edits might show a blinking cursor. Instead, use QWidget::setFocus when the focus proxy has changed while it had focus, and pass OtherFocusReason rather than NoFocusReason. Add a basic test for QWidget::focusProxy, which exercises this code path and verifies that pointers are consistent when focus changes as a side effect of modifying the focusProxy. Change-Id: I15a4d868bab2b590cfe4a1daa6a3c8cebc9c9ca2 Fixes: QTBUG-83720 Fixes: QTBUG-79707 Reviewed-by: David Faure <david.faure@kdab.com> (cherry picked from commit 23b998fa454ca021aa595f66d2e1964da4a119a4)