Commit Graph

6451 Commits (f45dffa8b4e5a3ddc3473203e27ebdeebfde10da)

Author SHA1 Message Date
Tasuku Suzuki bd6d7d4d74 Remove extra semi-colons
Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-06 20:17:18 +09:00
Edward Welbourne 46c1936e17 Rework tst_QTimeZone::windowsId() to use initializer-lists
Instead of clearing a list repeatedly to then repopulate it by
appending entries.

Change-Id: I82594d69c1cb145defff43d84f92f8410d8997aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-05 23:12:59 +01:00
Jarek Kobus 0d0810e2dc QObject: fix installEventFilterOrder() test flakiness
Don't rely on timer precision and use int counter instead.

Amends 1fe88bf4cd

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I057b4dd51014784ec9b244301b43583f3de6ddd1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-04 18:33:37 +01:00
Ahmad Samir d887e34b49 tst_qdiriterator: add a test for QFsFileEngineIterator
As a baseline for subsequent commits.

Change-Id: Ifac026848e92817b08a75ceafee6d06e0a8f399d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-04 14:04:18 +02:00
Lucie Gérard ff1039c217 Change license for tests files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-02-04 09:56:42 +01:00
Thiago Macieira c5f22c54cb qHash: provide the long double overload on Darwin systems
Commit c0791ac76e didn't explain why it
was #ifdef'ed out. It's just an alias for double. Maybe compilers at the
time used to complain if you used it, but I can't make Apple's clang
produce a warning now.

Pick-to: 6.7
Change-Id: I664b9f014ffc48cbb49bfffd17b02293403e9571
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-02-03 07:33:00 -08:00
Marc Mutz 6504496c64 QBitArray: use QDataStream::SizeLimitExeeded where applicable
[ChangeLog][QtCore][QBitArray] Uses new
QDataStream::Status::SizeLimitExceeded now, where applicable (was:
WriteFailed, ReadCorruptData).

Pick-to: 6.7
Change-Id: If5a8db9c6b2f104b40266784d88cf7cad0b0ce73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-03 08:33:14 +01:00
Marc Mutz 9219e8ff1d QBitArray: don't create invalid Qt 5 streams
Qt 5 streams cannot handle QBitArrays with more than INT_MAX bits,
even on 64-bit platforms, because of interface constraints (size_type
int).

Qt 6 can, so make sure to refuse serialization of oversized QBitArrays
to Qt-5-compatible streams.

[ChangeLog][QtCore][QBitArray] Now refuses to stream a QBitArray with
size() > INT_MAX to a Qt-5-compatible QDataStream.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I263e27bd366757c8e0360dfd337948c44d00647a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-02 15:35:51 +01:00
Edward Welbourne b0cb4a80e5 Modernize comparisons in tst_QLocale
QCOMPARE() can report enum values by name just fine, no need to
laboriously convert them to strings. While comparing all tags in one
go did allow a more comprehensive report, it's enough to know we
failed; this is testing cross-platform code, so a debugger can tell us
all those extra details if we get a failure.

Testing qHash() doesn't distinguish equal things is fairly low value;
at least avoid duplicating the construction of the reference value.

Replace a bunch of other QVERIFY()s with the new cousins of QCOMPARE()
for ordered and different comparisons.

In the process, mark some of the QLocale objects as const.

Change-Id: Ic93b8ed60c6f2cc846fbba428983778896d61291
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-02 08:26:14 +01:00
Edward Welbourne 5d451d514c Make TEST_CTOR macros use the "do { ... } while (false)" pattern
They were expanding as simple blocks, so their uses didn't end in
semicolon, which looks wrong when reading the code.

Pick-to: 6.7 6.6 6.5
Change-Id: Ibea7b01ac165045604b6eb7a838765b2061c368a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-02 08:26:09 +01:00
Edward Welbourne 063026cc50 Update QLocale and calendar data to CLDR v44.1
(This turns out to be identical to v44, for our purposes.)

The CLDR license has been revised at v44 to "UNICODE LICENSE V3",
which is now included (as LICENSES/UNICODE-3.0.txt) in addition to the
old license (still in use, presumably, by UCD - at least until its
next update). Some new QLocale::Language entries are needed. There is
no change to the time-zone data.

Some tests needed changes:
* Various Arabic locales now use U+0623 (Arabic letter aleph with
  hamza above) in exponent separator, replacing plain U+0627 (Arabic
  letter aleph); it is still followed by U+0633 (Arabic letter seen).
* Where likely sub-tags used to fill in world, 001, as territory for a
  language, they now (e.g. for Prussian and Yiddish) give specific
  countries.
* Tamil locales now have something of a mix of inherited and localized
  forms for AM/PM, which looks a lot like a mistake in CLDR.
* New likely sub-tag rules fix ctor(und_US) and ctor(und_GB), which
  previously failed.

[ChangeLog][Third-Party Code] Updated QLocale's data extracted from
the Unicode Common Locale Data Repository (CLDR) to v44.1. The license
changed to Unicode License V3.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-121485
Task-number: QTBUG-121325
Change-Id: Ide1a68016129526d7a5aa3fc67f1a674858696bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-02 08:26:03 +01:00
Ahmad Samir 1fe88bf4cd QObject: add unittest to check the order of eventFilter() calls
installEventFilter() prepends new objects to the eventList, so that
events that are posted while processing events are left to the next
round of event processing.

This is a baseline test to check that subsequent commits preserve the
current behavior.

QCOMPARE_GT is available since Qt6.4, so make the check backportable to
older releases too.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Task-number: QTBUG-120779
Change-Id: I5ed5e9c2917a9be62de4af19c3b72889399b4fe6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-02-01 23:42:56 +02:00
Piotr Wierciński c23d3ca1f0 wasm: Disable problematic qlocal test for time being
Upgrading emscripten to 3.1.50 breaks this test, so we disable the time
for time being. After emscripten update this test is to be enabled
and fixed.

Change-Id: Ic48d81e2285ed8f7639bf20c6c29b2b9e402a591
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-02-01 19:25:43 +00:00
Ahmad Samir 986b5b4f47 QDirIterator: don't create test dirs/files in the source dir
This is cleaner as the test dirs/files are created in a QTemporaryDir
that is cleaned up automatically, so less manual cleanup in the
unittest.

This also fixes issues for build environments where the source dir is
read-only.

entrylist dir in the source dir is only needed for the construction of
the QResource in the CMakeLists.txt.

Task-number: QTBUG-117449
Change-Id: I3e6389ff730c3a617854e85318f80838e012f2c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-01 16:28:55 +02:00
Volker Hilsheimer cfcd56a78f JNI: Fix QJniObject::callback test case
Don't call the native function directly, call the Java function that
calls the native function.

Pick-to: 6.7
Change-Id: Icdcf250313a38f6e4bc2b90fb7b0adbfa5a890fb
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-02-01 14:22:35 +01:00
Marc Mutz 2188ca2c5d QVersionNumber: make iterable
Since QVersionNumber doesn't have an existing way to modify individual
segments, provide only const_iterator.

[ChangeLog][QtCore][QVersionNumber] Added (const) iterators over
segments (begin()/end(), incl. c- and r- variants).

Change-Id: Ia9af70c2a9c59f630123894ad2c9f38031ef5b8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 20:18:48 +00:00
Marc Mutz 0808beace3 QBitArray: fix potential truncation in QDataStream op>>()
In Qt 5, a QBitArray could not contain more than INT_MAX bits, because
the then-size_type, int, cannot represent more, even if the underlying
storage could hold 8x as much, and the serialisation format, using
unsigned int, could represent 2x.

Therefore, reject old formats with sizes that exceed INT_MAX elements
as corrupt.

Likewise, the Qt 6 serialisation format unconditionally uses 64-bit
sizes, but 32-bit platforms still cannot represent more than
numeric_limits<qsizetype>::max() (= INT_MAX) bits in memory. This is a
valid stream for 64-bit platforms, though, so ideally, this should be
using SizeLimitsExeeded, which, however, is only available from Qt
6.7. So, for now, and until we have SizeLimitsExeeded, mark the stream
as corrupt here, too.

[ChangeLog][QtCore][QBitArray] Fixed undetected overflows in the
deserialisation (opertor>>()) from QDataStream.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Ib24cf9218c06a3a05185723c77d4313611c2dd40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 21:18:47 +01:00
Ahmad Samir 4488dad13b tst_qdiriterator: cleanup
- Match QCOMPARE logic when printing stringlists that don't match, it's
  "actual" then "expected"
- Use row tag names that don't interfere with the shell; e.g. using
  `tst_qdiriterator iterateResouce:':/testdata'` doesn't work for some
  reason, so just add a qrc prefix

Change-Id: I3d556b83ec34f2dab15ea3178273af10fb2c62e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 17:55:33 +02:00
Krzysztof Sommerfeld 6efc95b699 Exclude test from compilation without qprocess
Change-Id: Iea3a28b25bdb828b0eb2ae0381489aa207f348fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 13:21:55 +01:00
Krzysztof Sommerfeld e566447e6b Exclude VxWorks from cxx 23 mode compilation of qcomparehelpers
Change-Id: Ia217a76ad96851a3ad9dedae4ab3ff1c2b3b92c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 13:21:55 +01:00
Krzysztof Sommerfeld ac6a9f9bfa Add cxx11_future in QPromise tests and disable it for VxWorks
cxx11_future flag should be disabled for VxWorks. VxWorks still does
have some bugs related to this std features and some parts of code needs
to be excluded. At least till the 24.03 VxWorks release as for now this
is the expected release that should contain fixes.

Task-number: QTBUG-115777
Change-Id: Ic652403697d727f4ae05ae7287ff8285075d3802
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 12:21:55 +00:00
Marc Mutz c6aa399d06 QBitArray: avoid overflow in size-to-storage calculations
Unlike other containers, a QBitArray's size() is not limited by
storage, but, esp. on 32-bit platforms, its size_type: A INT_MAX
size() QBitArray only requires 256MiB of storage.

So we can't rely on "won't happen in practice" here and need to avoid
the potential UB (signed overflow) in the (size + 7) / 8
logical-to-storage-size calculation by using unsigned arithmetic.

Use the opportunity to Extract Methods storage_size() and
allocation_size(), which differ by one (d[[0] contains the size() mod
8), making it clear what's what.

[ChangeLog][QtCore][QBitArray] Fixed a bug with QBitArrays whose
size() came within 7 of the size_type's maximum.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I5d94bae9c9c210ba1e36f8cf03609125c81bd15d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-01-30 22:28:19 +01:00
Edward Welbourne f4f35fe84a Add expect-fail test-cases for und_US, und_GB to tst_QLocale::ctor()
These exhibit the problem described by a recent bug report.

Task-number: QTBUG-121485
Change-Id: Ia09acfa22e687ba096091a73f30df1ffd22a6e32
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-01-30 14:48:17 +01:00
Edward Welbourne 4fe7e8e51a Rework tst_QLocale::ctor() - split up and make data-driven
There were three things going on in this test (itself a sufficient
reason to split it up):
* Some reporting and checking of the default locale; the reporting is
  duplicated in defaulted_ctor() and the check fitted more naturally
  there.
* Checks that various combinations of language, script and territory
  got resolved according to likely-subtag rules. These were handled
  via a macro and natural candidates to become data-driven.
* A test that territory is preserved when it's the only given tag
  (with a few known exceptions); broken out as a steparate test.

In the process, give the data-rows of the likely-subtag parts names
that let me extend their testing to also test construction from
string. The territory-only cases can't support that, as QLocale
doesn't support und_* forms of tags for unspecified language.

Change-Id: Id9f0fc46f30eb887b47931bad1619255acb44266
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-30 14:48:17 +01:00
Edward Welbourne 23602b04ba QTEST()-ify QLocale tests
Replace various QFETCH()/QCOMPARE() pairs with QTEST().
Just because it's terser.

Change-Id: I8496a293e3634991dcb33b8c7939f1c3028a63c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 14:48:17 +01:00
Volker Hilsheimer cc5251ed59 QJniArray: make reverse-iterable
Add rbeing/rend overload, relevant typedefs, and decrement operators.
As a drive-by, add noexcept to begin/end functions.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I32d9a7d50a1f03550944c2247516c455d4822fe7
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Volker Hilsheimer e5074cd354 QJniArray: add missing post-increment operator
Augment test case. Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I326395397167edb05ff1f45f7151614c02b7e7eb
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Volker Hilsheimer 8f04615bcd QJniArray: add missing typedefs
Add missing nested typedefs for both the QJniArray container and
the QJniArrayIterator. Expand test case to make sure that some standard
algorithms (such as std::distance and ranged for) work with those
types.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I96f348215c6f1e0e1ce777d9bdd2f172d7e52974
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-29 16:06:47 +01:00
Edward Welbourne 904f1d3b13 tst_QLocale: add some basic endonym tests
Actually triggered by investigating QTBUG-121485, where the issue
turns out to be at construction time, but the complete lack of any
testing of endonyms clearly needed addressed in any case. In the
process, break up the long list of private slots in the test-class
declaration.

Task-number: QTBUG-121485
Change-Id: I49021f78d3bea2e1e55b2755a45943ab3fc23722
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-29 15:14:43 +01:00
Edward Welbourne e657c31e33 tst_QLocale::dayName(): Convert some dangling code into test rows
Every test row was following its locale-specific test with tests for
Irish and Greek day names, repeated regardless of the locale-specific
data. Express these tests as rows in their own right and shorten the
per-row testing, so we only do each once.

Change-Id: I8f919b50ac54423bacab6e5a9d34254b7db59a55
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-29 15:14:42 +01:00
Edward Welbourne cee1c620d5 Package up a repeated piece of testing in a macro
In the process, change it to use QCOMPARE(A, B) rather than QVERIFY(A == B).

Change-Id: I26c64100b08aef43c56f5266c0de71f5cde12816
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-29 15:14:42 +01:00
Marc Mutz 94e122c594 QSpan: make adl_begin() etc SFINAE-friendly
The definition of iterator_t, and, therefore, of is_compatible_range
depends on this, otherwise say, 0, is being treated as a valid range
and hits a hard error in adl_begin() when trying to call begin(int&).

TIL: decltype(auto) does _not_ SFINAE.

Fix by calculating the return type manually, re-enabing SFINAE.

Pick-to: 6.7 6.6
Change-Id: Icacd70554f4050ecaeb396c9ae60bc4f21a220c9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-26 23:50:57 +01:00
Ivan Solovev 36cc9fc54a QDataStream: add a new SizeLimitExceeded status code
This status is supposed to be used when the stream tries to read
or write more data than it is supported by the current platform.
For example, reading more than 2 GiB of data on a 32-bit platform will
result into this status, but it will work fine on a 64-bit platform.

This patch uses the new status in read operations.

Amends fd48ce0b73

Found in 6.7 API review

Pick-to: 6.7
Change-Id: I675b1ee25fafba174ce8f94c3470dbb7893d6d9e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-26 15:10:16 +01:00
Fabian Kosmale ac001bef79 moc/QMetaProperty: Remove limitation on non-own-class notify signals
The moc generated code does a sanity check that NOTIFY signals actually
exist in the parent class when they cannot be found in the class moc
currently runs on.
The logic there was however too simplistic, and couldn't deal with
signals taking a parameter.
Fix this, and take the opportunity to use a proper static_assert instead
of generating a "normal" compile error.

We do not do any checks for the presence of QPrivateSignal, as the whole
point of QPrivateSignal is that it should be private (and not e.g.
protected).

Moreover, we adjust QMetaProperty::notifySignalIndex to take
single-argument notify methods into consideration as well when
encontering an unresolved notify index.

Fixes: QTBUG-115989
Pick-to: 6.7
Change-Id: I8a056a15777f3132691e207b4b9ab6c2c9b2126d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-01-26 14:51:35 +01:00
Christian Ehrlicher e752c77b35 QObject: Let moveToThread return succcess state
Add bool QObjectPrivate::moveToThread() which returns the success state
of the attempt to move the object to the new thread. For Qt7 the public
signature of QObject::moveToThread() should be changed to directly
return this value.

[ChangeLog][QtCore][QObject] QObject::moveToThread() now returns a
boolean success state.

Pick-to: 6.7
Change-Id: I8441c8155a76b804b473ab9c45c2be6840ef1677
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-24 21:35:09 +01:00
Krzysztof Sommerfeld d480d66874 Add VxWorks to skip condition when utimensat function is required
VxWorks does not implement utimensat function

Change-Id: I4c507b76636c912c8b6161292f73e020b29da49b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-24 19:41:08 +01:00
Volker Hilsheimer 100071af82 QJniArray: fix const_iterator declaration, make it default-constructible
Iterators are required to be default-constructible and
value-initialized iterators must compare equal.

In a const_iterator, the pointee should be const, not
the iterator itself.

Found during header review.

Pick-to: 6.7
Task-number: QTBUG-119952
Change-Id: I036c0a62ade8c59dc5d62c0823b375223719af3f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-24 00:26:37 +00:00
Volker Hilsheimer 2c9525a501 QJniArray: add test case for QJniArray::size
Fix build of the test by removing the reference from the
container type before accessing the nested typedef.

Pick-to: 6.7
Change-Id: Ic35f312bac70b8f8f80149a3432329070c8c8c7d
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-23 13:56:54 +01:00
Thiago Macieira 79e1389fb9 QProcess: align treatment of early start errors
There are a couple of possible runtime errors that could happen before
the state was changed to QProcess::Starting. This aligns the Unix code
with Windows, which has the state transition at the top, and with the
documentation which says we will enter QProcess::Starting state.

Complements commit 956b249528, repeating
what it did for Unix (removing the overwriting of the error message that
openChannel() sets) on Windows. We also need to ensure cleanup() is
always called.

Pick-to: 6.6 6.7
Change-Id: I76ffba14ece04f24b43efffd17aafdd47f908bf1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-22 21:44:21 -08:00
Joerg Bornemann a7a9a1d43c Un-blacklist QMessageLogger backtrace tests for b2qt 64bit
They are working fine by now.

Change-Id: I24b1ac61791a850da85347c9718df678dfea2706
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-22 17:51:56 +01:00
Joerg Bornemann 5b9654613b Blacklist QMessageHandler backtrace tests for b2qt 32bit
Un-blacklist tests/auto/corelib/global/qlogging for Boot2Qt+CMake, since
we only have a CMake build by now.

Task-number: QTBUG-90545
Task-number: QTBUG-121389
Change-Id: Ia9d5fb2344598d58e06595c9cef93d5bba3de0cb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-01-22 17:51:56 +01:00
Ahmad Samir 17b414f75a QProcess: use enum types in tests instead of plain int
Pick-to: 6.7
Change-Id: Ibba85d28c2a5329f9224ffdc893f2dab8e672ee9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-22 00:33:03 +02:00
Tinja Paavoseppä 06d2aa91eb Android: Add a context delegate for embedding QML to native Android
When we are embedding a QML view to a non-Qt Android app, there are a lot
of functionalities that are shared with the refular Qt Android app, but
some are not. We should not, for example, try to control the hosting
Activity.
Create a base class that both the QtActivityDelegate, used for the
standard Qt for Android app, and the delegate for the embedding case
can extend.

In this commit, the QtEmbeddedDelegate is very simple, the
biggest difference to QtActivityDelegate being it does not create
a QtLayout or instantiate a QtAccessibilityDelegate.
It does start the Qt app, without waiting for a layout, and register
to listen for changes in the state of the Qt app.

Taking the embedded delegate into use, loading the embedded QML
views and their handling is added in a follow up commit.

Task-number: QTBUG-118872
Pick-to: 6.7
Change-Id: Id390a2b35c70b35880523886bf6fcf59d420cb42
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2024-01-21 15:46:30 +02:00
Allan Sandfeld Jensen 92acc94fa9 Optimize QSet::unite
Done similar to intersect. This also improves one test, as we get one less detach, and makes it consistent with other results.

Change-Id: I4d08bf43e750c758b363f8e4fe1fe312a7a0cde4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-20 08:55:06 +00:00
Ivan Solovev cfc385ce3f qfloat16: make relational operators constexpr when QFLOAT16_IS_NATIVE
When qfloat16 uses float as an underlying type, the operators cannot be
constexpr, because operator float() is not constexpr.
However, operator NativeType() is, so we can make the relational
operators constexpr when we are using a native 16-bit float as an
underlying type.

To avoid code duplication, introduce new temporary macros for
constexpr and Q_DECLARE_PARTIALLY_ORDERED_LITERAL_TYPE.
Extend the tests to verify that the operators are constexpr when
native float16 type is used.

Task-number: QTBUG-119433
Pick-to: 6.7
Change-Id: I001b087d78c398c71b71a504b65c316199dd4792
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-19 13:58:57 +01:00
Ivan Solovev 1353c6f857 Introduce macros to simplify testing comparison
The problem with the QTestPrivate::testAllComparisonOperators() and
QTestPrivate::testEqualityOperators() functions is that if they fail,
they point into the helper function, but not into the actual test that
called the helper function. This is specially annoying when some test
calls the helper function multiple times.

This patch introduces the helper macros QT_TEST_ALL_COMPARISON_OPS and
QT_TEST_EQUALITY_OPS that wrap the respective function calls together
with the QTest::currentTestFailed() check. If the test has failed,
the macro generates a meaningful debug message with the original file
name and line number.

This patch also applies the new macros to qtbase.

Task-number: QTBUG-119433
Pick-to: 6.7
Change-Id: Iad709de45e5bf53c82e7afa8e9f51e9275c1e619
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-19 12:58:57 +00:00
Axel Spoerl d880351553 QMimeDataBase: Remove dead code
Remove dead code.

Task-number: QTBUG-118566
Change-Id: I4fd912a891733cc1624be2a631cb47f930b82963
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-16 22:56:44 +01:00
Thiago Macieira 80df23bc7b tst_QStringView: don't go through the QString constructor
Amends d351a97e85.

Pick-to: 6.2 6.5 6.6 6.7
Change-Id: I5201966b308e48989c06fffd17a9aa4d086e6039
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-01-14 17:49:12 -08:00
Marc Mutz 6d005b7c57 tst_QCompareHelpers: fix narrowing warning
Warns MingW (or, in general, any GCC 13):

   warning: converting to 'QtPrivate::NativeFloat16Type' {aka '_Float16'} from 'double' with greater conversion rank

See also a61d752951.

Fix by using ints instead.

As a drive-by, make the variable constexpr.

Amends 4b755bc11a.

Pick-to: 6.7
Change-Id: Ie3f3c51aa7e9323c7ba96c810d2e95247d222fd2
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-01-12 09:38:18 +00:00
Thiago Macieira d351a97e85 QString::arg: don't pass nullptr to memcpy()
A null QString / QStringView has a null begin pointer stored as its
array beginning (something we hide a little in the QString::data()
function, but not in QStringView::data()). We've been passing a null
pointer to memcpy() every time someone passed a null QStringView for
QString's single-argument arg() call, though not the multi-string arg()
version (which is the only one QStringView offers).

Commit f5021835df made this worse by
making QStringViews created from null QStrings retain the nullness (as
was intended).

Fixes: QTBUG-120624
Pick-to: 6.2 6.5 6.6 6.7
Change-Id: I6e2677aad2ab45759db2fffd17a870639b19340b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-11 00:37:29 +00:00