18581 Commits

Author SHA1 Message Date
Tor Arne Vestbø
27e4762903 embeddedwindows: Build app as GUI app on Windows
Change-Id: Ib5289e11ef3d53d038e01e17c76be6e14e48bf80
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-05-13 12:10:15 +00:00
Frédéric Lefebvre
5358c833c4 Unblacklist tst_qComboBox::popupPositionAfterStyleChange on Ubuntu
tst_qComboBox::popupPositionAfterStyleChange is no longer flaky on
Ubuntu.

Fixes: QTBUG-129029
Pick-to: 6.9 6.8 6.5
Change-Id: I3581fe73516d21d599dfb520fe53a0d855c811f6
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Frédéric Lefebvre
8875e88b61 Unblacklist tst_qWidget_window::mouseMoveWithPopup on Ubuntu
tst_qWidget_window::mouseMoveWithPopup is longer flaky on Ubuntu.

Fixes: QTBUG-129568
Pick-to: 6.9 6.8 6.5
Change-Id: Iae9155e21de91ba8068dde622bbd41f3e454dbe2
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Frédéric Lefebvre
3393d85108 Unblacklist tst_qWidget::saveRestoreGeometry on Ubuntu
tst_qWidget::saveRestoreGeometry() is no longer flaky on Ubuntu.

Fixes: QTBUG-126495
Pick-to: 6.9 6.8 6.5
Change-Id: I65e12e958aa028237f56a9e7b3824e9aa837b799
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 14:10:12 +02:00
Frédéric Lefebvre
cb1c184ee8 Unblacklist tst_qFileSystemModel::sort() on Ubuntu
tst_qFileSystemModel::sort() is no longer flaky on Ubuntu 24.

Pick-to: 6.9 6.8 6.5
Change-Id: I5a96cd06c78e2ff95d3d043cb6b11254946e5e19
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-13 12:10:12 +00:00
Liang Qi
2d79012542 Merge Wayland client from qtwayland repository into qtbase
The qtwayland repository has been filtered for commits relating
to the Wayland client, via the following git-filter-repo command:

 git filter-repo --paths-from-file wayland-move.txt --force --refs HEAD

And then merged into the qtbase repository via

 git merge --allow-unrelated-histories

The following git-filter-repo instructions have been used:

src/CMakeLists.txt
src/CMakeLists.txt==>src/platformsupport/wayland/CMakeLists.txt
src/configure.cmake
src/configure.cmake==>src/platformsupport/wayland/configure.cmake
src/client/Qt6WaylandClientMacros.cmake
src/client/Qt6WaylandClientMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandClientMacros.cmake
src/compositor/Qt6WaylandCompositorMacros.cmake
src/compositor/Qt6WaylandCompositorMacros.cmake==>src/tools/qtwaylandscanner/Qt6WaylandCompositorMacros.cmake

src/3rdparty/
src/3rdparty/patches/==>src/3rdparty/wayland/patches/

src/3rdparty/protocol/ivi/REUSE.toml==>
src/3rdparty/protocol/ivi/ivi-application.xml==>
src/3rdparty/protocol/ivi/ivi-controller.xml==>
src/3rdparty/protocol/ivi/qt_attribution.json==>

src/3rdparty/protocol/
src/3rdparty/protocol/==>src/3rdparty/wayland/protocols/

src/extensions/qt-shell-unstable-v1.xml==>
src/extensions/
src/extensions/==>src/3rdparty/wayland/extensions/

src/client/
src/client/==>src/plugins/platforms/wayland/

src/global/
src/global/==>src/plugins/platforms/wayland/globalprivate/

src/shared/
src/shared/==>src/plugins/platforms/wayland/shared/

src/plugins/decorations/adwaita/==>
src/plugins/decorations/
src/plugins/decorations/==>src/plugins/platforms/wayland/plugins/decorations/
src/plugins/hardwareintegration/client/
src/plugins/hardwareintegration/client/==>src/plugins/platforms/wayland/plugins/hardwareintegration/
src/plugins/platform/
src/plugins/platform/==>src/plugins/platforms/wayland/plugins/platform/
src/plugins/shellintegration/qt-shell/==>
src/plugins/shellintegration/ivi-shell/==>
src/plugins/shellintegration/
src/plugins/shellintegration/==>src/plugins/platforms/wayland/plugins/shellintegration/
src/plugins/CMakeLists.txt
src/plugins/CMakeLists.txt==>src/plugins/platforms/wayland/plugins/CMakeLists.txt

src/qtwaylandscanner/
src/qtwaylandscanner/==>src/tools/qtwaylandscanner/

tests/auto/client/iviapplication/CMakeLists.txt==>
tests/auto/client/iviapplication/tst_iviapplication.cpp==>
tests/auto/client/shared/iviapplication.h==>
tests/auto/client/shared/iviapplication.cpp==>
tests/auto/client/
tests/auto/client/==>tests/auto/wayland/
tests/auto/cmake/test_waylandclient/
tests/auto/cmake/test_waylandclient/==>tests/auto/cmake/test_waylandclient/

Done-with: Alexandru Croitor <alexandru.croitor@qt.io>
Done-with: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Task-number: QTBUG-133223
Change-Id: I46c325724141fdbfcc117d12fb5f92852613e72a
2025-05-13 01:50:43 +02:00
Thiago Macieira
b10c7b1680 qtbase: use qHashMulti & qHashRange instead of QHashCombine
If we have no specific need for the private QHashCombine class, use the
front-end functions. For headers, we do have a need: we prefer
QHashCombine because it compiles faster.

Change-Id: I73578ea802d3b905a53bfffd504c20af0ca96cf8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-09 16:54:13 -07:00
Jacek Poplawski
01961aea8b update tst_QFile::supportsMoveToTrash for VxWorks 25.03
On VxWorks 25.03 AT_FDCWD is defined but the POSIX at* APIs needed for
trash support are still missing. Update tst_QFile::supportsMoveToTrash
to verify that QFile::supportsMoveToTrash() returns false on
Q_OS_VXWORKS, regardless of AT_FDCWD.

Fixes: QTBUG-136693
Change-Id: I33f418984887d87e42ecda494cd5b101c42d55e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-09 22:00:54 +02:00
Juha Vuolle
464e9298e2 Remove unnecessary widgets linking from autotests
Unconditional linking breaks build when widgets are disabled.
tst_localfileapi, tst_qwasmwindowstack, and tst_qwasmwindowtreenode
tests link against Qt::Widgets, but does not use them => remove.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: I6d895b5ddd85b3ace98e0e398d034006aee236e0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2025-05-09 10:06:51 +03:00
Frédéric Lefebvre
36d92169f3 Unblacklist tst_qcompleter::QTBUG_14292_fileSystem on openSuSe
tst_qcompleter::QTBUG_14292_fileSystem is no longer flaky on openSuSe.

Pick-to: 6.9 6.8 6.5
Change-Id: Ie2ad7d99ca9afd75a91a0e47c7420cfd470d3a25
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
d1fea2f70e Unblacklist tst_qwidget_window::paintEventOnSecondShow on openSuSe
tst_qwidget_window::paintEventOnSecondShow is no longer flaky on
openSuSe.

Pick-to: 6.9 6.8 6.5
Change-Id: I4ceae71dc3d8a01b0b421bba2968f35dc66383bd
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
ab1569f643 Unblacklist tst_qopenglwidget on openSuSE
tst_qopenglwidget is no longer flaky on openSuSe

Pick-to: 6.9 6.8 6.5
Change-Id: I42d31853d50938590e4cb1ba9ca6f009fe612279
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Frédéric Lefebvre
c02a02b6ab Unblacklist tst_qudpsocket::readyReadForEmptyDatagram on openSuSe
tst_qudpsocket::readyReadForEmptyDatagram is no longer flaky on
openSuSe

Pick-to: 6.9 6.8 6.5
Change-Id: If0f846d1d7ed4cc094e201cf4ef29579508da0bf
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-08 14:23:28 +00:00
Edward Welbourne
591dccddbb Forward-port a test I've just added to 5.15
Ammends commit 61343b5a3f10f5b9166729176d4b95a4c538c278 (which was too
big a change to back-port to 5.15), checking narrow != short in
Chinese month names.

Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-10506
Task-number: QTBUG-84877
Change-Id: Ib9c26df751c0add517bc94218db04d32d8d135eb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-05-07 10:25:23 +02:00
Edward Welbourne
8c086ce832 Correct value of Avogadro's constant used in a test
It doesn't matter at all, but it's now got a defined value, so use it.

Change-Id: Id8e734cd81624a3d4c139b2639381e3f0b162db4
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
2025-05-07 10:23:37 +02:00
Mårten Nordheim
9224fdd3f4 Http2: process HEADERS on RSTed streams
If we RST a stream then we may still have to process HEADER frames for
those streams (at least for a while) that was likely already in-transit.
This is due to HPACK, which manages header compression state. Missing a
frame desynchronizes the server and client, eventually leading to an
error where one party is referring to a header the other party doesn't
have.

Fixes: QTBUG-135800
Pick-to: 6.9 6.8
Change-Id: I5b4b510225ce6737fec7128c4bad38219404b196
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2025-05-06 21:50:34 +02:00
Joerg Bornemann
22b7d198ce CMake: Fix file names of metatypes JSON files
The file names included the build type in the case of a single-config
build. The intention was to include the build type in multi-config
builds to make those more robust. This is not necessary since the
metatypes JSON files are independent of any configurations.

Fixes: QTBUG-136574
Change-Id: I4925e37c784f678e0d311fa9aba9f195b3270f94
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2025-05-06 20:34:14 +02:00
Edward Welbourne
ed934ec497 Tweak a regex to only match what it's meant to
It's testing for either a .qm extension or the end of the file-name;
but it shouldn't match a .qml extension, so it should test the .qm is
at the end.  Thus it's a test for .qm-or-nothing at the end.
Amends commit 1f2ab46745af12e4776695c1b1a2523ac170368e

Change-Id: I3e47691bb7f576d21d61ce4988fc476421615add
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-06 19:37:54 +02:00
Edward Welbourne
dabc113cc8 Add QTranslator test for script-incompatible language truncation
Amends commit 0278a80d6876f38bb37f1d504e6b24a3512efb7a - I developed
the new test as part of adapting the earlier change to 6.8.

Pick-to: 6.9
Task-number: QTBUG-131894
Change-Id: I711e62db7e35fa26c396498354ffbb5aa23920a8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-06 19:37:54 +02:00
Kai Köhne
095cacd668 Do not treat the installation of an empty QTranslator as an error
The return value of installTranslator() should indicate whether
the _registration_ was successful. Apart from merely logging
the result, the only sensible action the calling code might
take is to delete the QTranslator object that failed to register.

The old behavior of installTranslator() for empty QTranslator
objects was to store the pointer for further use, but still return
false. This might lead to hard-to-detect memory corruption.

The patch changes behavior to _not_ consider installing empty
QTranslator objects as an error.

This has the following reasons:

* As translations are often done later in the SW development process,
it is common to replace empty .qm files with translated
ones in a very late stage. But having different code paths based on
this can be surprising.

* The other parts of the QTranslator toolchain do not treat
empty translations in a specific way, either.

While at it, also remove the now unused QT_NO_TRANSLATION_BUILDER
macro (left over from Qt 4).

[ChangeLog][Core][Behavior Change] QCoreApplication::installTranslator()
will now return true even for empty translators
(QTranslator::isEmpty()). This makes it explicit that empty QTranslator
objects are registered and queried, and therefore deleting the object
prematurely might result in undefined behavior.

Change-Id: Ia0531afcf5c72aa837406cf5de2cf73052014445
Reviewed-by: Masoud Jami <masoud.jami@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-06 06:53:31 +00:00
Magdalena Stojek
53622aca2a QXmlStreamWriter: add error-handling API
This change introduces QXmlStreamWriter::Error enum and three related
functions to enable error reporting during XML writing operations:
- error(): returns the current error state of the writer.
- errorString(): returns the corresponding error message.
- raiseError(): allows applications to raise custom write errors.

This complements the existing hasError() method and aligns the writer
with QXmlStreamReader's error handling.

[ChangeLog][QtCore][QXmlStreamWriter] Added error handling API with
QXmlStreamWriter::Error enum, error(), errorString(), and raiseError()
functions.

Fixes: QTBUG-82389
Change-Id: I4d57a9f611a303cf8dc05caf23b6d331a61684f9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-05-06 08:43:00 +02:00
Ahmad Samir
f8987b2d0a qdataurl: extend the unittests
Check:
- data: urls with a host are treated as malformed
- if the mime type is omitted, it's set to
  "text/plain;charset=US-ASCII" as per the RFC[1]
- the mime type of urls with a `charset` attribute are
  normalized by adding "text/plain;" (Qt implementation detail) if it's
  missing

[1] https://www.rfc-editor.org/rfc/rfc2397.html

Pick-to: 6.9 6.8 6.5 5.15
Change-Id: Ifd9736b7808226c8462e3d39798abda7b245c6d8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-05-02 23:54:37 +03:00
Joerg Bornemann
25b040acc1 CMake: Don't unconditionally enable the ASM language
CMake MR #10626 doesn't consider the MSVC compiler as valid assembler
anymore, thus unconditionally requiring ASM breaks with CMake > 4.0.1 on
MSVC.

Enable ASM only on non-Android Unix.
Remove the ASM language where it's not needed.

Pick-to: 6.5 6.8 6.9
Change-Id: I5df71edfce0f4920e39262f722e4bf95a735f31b
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2025-05-02 18:13:14 +02:00
Juha Vuolle
67ad781c05 Exclude tests that require future, when future is disabled (wasm)
qfuturesynchronizer and qresultstore both rely on QFuture. Guard
their autotests accordingly.

Task-number: QTBUG-136101
Change-Id: I84680fd3383ceaa486bff53ad04b4a39e9e20d51
Reviewed-by: Lorn Potter <lorn.potter@qt.io>
2025-05-02 08:25:10 +03:00
Christian Ehrlicher
29238407af Tests/QTreeView: use QCOMPARE_foo instead QCOMPARE
Replace some QCOMPARE(value > x) with QCOMPARE_GE(value, x) to get
better output on failure.

Pick-to: 6.9
Change-Id: I3f7fc80cf25776adab40cd61c08c58a49f6af0c5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2025-05-01 00:58:34 +02:00
Mårten Nordheim
70d3293d72 Http2: Fix 'Received' typo
Missing 'e'.

QHttp2Connection is private API so the API can be changed.
No known external users.

Pick-to: 6.9 6.8
Change-Id: I4f3daab9deff3250ff66066dc3e088edfbbfc5ef
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Matthias Rauter <matthias.rauter@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 20:03:25 +00:00
Juha Vuolle
cdeb245340 Skip UDP parts of tst_qnetworkinterface if UDP sockets not enabled
Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Ib3be9ae7c3a261c606cf242a15279491304de6b6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
01e253e77c Put tst_qnetworkproxyfactory behind networkproxy feature
..as it heavily relies on it and fails to build without.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Ie2ba55e485cf96d568b0b22f27e19ffa72f48da9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
6816273f0e Fix tst_dnslookup compilation when udpsocket is disabled
Guard the UDP socket includes and uses with feature flag.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: I1fe27244e6aa029407b07ebc06de137ec8b280af
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-30 19:35:55 +03:00
Juha Vuolle
2f91439d05 Fix tst_noqteventloop compilation if localserver disabled
..by feature-guarding localsocket and localserver uses.

Task-number: QTBUG-136101
Pick-to: 6.9 6.8
Change-Id: Icc6327fa222edda31fe9e88ec38c916dcd359eb0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-30 19:35:55 +03:00
Thorbjørn Lund Martsum
3692f14a30 Remove semantic tests in QHeaderView auto (+avoid signed overflow)
When QHeaderView was optimzed+refactored a unittest was requested.
However, since behavior didn't change a semantic test of certain
qheaderview aspects was added instead (to compare to old behavior).
It was suggested as a manual test, but it was decided to merge
it into the unit test.
With the risk of testing something twice, these semantic tests have
now been modified to be actual unit tests. Certain aspects of
behavior in QHeaderView may actually be wrong
(also highlighted by these new unit tests)
and changing QHeaderView for the better
would be difficult having these tests.
Furthermore, the changes were motivated by the test having
integer overflow.

Fixes: QTBUG-135201
Change-Id: Iabfaf9b57de5cb11d98ea27f352b17ab0f6cc613
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2025-04-30 13:43:40 +00:00
David Edmundson
1d3de3e8c8 tests: Fix role used by XdgPopups
Change-Id: Iec367da682588f615f9d8a193d912f5367de7ae2
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2025-04-30 15:34:08 +02:00
David Edmundson
8c0dd12f4b Drop workaround to turn popups into main windows
On Wayland there are additional requirements when making popups to Qt.

In regular cases we can guess what the popup parent should be based on
which window last received input, but as it's a heuristic with obscure
enough timing events this can sometimes fail.

In this situation the current code creates a toplevel instead of a
regular popup, having a popup take focus with a window decoration is
rarely a good UX. Rather than making an incorrect window, the new
approach is to not create a popup over the wire and synthesise an
immediate close event. Application code should be able to handle this as
it's the same path if the popup was denied server side.

Pick-to: 6.9
Task-number: QTBUG-136343
Change-Id: Ia76c36a047e93f2469a8bf0f4b94642f05179124
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
2025-04-30 13:18:46 +02:00
Edward Welbourne
2edd9286cf Fix long-form zone parts in date-time strings
Recent changes to date-time formatting arranged for time-zone names to
be localized appropriately. Teach the datetime parser to recognize the
long names that now implies, as well as IANA IDs, and ensure these
last are also used as a fallback when no localized long name is
available. Discrepancies between the platform time-zone backend and
our CLDR-derived name L10n (where needed, due to the backend lacking
it) make the naive approach to this (find any zone that matches,
expect them all to have the same offset history) fail, so take care in
this case to select as canonical an IANA ID for the named zone as we
can find. Add a round-trip test and adapt an existing test to
round-trip when it can.

[ChangeLog][QtCore][QDateTime] The tttt format specifier now uses the
full long name of the zone, falling back to its IANA ID only if this
cannot be determined. Both forms are now recognized when reading a
datetime from a string.

[ChangeLog][QtCore][QLocale] When serializing a datetime, the tttt
specifier now uses the localized full long name of the zone, falling
back to its IANA ID only if this cannot be determined. Both forms are
now recognized when reading a datetime from a string.

Pick-to: 6.9 6.8
Fixes: QTBUG-130278
Change-Id: Ia28529790c0f600930d55c92a606adbcdfa852b9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-29 16:04:33 +02:00
Edward Welbourne
ef5d9702a9 Move system locale later in uiLanguages(), when adding it as fallback
Place it after the last mutually intelligible entry (same language and
script), or at the end if none, rather than at the start. The fact
that we add it at all was prompted by macOS leaving it out, which can
happen if the user has specified custom preferred languages that don't
match what they've specified for locale.

Adapted various test-cases to match the new behavior.

[ChangeLog][QtCore][QLocale] When the system locale itself is missing
from what the system reports as suitable languages into which to
translate the UI, it is now inserted later in the list, where
previously it was added at the front.

Task-number: QTBUG-104930
Change-Id: I378d266d6f8894cb17df9d09e841a266da73ecee
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2025-04-29 16:04:07 +02:00
Juha Vuolle
3bbe9d8ec7 Fix tst_qlocale compilation when jalalicalendar is disabled
The 'syslocaleapp' test helper application was built only when
jalalicalendar is enabled. The tst_qlocale on the other hand
depends on 'syslocaleapp' if process-support is enabled.

Thus if jalalicalendar was disabled and process-support
enabled, the CMake configure fails because tst_qlocale won't meet
its 'syslocaleapp' dependency.

Fix by building a more limited version of the syslocaleapp when
jalalicalendar isn't supported, and adjust the testcase accordingly.

Pick-to: 6.9 6.8
Task-number: QTBUG-136101
Change-Id: Ic809b0124d47754105ca09b69e2b3c12856ba63a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2025-04-29 17:00:12 +03:00
Magdalena Stojek
776dbdce7b QXmlStreamReader: add support for retrieving raw inner XML content
This change introduces a new function, readRawInnerData(), that returns
the raw inner XML content of the current element, including nested tags,
comments, CDATA, and processing instructions.

[ChangeLog][QtCore][QXmlStreamReader] Added readRawInnerData() for
retrieving the raw inner XML content of an element.

Fixes: QTBUG-85141
Change-Id: I96dd0790d726cf8a196125384cbf8f8fa2587880
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-29 16:00:12 +02:00
Matthias Rauter
9319f79060 Add tests for QUtf8StringView
This is a port from QLatin1StringView to QUtf8StringView.

Some functions of QL1SV have no counterpart to QU8SV:
* first() and last()
* count()
* indexOf()
* toUtf8()
that were not included.

Tests for user defined literals have also been removed. Some tests were
extended for utf8 string literals u8"".

Pick-to: 6.9 6.8 6.5
Task-number: QTBUG-132097
Change-Id: I0ceee00a7457360b430d13c3199f642f8e4c0036
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-29 15:11:05 +02:00
Volker Hilsheimer
db7e2d6fd0 QGIM: fix test coverage for gadgets-that-are-tuples
The test data for SingleColumn and MultiColumn disambiguation types
was incorrectly removed in 7803e6c000cc0fddba392bcbaefdc3a93ff4b26c.

Inserting rows of a MultiColumn wrapper around a pointer doesn't work,
so QEXPECT_FAIL that test for now.

As a drive-by, remove an obsolete QEXPECT_FAIL; we never add a table of
pointers in multiple value categories, as they all reference the same
data.

Change-Id: Ief4750094f8262f01ff81aa41d113971abd37307
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-29 03:04:50 +02:00
Volker Hilsheimer
25f5bd5f66 QGIM: simplify new/deleteRow for tables
Conceptually, a table can deal with rows that are a pointer type,
and nullptr. We test for validity before accessing the row element, and
can return gracefully from e.g. data() or setData(). This is also
acceptable for lists, where a newly constructed row will hold a nullptr
element as the item. Client code that wants to initialize new rows
explicitly can provide their own protocol, or connect to rowsInserted()
and rowsAboutToBeRemoved().

However, we might end up violating the requirement that in a table, all
rows have to have the same number of columns: if the row-type is a
pointer to a struct or gadget, and we don't instantiate the element,
then we end up with an index that is de-facto invalid even though
it is in range. setData() cannot do anything but return false, and
data() can only return an invalid QVariant.
And if the row type is dynamically sized, and the new row is inserted
at index 0, then we end up reporting that the model has 0 columns, as we
use row 0 as the reference for the column count.

To fix this, implement new/deleteRow consistently for pointers (and
smart pointers): if the row type is a (smart) pointer holding
a default-constructible object, then we can instantiate a new object.
The deleteRow implementation takes care of deleting raw pointers (as
otherwise the `delete row` expression is invalid); for smart pointers,
the smart pointer takes care of memory management.

All other row types can be instantiated by default constructing. This
covers MultiColumn/SingleColumn wrappers as well, which can hold a
nullptr while still reporting the correct column count.

Remove the special handling from canInsertRows() - if newRow() is
available in the protocol, then we can insert rows.

But one ambiguity remains: if we operate on a copy of a container that
has pointers for rows, then adding new rows might allocate (in the
model's copy), resulting in a mixed situation. The client code can not
delete those new rows (they don't exist in the original container),
while the model must not delete rows it didn't create (those do exist
in the original container and might still be used).

Perhaps that cannot be solved, other than by documenting: either move
your range in the model (then ownership is clear), or pass a reference
or pointer the model (then ownership is also clear); or use smart
pointers for the row type.

Change-Id: I18a2e929473d118dcdb9d1f2ed67a7890f681974
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-29 03:04:50 +02:00
Marc Mutz
4d839093b4 qDecodeDataUrl(): fix precondition violation in call to QByteArrayView::at()
It is a precondition violation to call QByteArrayView::at() with
size() as argument. The code used that, though, as an implicit
end-of-string check, assuming == ' ' and == '=' would both fail for
null bytes. Besides, QByteArrays (but most certainly QByteArrayViews)
need not be null-terminated, so this could read even past size().

To fix, use higher-level API (startsWith()), consuming parsed tokens
along the way.

Add a test that would crash in debug mode before the fix.

Amends the start of the public history.

[ChangeLog][QtCore] Fixed a bug in the handling of data: URLs that
could lead to a crash if Qt was built with assertions enabled. This
affects QNetworkManager and links in QTextDocument.

Pick-to: 6.9 6.8 6.5 6.5.9 6.2 5.15
Change-Id: I4331c88051dfbb0a18fe7da4f50858c707785d09
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2025-04-28 23:54:58 +00:00
Volker Hilsheimer
3c46f2ef96 QGIM: standardise detection of metaobject, also for smart pointers
Change-Id: I01acbfecfad582dd663c9ae2540be277414935db
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2025-04-28 17:27:40 +02:00
Ivan Solovev
ab48b4f266 QDataStream:: bump version
It is required to update the serialization of QGeoPolygon
in QtPositioning.

Need to adjust tst_qdatastream as well.

Task-number: QTBUG-135967
Change-Id: I81bf1c011717d5ecd92fd6c81136053b4f06bf49
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2025-04-25 17:44:43 +02:00
Ivan Solovev
f12115e97c Cleanup tst_qdatastream
Make NColorRoles constexpr and use static_assert() to verify that it
has a proper size.

Pick-to: 6.9 6.8
Change-Id: I40351e4815e248fe8cc07e906099172d5be531d0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-04-25 17:44:43 +02:00
Edward Welbourne
01eb9297d0 Skip redundant QLocale() argument to QTimeZone::displayName()
It's the default, and wasn't telling us anything illuminating about
the tests, so leave it out and save some line-splits.

Change-Id: I1bcc51db9b71489a3edcf25f4b2c7a90c86399bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-04-25 16:39:24 +02:00
Edward Welbourne
5a911f72c6 Check status of QDataStream in QTimeZone tests using it
It makes sense to verify the stream is OK after writing and reading,
so add those tests.

Change-Id: I459856ed0d991bc3bbe4044b6694c97970cf2787
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2025-04-25 16:39:24 +02:00
Edward Welbourne
0278a80d68 Correct initialization of justAfter in QLocale::uiLanguages()
It's used to determine whether a non-equivalent prefix of a locale
gets added at the end of the block of equivalent locales, or at the
very end of the list. Thus it should be initialized for each prefix as
it is processed, not before the name is trimmed to its first prefix.

Added the test-case that caught this.
Amends commit cbf49f735e3cca85922a85d6548666816686db78

This should work as-is in 6.9 but may be hard to back-port to 6.8.
None the less, I shall try for the latter, too.

Pick-to: 6.9 6.8
Task-number: QTBUG-131894
Change-Id: I75ab27153133d2608cf57f0bc998c1e3d0d1432c
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2025-04-25 14:39:23 +00:00
Shawn Rutledge
66595c3efe QTextMarkdownImporter: spell CRLF literal correctly
Amends eced22d7250fc7ba4dbafa1694bf149c2259d9ea

tst_QTextMarkdownImporter::frontMatter(yaml + markdown with CRLFs)
now does explicit replacement of LF with CRLF: git may convert the file,
so we can't rely on the CI test system checking out a true copy of
yaml-crlf.md; but QFile::open(ReadOnly | Text) ensures that we will
have LF line endings, not CRLF.

Pick-to: 6.8 6.9
Task-number: QTBUG-135284
Change-Id: I7eee5f41e7aea902a59ac06238e591ece016d2d3
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2025-04-25 08:04:53 +02:00
Juha Vuolle
11b54b85ce Fix tst_qnetworkreply compilation when networkproxy is disabled
Add a feature guard for test function relying on networkproxy.

Pick-to: 6.9 6.8
Task-number: QTBUG-136101
Change-Id: I69d97c84fb7d68f33f4b74fc8fd6665b1b8d6717
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2025-04-24 16:49:22 +03:00
Juha Vuolle
bdacb87cef Make autotests configurable without Widgets on Android
tst_android depends on widgets, and parts of the test
needs to be excluded if Qt is configured without them.

Pick-to: 6.9 6.8
Change-Id: Iaca5b4228c0a7bd7c3a2efe9da04f354ac7e7c1c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2025-04-24 16:49:22 +03:00