summaryrefslogtreecommitdiffstats
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Update public suffix listv6.5.26.5.2Mårten Nordheim2023-07-061-0/+0
| | | | | | | Change-Id: Idebcc00133661263d557750abdb31f2816a4e190 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 68043e2ca92ea0c89c111329061edbe7858e1efa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QXmlStreamReader: make fastScanName() indicate parsing status to callersAhmad Samir2023-06-291-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a crash while parsing an XML file with garbage data, the file starts with '<' then garbage data: - The loop in the parse() keeps iterating until it hits "case 262:", which calls fastScanName() - fastScanName() iterates over the text buffer scanning for the attribute name (e.g. "xml:lang"), until it finds ':' - Consider a Value val, fastScanName() is called on it, it would set val.prefix to a number > val.len, then it would hit the 4096 condition and return (returned 0, now it returns the equivalent of std::null_opt), which means that val.len doesn't get modified, making it smaller than val.prefix - The code would try constructing an XmlStringRef with negative length, which would hit an assert in one of QStringView's constructors Add an assert to the XmlStringRef constructor. Add unittest based on the file from the bug report. Later on I will replace FastScanNameResult with std::optional<qsizetype> (std::optional is C++17, which isn't required by Qt 5.15, and we want to backport this fix). Credit to OSS-Fuzz. Fixes: QTBUG-109781 Fixes: QTBUG-114829 Change-Id: I455a5eeb47870c2ac9ffd0cbcdcd99c1ae2dd374 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit 6326bec46a618c72feba4a2bb994c4d475050aed) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 7e9210a83203975f21fa133fc4bf5d691acf9b23)
* QPromise: Propagate cancellation through failure handlersArno Rehn2023-06-211-0/+33
| | | | | | | | | | | | | | | Previously, failure handlers did not propagate cancellation. This would lead to crashes when a QPromise was cancelled without having generated any result. Subsequent continuations would be invoked and try to access the result (which was nonexistent) and then crash. This patch propagates cancellation through failure handlers to prevent subsequent continuations from being called in the first place. Fixes: QTBUG-114606 Change-Id: I23b28a8e70a76e1ba6416be4440360c6dbaef2a3 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 855c4484693015cb6498f2183d95de1377d49898) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Don't add prefix for BaseNameBogDan Vatra2023-06-191-3/+9
| | | | | | | | | | | | | | Adding the "assets:" prefix to BaseName leads to wrong names returned by QFileInfo{"assets:/path/to/file"}.fileName(). Instead to return "file" it returns "assets:/file" which is not the expected result. Fixes: QTBUG-114576 Fixes: QTBUG-114219 Fixes: QTBUG-112261 Change-Id: I574bf325300c0aedef68b1b183fa837144ad63c6 Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 76619eae4c4e857721529c87eb3c9d519fa2f0b7)
* Android: fix Android assets handler not listing dirs with only sub dirsBartlomiej Moskal2023-06-194-0/+27
| | | | | | | | | | | | | | | | | | | | | It looks like AAssetDir_getNextFileName is not enough. Directories that contain only other directories (no files) were not listed. On the other hand, AAssetManager_openDir() will always return a pointer to initialized object (even if the specified directory does not exists), so we can't just leave only it here. Using FolderIterator as a last resort. This approach should not be too time consuming. As part of this fix, add some unit tests to cover/ensure assets listing/iterating works as expected. Fixes: QTBUG-107627 Change-Id: Id375fe8f99f4ca3f8cad4756f783ffafe5c074df Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit 4ceee3911a2ef567f614fc296475bc2b2a0e3add)
* Update public suffix listMårten Nordheim2023-06-171-0/+0
| | | | | | | | Task-number: QTBUG-114548 Change-Id: I5857438aeb1902cd68ceffe4e5179e7bbdf9b44b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 8da8126bae030c7ab33ca02b7ef816b667a6cdb0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* moc: Handle attributes after meta-method tagFabian Kosmale2023-06-171-0/+28
| | | | | | | | | | | | | | | We so far only handled them if they came at the very start of the method declaration. This patch ensures that we also handle them after the meta-method tag (but before the actual type). Unifying parseFunction and parseMaybeFunction to avoid the need to munally keep them in sync is left for another day. Fixes: QTBUG-111330 Change-Id: Ic94edb69f04b9150aea2c8e6d004a8b9e5cf12ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 44b5ad01f0da55a351e0855e1173acfbef77221d) Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace {add,sub,mul}_overload with q{Add,Sub,Mul}OverloadMarc Mutz2023-06-131-40/+40
| | | | | | | | | | | | | | | | | | | | | These APIs started out as private APIs in qnumeric_p.h, but have since been made pseudo-public in qnumeric.h. The qnumeric_p.h versions just forward to the qnumeric.h ones, so just use the latter. This is in preparation of removing the {add,sub,mul}_overflow versions, which, despite being defined in the unnamed namespace, don't sport the q prefix, so potentially clash with global symbols. The change is a simple textual search and replace, manually excluding qnumeric_p.h. Picking to 6.5 to avoid cherry-pick conflicts going forward. Change-Id: Ic0f7c92f7c47923317109e8a9dc06fa66bdff2c2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit b209f943d2611fa4ac2dd9c64b1a014182b59a3d) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* tst_QPixmapCache: check insert() reports failureMarc Mutz2023-06-121-0/+28
| | | | | | | | | | None of the existing tests failed when I started to return a valid key from a failed insert(QPixmap), so add a test that would fail. Change-Id: I74f23d2ec4c04151f8f1266c0c503713d4642f3a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit e409d771d922b9772a0ecb4da575c6fd6f95676f)
* tst_QPixmapCache: rewrite QVERIFY(x != 0) to QVERIFY(x)Marc Mutz2023-06-121-16/+16
| | | | | | | | | | This is just confusing. QPixmapCache::find() already returns bool, comparing it to a literal zero just makes it hard to read. Change-Id: I43c000890377cca2111daa48799f10cc99aad8cf Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 6032845ca2fc69fb67971ea9f7e06588ffcbe9f3) Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Fix segfault when using qfuture continuations with move only typesAhmed Essam2023-06-102-22/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using move-only types, continuations args are set using takeResult function, which has the side effect of invalidating the QFutureInterface associated with the promise/futures by: 1. setting isValid to false 2. setting the state to NoState And when the promise is destroyed, it tries to run the continuations if `finished()` is not called, which is done by checking the Finished bit in the state. But since the continuation has been run before, and the state has been set to NoState it tries to run the continuation again causing a segfault. Multiple solutions come in mind: 1. don't run the continuation if the state is NoState, but this would break the case when an empty promise is destroyed 2. check inside the continuation if it has been run before, and if so don't run it again, but this seems hacky since we don't want the continuation to be run twice, and it should break if it did. 3. when invalidating the promise leave the state as is, and change isValid only to false, which changes the current behavior, but is still compatible with the documentation which states only that isValid will return false if takeResult is called I chose option 3 I also extended some tests to test for move only types, and added a test that continuations run when a promise is finished. This simple case would segfault before with move only types. Fixes: QTBUG-112513 Change-Id: Ie225ac4fdf618e4edfb0efd663d6c7fd6b916dbd Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit 1f22fc995a36193cd67e8190858bb33614d149f4) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_QFile: fix unixPipe() and socketPair() closing already-closed fdThiago Macieira2023-06-101-2/+5
| | | | | | | | Change-Id: I63b988479db546dabffcfffd1766d75c11e46fda Reviewed-by: Dimitrios Apostolou <jimis@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 65097e7667c96177c322ebd45f7ac5c74fee7a26) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QStyleSheetStyle: Default to foreground for unset brushes onlyAxel Spoerl2023-06-091-0/+27
| | | | | | | | | | | | | | | | | | | | | If a foreground style has been defined in the style sheet, QStyleSheetStyle populates its brushes for the color roles ButtonText, WindowText, Text, and the widget's foregroundRole with the foreground brush. PlaceholderText is set to the same brush with a modified color. That sets their resolve bits in QStyleSheeetStyle's palette and prevents these color roles from being inherited by the widget's palette - in contrast to all other brushes. This patch makes the brushes mentioned default to the widget's palette if they are set there. It adds a test in tst_QStyleSheetStyle. Fixes: QTBUG-93009 Change-Id: Ie3df9dbd17b96fa72beee90792fc7eca1933cdbe Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c4635c0d5822d0e95ceca867fffb9ba86a2b7bfe) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Stabilize QFile::unixPipe/socketPair testsVolker Hilsheimer2023-06-091-4/+5
| | | | | | | | | | | | | | | We observe failures in CI on QNX because the measured timeout is ~995ms rather than the expected 1000ms. Start the timer before the thread starts to guarantee that at least as much time elapses as the thread waits before writing the second byte to the pipe. Otherwise, the thread might be sleeping already when the timer starts, and then we can't rely on any measurements. Change-Id: I6072569a987f5e952b0953e0e394a223f891fd25 Reviewed-by: Dimitrios Apostolou <jimis@qt.io> (cherry picked from commit 30e5ff3ff223d665fbed3baf2d08ad3fcf2b8455) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QMenu: don't crash when nested tear-off menus are closedVolker Hilsheimer2023-06-091-0/+79
| | | | | | | | | | | | | | | | | QMenu's causedStack maintains a list of menus on the way to the menu, and might contain nullptr if one of the entries was a tear-off menu that got closed (and thus destroyed, due to DeleteOnClose). If the entry we get from the stack is nullptr, fall back to the passed- in parent widget pointer, and test for nullptr before accessing. Add a test case that crashes without the fix. Fixes: QTBUG-112217 Change-Id: I958182db47c3cc8733e1780f7efef43881ffae11 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit f0049873d2ce0742a2df7ce265db70ca8baa8442) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Examples: Remove unnecessary Q_INIT_RESOURCE callsKai Köhne2023-06-083-5/+0
| | | | | | | | | | | | Explicit calls to Q_INIT_RESOURCE are only needed for resources embedded in static libraries. See also https://doc.qt.io/qt-6/resources.html#explicit-loading-and-unloading-of-embedded-resources Change-Id: I06a24d1c04369eedc78ca60a6ca02ce33907d9e7 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> (cherry picked from commit eed17b3634a99b6f6f751830c6443094dd6b600b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Remove the manual undef of the min/max macros, or def NOMINMAXAmir Masoud Abdol2023-06-083-7/+0
| | | | | | | | | | We now add NOMINMAX to PlatformCommonInternal target which will be linked to everything else, so min/max will not be defined upon the inclusion of `windows.h`, or other headers. Change-Id: I10016720dac7ce015e929885b7368ee86d8b6918 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> (cherry picked from commit 1dfa922606e497918e57a6a06f96ee63b7fb163e)
* QDockWidget: Propagate window title when re-dockingAxel Spoerl2023-06-071-2/+15
| | | | | | | | | | | | | | | | | When a floating dockwidget's title changes, it is rendered as a window title. When the title changes while floating, the change will be reverted to the pre-change title when the dockwidget is docked again. This patch explicitly propagates the window title, if it has been programmatically changed while the dock widget is floating. It adds test functionality in tst_QDockWidget::floatingTabs(). Fixes: QTBUG-113591 Change-Id: I96fa69fb27ad1a85f4ea9ce44c0a22290259fca6 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c153066baaa88718ed45b68230d81285eb436d3d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Add tst_QString::prependEventuallyProducesFreeSpaceAtBegin()Marc Mutz2023-06-071-0/+10
| | | | | | | | | | | This seems to work with prepend(char), but not with prepend("data"), cf. QTBUG-114167. Task-number: QTBUG-114167 Change-Id: I7aa4dca7c2b5938c2e5ad416231945c23140d659 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit e4682408b036b95d4edfb7e324c8e6835230d263) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QPixmapCache: fix leaking of QStrings and Keys on clear()Marc Mutz2023-06-071-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | QPixmapCache maintains a mapping from QString to QPixmapCache::Key, in the form of the cacheKeys QHash, but QPixmapCache::clear() didn't touch it, leading to the string data (as well as the Keys) being retained after any possible use. This can lead to memory slowly being eaten up, as reported in QTBUG-112200, and prevents a periodic calling of QPixmapCache::clear() from being a work-around for the issue in the bug report. Fix by clearing cacheKeys in QPixmapCache::clear(). This is designed as a low-risk enabler of a work-around, not a fix for the issue. The work-around enabled by this is periodic calling of QPixmapCache::clear(). [ChangeLog][QtGui][QPixmapCache] Fixed QString key data not being freed on clear(). Task-number: QTBUG-112200 Change-Id: Ica6fa0e27e1b47b8df58d5e996378a2ececa5f9c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 6ab0d25a09f5aeb7a5a062f7fd44e95ca761e21e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTabBar: recalculate scroll offset when showingVolker Hilsheimer2023-06-071-0/+37
| | | | | | | | | | | | | | | | | | | | | | | If an application sets the current index and resizes the tab widget before showing it, then the scroll offset might be calculated based on an old size. Since after ca15f650a1a914bb9a41131109c46c4e52c5ebb1, resizing explicitly avoids scrolling, this could result in tabs ending up scrolled outside of the tab bar when showing the tab widget. Fix that by explicitly making the current tab visible in the tab bar's showEvent handler, which recalculates the scroll offset based on the actual size. This is only reproducible with a tab widget, which lays out the tab bar for each change and resets the tab bar's layoutDirty flag. Add a test case there. Fixes: QTBUG-114204 Change-Id: I1e9506b9dde1dd892291d108dd2c7b675ef99509 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jonas Kvinge <jonas@jkvinge.net> (cherry picked from commit 2a7da1b3c8c4096d7c2b09f3fcc58e9cf47867cd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move qopenglwidget example to manual testsLaszlo Agocs2023-06-0611-0/+1106
| | | | | | | Change-Id: I76e6377008484a7b17c65e3c03139a0fb2fc5c34 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 413e74e9a59ccf512b0ab3da0e6a8e5ba9057319) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move widgets Application example to manual testsAxel Spoerl2023-06-0412-0/+466
| | | | | | | | | | | | | | With 6e77da640aa84c1efe330d4a5224c9c7425ece57, the documentviewer demo's TxtViewer plugin has been fully documented in order to replace the Application example. This patch moves the application example to manual tests. Change-Id: I67d975e478c7bc840613c8af1301a4eafe8f1a42 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit eda71105ff9a516059c6dd6643ff446a82edac81) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QByteArray: add Qt::StringLiterals to the namespace scopeDennis Oberst2023-06-011-1/+2
| | | | | | | | | ... and remove all previous function-level occurrences. Change-Id: I90df40922e3aed15efc04e885d9f54c577a948b6 Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit c06bdc316fceda4296c4900a24a572bff3da35f9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Refine the rhi-based flush logicLaszlo Agocs2023-06-011-5/+55
| | | | | | | | | | | | | Amends 244daf4cfc44587c8c7c87e481688e840cc21c77 Fixes: QTBUG-113557 Fixes: QTBUG-113652 Task-number: QTBUG-108277 Change-Id: I9e369b0e1261ea37eb2dedd80083f82f5df97b30 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 8c0b657c9a119cf60d96d36351ccf553e21ff3fc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QGuiApplication: Remove .desktop suffix in setDesktopFileNameVlad Zahorodnii2023-05-311-2/+2
| | | | | | | | | | | | | | | | The desktop file name should not contain ".desktop" suffix, but some applications still specify it anyway because of the ambiguity in the documentation that was fixed in 0c5135a9dfa6140d23d86b001c3054891c22dcb9. This change makes setDesktopFileName remove ".desktop" suffix so desktopFileName always returns a desktop file name with correct format and its users don't need to chop ".desktop". Change-Id: If5abccaf3bf976449cada8891fff887870e45b5f Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit fb86c5a47060b11a7fa6ee4d93ff51f052b904aa) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Ssl: Copy the on-demand cert loading bool from default configMårten Nordheim2023-05-291-3/+21
| | | | | | | | | | | | | | | | | | | Otherwise individual sockets will still load system certificates when a chain doesn't match against the configured CA certificates. That's not intended behavior, since specifically setting the CA certificates means you don't want the system certificates to be used. Follow-up to/amends ada2c573c1a25f8d96577734968fe317ddfa292a This is potentially a breaking change because now, if you ever add a CA to the default config, it will disable loading system certificates on demand for all sockets. And the only way to re-enable it is to create a null-QSslConfiguration and set it as the new default. Change-Id: Ic3b2ab125c0cdd58ad654af1cb36173960ce2d1e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 57ba6260c0801055b7188fdaa1818b940590f5f1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QLabel: always show the context menu created by the controlVolker Hilsheimer2023-05-251-0/+39
| | | | | | | | | | | | | | | | | | | | | Amends e718818745e6db8df09ea55c4071e116f00851c9, after which a context menu was only shown if the format was rich text and there was a link at the position of the click. We always want to leave it up to the control to create a context menu, so only return early if there is no control. The control will then respect content at the position (i.e. link or not) and text interaction flags, and create the menu based on that. I.e. a rich text label with selectable text should still show "Select All" in the context menu, also if not clicking on a link. Add a test case to verify that the context menu event got accepted as expected, which indicates that the label showed a menu. Change-Id: Ib2b36286e4f1253d10489b5add83e8cdd7197a06 Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io> (cherry picked from commit 6a2b0291389fa32bd70a2c03119890275d5e0681) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDBusAbstractAdaptor: Send signals using correct interfaceIevgenii Meshcheriakov2023-05-252-0/+36
| | | | | | | | | | | | | | | | When forwarding a signal, associate this signal with its enclosing metaobject instead of its sender's metaobject. Those two may be different if the signal is declared in a base class. Add a regression test into tst_qdbusconnection. Fixes: QTBUG-33142 Change-Id: I532ab3bb6c0671a480568f46d63fceff0c82c097 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit c9684054553f6dd8c4ff478653d20cd7a4adba9e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Skip diffie-hellman parameter test when not supportedMårten Nordheim2023-05-241-0/+2
| | | | | | | | Change-Id: I0c21aeea813ee48f8c62689dafce6f7fb9620001 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> (cherry picked from commit c891d16490b6b5bd2f912c49356b8292d4c3fb42) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Extend accessibility testing of treeviewVolker Hilsheimer2023-05-231-8/+30
| | | | | | | | | | | | | | | | | | | | | Check that we can navigate to rows and columns, and that we get the right text back for cells. We see API failures in CI on some macOS nodes, accompanies by the debug message: AXUIElementCopyAttributeValue( "AXTitle" ) returned error = AXError(value=-25201, name=kAXErrorIllegalArgument, description="An illegal argument was passed to the function.") On hosts where the test fails, we always see this warning, so extend the test helper with an errorOccurred boolean that we can test and if set skip the test. Change-Id: Iacad4c41f8597243abeff36ca91cf290446c13a1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 9526e8dc332a0306fd61f78a0af53d413bb70082) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Schannel: Reject certificate not signed by a configured CA certificateMårten Nordheim2023-05-235-0/+193
| | | | | | | | | | | | | | | | | Not entirely clear why, but when building the certificate chain for a peer the system certificate store is searched for root certificates. General expectation is that after calling `sslConfiguration.setCaCertificates()` the system certificates will not be taken into consideration. To work around this behavior, we do a manual check that the root of the chain is part of the configured CA certificates. Change-Id: I03666a4d9b0eac39ae97e150b4743120611a11b3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit ada2c573c1a25f8d96577734968fe317ddfa292a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: Fix assertion in accessibility implementation for treeviewsVolker Hilsheimer2023-05-221-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In QAccessible's widget implementations, trees are treated as tables, with a rowCount implementation that is based on the view's current item content. That item content is the view's content, not the model's, and it changes when tree branches are expanded. The Cocoa bridge for accessibility allocates arrays of row data structures based on the rowCount implementation. Those data structures need to be invalidated and recreated when the view's content changes. To do that, emit an accessibility event for a model reset when laying out items changes the size of the view's item array. We don't know what changed during that layout process to makes this any more granular. Amends 11ae55e918082e8fdfc0c88c21049e877cc47b5b, but the problem with the data structure being stale and incorrect would have been there before that chain of changes optimizing. It didn't trigger an assert, but probably resulted in incorrect data being reported. To make trees testable, we need to actually expose them as AXOutline to the macOS accessibility framework. Until now, they have been treated like plain QWidget, e.g. AXGroup. This made them in practice in- accessible. With this change, VoiceOver works much better (although not perfeclty yet). Also remove an assert that could be triggered by an accessibility client asking for a cell for an invalid index (which can be reproduced by navigating around in a tree, following debug warnings from QAccessibleTree::indexFromLogical: invalid index). Change-Id: I7650342aa0dcd7925a94ae6a36de5a0b344c467d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 6a4afebc5ce8db69a6c9fb398cada31e6bad5e3c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* macOS: show the test function in the title of the test windowVolker Hilsheimer2023-05-221-2/+2
| | | | | | | | | This makes it a bit easier to know what's going on when debugging. Change-Id: I5955b9b590c7aea584748f36e4fe15d41fd05ac1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit b60c31de5295c96e9d6e49a2a233ce5ff66db605) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Fix case-sensitivity of exponent separator check in Cyrillic fall-backEdward Welbourne2023-05-221-0/+12
| | | | | | | | | | | | | | | | | | | This is a back-port to 6.5 of both the special-case handling of Cyrillic's exponent separator [0] and the fix to that, that prompted this cherry-pick. Both changes were made after significant restructuring of relevant code to cope with multi-character exponent separators, which is not backported to 6.5. [0] commit cb54da236662563bfdc2f58a01320c3bd360cbff Added some test-cases for the lower-case exponential separator. Fixes: QTBUG-113443 Change-Id: I18e22d7b3451fbb61e87d5b93661eadff3c7356e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io> (cherry picked from commit 4768fcf836f1eb0f59ab62a29eb821b433a239c1) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Avoid capturing same property twiceFabian Kosmale2023-05-191-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Avoid capturing the same property multiple times in a binding by storing them in the BindingEvaluationState. We store them in a QVarLengthArray array, as the number of properties involved in a binding is expected to be rather low, so a linear scan is fine. Avoiding double capture is a good idea in general, as we would otherwise needlessly reevaluate bindings multiple times, and also needlessly allocate memory for further observers, instead of using a binding's inline observer array. Even more importantantly, our notification code makes assumptions that notify will visit bindings only exactly once. Not upholding that invariant leads to memory corruption and subsequent crashes, as observers allocated by the binding would get freed, even though we would still access them later. Fixes: QTBUG-112822 Change-Id: Icdc1f43fe554df6fa69e881872b2c429d5fa0bbc Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> (cherry picked from commit cb30e45b9a800c6ad9cdfb446a20b6a6e8efbe71) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QDnsLookup: don't fail if the server refused to answerThiago Macieira2023-05-161-34/+35
| | | | | | | | | This happens often for me for ANY queries via Dnsmasq (home router) or via whatever the corporate DNS servers are in the office. Change-Id: I3e3bfef633af4130a03afffd175e2656ae5e2c3e Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit af9fa21a70c485accd152995f47cfafb0d0341d4)
* Remove the "classwizard" exampleVolker Hilsheimer2023-05-1613-0/+617
| | | | | | | | | | | | | | | It adds nothing new to what the trivial and license wizard examples show, other than a bunch of somewhat messy and outdated code to generate C++ code files based on the input. The example is referenced in a few parts of the documentation, but there are equivalent snippets in the trivial and license wizard examples, so point at those instead, and add some relevant API usage where needed. Change-Id: If1ff57e775bad28920d9e019aeccae69d1f4d127 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit b7c15f7f24c1f0afcea87b31d3b4e096149c9e7d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Convert "extension" dialog example into snippetsVolker Hilsheimer2023-05-165-0/+180
| | | | | | | | Task-number: QTBUG-108751 Change-Id: I8ca4e058b832674dc0c8b84024cb70a667ee8db4 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit 11da92ba94570e5eec01597fe09f0a9a48acc677) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Unblacklist tst_QDnsQuery::lookupMårten Nordheim2023-05-161-2/+0
| | | | | | | | | | | It was blacklisted some years ago, the bug was closed as cannot reproduce, and no one unblacklisted it. Change-Id: I51f1fe4d819e0f90bf18c19b67fa0dca198914d4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit 36e59db1bb08c30e54e985d338134dfb3823f004) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Darwin: Remove QMacAutoReleasePool heap allocation detectionTor Arne Vestbø2023-05-161-21/+0
| | | | | | | | | | | This is handled by the Objective-C runtime nowadays, where it will abort if the situation is detected, with the option to break on objc_autoreleasePoolInvalid to debug the situation. Change-Id: Idf2c4aacc77e41a3deebf270303f4f13cfb0819b Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit e95f03f989b73bddb52a54fed6a89428de151b09) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QTabBar: Add testcase for tabs not scrollingVolker Hilsheimer2023-05-151-0/+26
| | | | | | | | | | | | Verify that changing a tab's text doesn't scroll. Fixes: QTBUG-45381 Task-number: QTBUG-113140 Change-Id: I02ace9d3fcaa20d8ff5d87ccca5d96a4114b0fb0 Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io> (cherry picked from commit c113a7a7969781877acfe30eb8e20c66f69f94f0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* MOC: pass the erroneous Symbol as an arg to Parser::error() overloadAhmad Samir2023-05-151-0/+9
| | | | | | | | | | | | | | | | | | | | | We already know the Symbol while parsing, passing a reference to it to error() makes it simpler to construct the error message. This fixes an issue where reporting an error about "NONSENSE" in e.g.: Q_PROPERTY(Foo* foo NONSENSE foo) would be off-by-one and the error message would say: path/to/file.h:11:1: error: Parse error at "foo" instead of 'at "NONSENSE"', which is where the parser actually found an unexpected attribute. Fixes: QTBUG-36367 Change-Id: Ief70e544af41f7575fbeea9b936fa8197c3ef43d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit d2242c353fac9b76437b2c3bc521c0e6e415f3b1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* Move the addressbook tutorial into manual testsVolker Hilsheimer2023-05-1567-0/+3745
| | | | | | | | | | | | | | | The tutorial is building an elaborate UI around a QMap. It doesn't use structured data, and it doesn't use model/view (which the dedicated addressbook example in itemviews does). It's not a good way of building an application, and the individual APIs for creating layouts, dialogs, or import/export are explained well enough in other examples. Change-Id: Iffe47a0f6e04a933edb917c877ae845f50b74b4a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> (cherry picked from commit f4b338833e0222db68f37914ecfa21ff11fd718a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_ContainerApiSymmetry: fix mutable lambda anti-patternMarc Mutz2023-05-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | STL algorithms, in general, don't specify how often the function objects passed to them are copied during the run of the algorithm. While generate_n is above any reasonable suspicion of copying the function object after the first invocation, passing a mutable lambda containing the counter is still an anti-pattern we don't want people to copy. Fix in the usual way, by keeping the counter external to the lambda. As a drive-by, replace post- with pre-increment. Amends dc091e74431acbe66ae7921ba82d3eb34ae8cc55. Change-Id: I9c44e769fd41e5f7157179a2be4c3534424cf913 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit edc953948c814c0729d9e22ac903343d4cead0cc) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString: add a tst_QString variant with QT_NO_CAST_FROM_ASCIIAhmad Samir2023-05-132-99/+163
| | | | | | | | | | | | | | Now the tst_qstring is compiled three times: - with QT_NO_CAST_FROM_ASCII defined - with QT_RESTRICTED_CAST_FROM_ASCII defined - with neither of the above defined so as to cover more code paths. Task-number: QTBUG-109228 Change-Id: I65eca0f6f6aea66fed6eeda1eb77a50a97210807 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 7564583d362cc456bd6b17878ac25f6d93d113a8)
* tst_QAnyStringView: fix warning of unused variable by using itThiago Macieira2023-05-121-1/+3
| | | | | | | Change-Id: Ieab617d69f3b4b54ab30fffd175c78ddb5fb919d Reviewed-by: Marc Mutz <marc.mutz@qt.io> (cherry picked from commit 3cc39197f816ac7a84b5211df23e553309fe44c0) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* tst_QDnsLookup: create a dedicated test for IDNThiago Macieira2023-05-121-9/+18
| | | | | | | | | | Instead of using initTestCase and QFETCH_GLOBAL, which make the rest of the tests repeat themselves with IDN data, which isn't necessary. Change-Id: I3e3bfef633af4130a03afffd175e2537ba89dc04 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 9f7b341aae0bcab47ed51a5238fde5be37edc6b3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QDBusConnectionPrivate: Fix handling of queued messagesIevgenii Meshcheriakov2023-05-113-0/+117
| | | | | | | | | | | | | | | | | Handle any queued messages before attempting to dispatch any newly received messages. This ensures that messages are processed in the order they were sent. Add a regression test for this bug using code adapted from the bug report by Pascal Weisser. Because of the nature of the bug, this new test does not always fail even when compiled with affected versions of Qt though. Fixes: QTBUG-105457 Change-Id: I2725f3450ad537d63d6660e21645ac2c578e1768 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 859ef056331a94fb0b1e4b41f596ff78539dfd8b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
* QString: change test data to compile with QT_NO_CAST_FROM_ASCII [10/13]Ahmad Samir2023-05-112-147/+172
| | | | | | | | | | | | Drive-by changes: - Cleanup creating a QChar[], by creating a char16_t[] and reinterpret_cast'ing it - Use human-readable Unicode characters where possible Change-Id: Ice2c36ff3ea4b6a5562cf907a7809166a51abd28 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 9d05fd9fa20229948da751da981f0a1b2f97fd54)