Commit Graph

13786 Commits

Author SHA1 Message Date
Sona Kurazyan
a3f7dd5260 Allow brace initialization for some of QLatin1StringView constructors
Removed "explicit" keyword from constructors taking
(const char *, qsizetype) and (const char *, const char *).

Switched to using brace initialization for creating QLatin1StringView
in QtCore.

[ChangeLog][QtCore][QLatin1StringView] The (const char *, qsizetype)
and (const char *, const char *) constructors are no longer explicit.

Change-Id: I4f6760692e4df60fe4231e86a25f6ea03cd1bf82
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-04-01 19:33:12 +01:00
Pasi Petäjäjärvi
1032cc54ea Revert "Blacklist: test cases blacklisted in tst_QSystemSemaphore:"
This reverts commit 797a6ca7e6.

Reason for revert: Fixed 98de89cc15

Task-number: QTBUG-101618
Change-Id: I49c59715b8880bd89cc5cd0c8b3443a834689bab
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
2022-04-01 08:00:39 +00:00
Sona Kurazyan
de6a004bc5 tst_QByteArrayView:: disable failing constexpr checks for GCC
When comiling with ubsan, GCC is being too restrictive and ignores that
'static constexpr char []' can never be nullptr. It tries to evaluate
the comparison with nullptr, and fails with:

 error: ‘(((const char*)(& hello)) == 0)’ is not a constant

Disable the checks when compiling with GCC.

Fixes: QTBUG-101307
Pick-to: 6.3 6.2
Change-Id: I8322bb7cb326e06cd03b8b107c46a494c825087b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-04-01 09:51:29 +02:00
Tor Arne Vestbø
496bf5a946 lance: Handle unspecified size or weight in setFont command
We have test cases that call setFont without a specified weight, in
which case we would end up parsing an empty string into a number,
giving a weight of 0. This weight would in turn result in the
thinnest font on the system, which presumably was not the intent.

We now use default sizes and weights (similar to the default QFont
constructor arguments) if we're missing those arguments to setFont.

Pick-to: 6.2 6.3 5.15
Change-Id: I5a96f08cfa1b9e4f1de5edee6bf69ddd46f0ce92
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-31 20:54:29 +02:00
Edward Welbourne
3febcd6286 More startOfDay() fixes, in tst_bench_QDateTime
Update a QDateTime benchmark to use QDate::startOfDay() when setting
up its lists of date-times in helper functions, and to use noon as the
moment in the day in a creation test. Also move creation of a QTime
outside the loop: we're testing speed of creation of QDateTime here,
not QTime (and were already using the most trivial QTime constructor).

Change-Id: I26bf3369aae84a802ab03791f7341e107fede87c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-31 17:42:47 +02:00
Qt CI Bot
c168edba21 Merge integration refs/builds/qtci/dev/1648720546 2022-03-31 14:02:01 +00:00
André de la Rocha
4114a0ea75 Windows QPA: Fix slowdown with large table/tree views with accessibility
The accessibility code for notifying focus changes related to a
table/tree view was iterating over all items to find the focused one,
which for a very large number of items could cause a major slowdown
and UI freeze. This patch avoids the issue by removing the loop and
implementing the focusChild() method in the table/tree accessibility
classes.

Fixes: QTBUG-100997
Pick-to: 6.2 6.3 5.15
Change-Id: I04c847a5e65223b7a93ab82363feb32e1ebab9f3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-31 09:04:09 -03:00
André de la Rocha
37b702dc12 Windows: Fix accessibility tests
Accessibility tests were not being built on Windows as they were
depending on a WindowsUIAutomationSupport internal module that no
longer exists, as the UI Automation support classes are now in QtGui.
The patch also fixes a test that was calculating widget geometry
incorrectly on high DPI screens.

Pick-to: 6.2 6.3
Change-Id: Iefed0f6d147853484dfab4b16838b9088fd32dcf
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-31 09:04:08 -03:00
Ivan Solovev
aa451b13b0 Android: enable tst_QScreen::grabWindow
Two things are done here:
- use showNormal() instead of show() to get an expected widget size.
- skip the test if HighDPI scaling is enabled with non-integer scaling
  factor, because there can be rounding errors.

Fixes: QTBUG-87390
Pick-to: 6.3 6.2
Change-Id: I653a17bac2142838b03a328e1629582384b6c7b3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-31 11:48:54 +01:00
Mårten Nordheim
8367be8ede QNetworkInformation: Deprecate vague load functions
And replace them with more descriptive versions

Change-Id: I3d5256072a5bbe0919a08b800877aa9b6a305a0b
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-03-31 11:54:42 +02:00
Edward Welbourne
605c747321 QSettingsPrivate: fold from/to parameters into the view they bound
Two methods of the private class used to take a QByteArray with from
and to indices into it, for where to start and stop a scan. Now that
they take a QByteArrayView, those parameters can be used by the caller
to shorten the view to the desired portion.

Change-Id: Id1586afb87a9e8a189b69e485278375ff504fb7b
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-30 21:37:24 +02:00
Assam Boudjelthia
d1d96a3cdd Android: skip crashing tests tst_QOpenglWidget::clearAndResizeAndGrab()
Skip the crashing case temporarily to allow other tests to run
while finding a fix.

Pick-to: 6.2 6.3
Task-number: QTBUG-100470
Task-number: QTBUG-102043
Change-Id: I8b16f95e5c66b95cc9959494b5317d39d58194e6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-03-30 21:55:21 +03:00
Pasi Petäjäjärvi
8e08286d45 tst_QNetworkInterface: Update network test server handling
Adds docker support and makes it no longer skip the whole test
if there is no docker or network server.

Pick-to: 6.2 6.3
Change-Id: Ie98496df338a804d5c9842cce372e3410fdf9990
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-03-30 17:33:08 +00:00
Pasi Petäjäjärvi
82188607e3 CI: Add docker support for qnetworkaccessmanager_and_qprogressdialog test
Currently test relies solely for external test server. This makes it
not possible to run test successfully with environment where docker is
used.

Pick-to: 6.2 6.3
Change-Id: I51f4f48a80c1be8dd24359fe24d9cbfd471d2195
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-30 19:33:08 +02:00
Ivan Solovev
ad9f748db5 Android: skip tst_QNetworkProxyFactory::genericSystemProxy
Android uses its own implementation of QNetworkProxyFactory, so the
test of a generic implementation will never be working there. The
"http_proxy" environment variable is simply ignored in Android's
implementation.

Fixes: QTBUG-87385
Pick-to: 6.3 6.2
Change-Id: I3c24e3481b70872d332310aa86c68adad9c2b7e6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-30 19:05:59 +02:00
Ivan Solovev
7c9b4f86b6 Android: activate tst_QPluginLoader
- Use QT_ANDROID_EXTRA_LIBS to correctly deploy libraries on Android.
- Update the test code to use application libraries directory
  on Android.

This allows to enable the test for Android in CMakeLists.txt

Task-number: QTBUG-87438
Pick-to: 6.3 6.2
Change-Id: Ib74da036472320736888052b63a45ca50431de48
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-30 19:05:59 +02:00
Ivan Solovev
ed6fe5abc8 Android: activate tst_QLibrary
On Android we demand the libraries to always start with "lib" and
end with ".so" extension. Also Android does not support versioned
libraries.

This patch updates CMakeLists.txt to fulfill these requirements,
and also omits some unsupported test cases.

This allows to enable this test for Android in CMakeLists.txt

Task-number: QTBUG-87438
Pick-to: 6.3 6.2
Change-Id: Iec30acdefe00c471acc7139cd255b3389e31d22b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-30 19:05:59 +02:00
Edward Welbourne
784f5d76b9 TAP test logger: report B?XFAIL (mostly) as a message
Previously, only the first B?XFAIL would be reported, all others would
be discarded. Furthermore, if a B?XFAIL had happened, B?PASS was also
not reported, since the B?XFAIL served as test line. However, if the
B?XFAIL was followed by a SKIP, B?XPASS or B?FAIL, these were reported
as normal, producing exactly the kind of duplicated test line that the
skipping of B?PASS was meant to supply.

So change B?XFAIL to be reported among the messages, but retain the
TODO annotation of the first on the test line of a subsequent B?PASS,
if nothing more drastic happens in the mean time. So now more than one
B?XFAIL can be reported, the test is still marked as a TODO and we
don't get duplicate test lines for a subsequent non-passing result.

This replaces the bool m_wasExpectedFail member with a QTestCharBuffer
m_firstExpectedFail that records the first XFAIL's TODO line (so its
isEmpty() fully replaces m_wasExpectedFail).

Previously, the at/file/line information for a B?XFail would be
supplied as top-level keys in the YAML block for a "Pass" reported as
not ok due to the XFail, as this location information is now part of
the B?XFail's message in the extensions/messages block. Duplicating
the first B?XFail's location at top level would add complexity and is
arguably misleading, as the test result is really a pass (after
ignoring known issues), and the location of the pass is indeterminate
(nominally the end of the test function, but actually also after the
cleanup() call for this test, when relevant), which is why a Pass has
no location information.

Task-number: QTBUG-96844
Change-Id: Ib3f24f56266ff49bf3bc9759ac8263ac69a62130
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-29 22:21:58 +02:00
Edward Welbourne
ac38401d31 Move TAP's messages block to after the primary report details
In the process, split it from its comments block and don't bother with
a YAML block if it would only have contained comments.

Task-number: QTBUG-96844
Change-Id: I08c20f796252bb270ba9caa4c055cdcc0843a88b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-29 22:21:58 +02:00
Edward Welbourne
299186602a Add a test and remove a work-around for a fixed bug
The ASN.1 parser for a date-time had to check the date-time string was
all digits to catch the case of a sign in the month field, which used
to be accepted when it should not be. That bug has now been fixed, so
remove the work-around and add a second date-time test-case, renaming
(and modernising) the existing one for consistency.

Task-number: QTBUG-84349
Change-Id: I649c5129312b6865af08b22ba6893cb4e29243f8
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-29 22:21:57 +02:00
Ivan Solovev
d85c6527b5 Android: fix fullscreen handling
Commit a35a7fcb5a introduced the usage
of insets to correctly take into account the default Android status bars
and other reserved regions.

However in practice that does not work as expected - the bottom inset
is always reported to be non-zero, even when fullscreen mode is enabled.
To fix the issue, FLAG_FULLSCREEN is explicitly checked before applying
the insets.

Fixes: QTBUG-99624
Pick-to: 6.3 6.2
Change-Id: I8b25f0b06447cd452c42ef072493e3137e25f38b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-29 13:56:14 +01:00
Ivan Solovev
3033d89674 Android: activate tst_QWidget
Fix some obvious issues, QSKIP or blacklist other problems.
This does not fix all the test failures, but allows to enable most of
the test cases, so that we could catch future regressions.

Task-number: QTBUG-87668
Pick-to: 6.3 6.2
Change-Id: I1ed0b476d4ac55c658c572cfa1379fcdc6137ee8
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-29 13:56:14 +01:00
Ivan Solovev
2a893db480 Android: enable tst_QLocale
Do not try to properly specify a path to an external syslocale app,
because the related test can't be executed on Android anyway.
This fixes a failure in initTestCase() and allows to unblock other
test-cases.
Also skip systemLocale() test, because Android platform plugin already
creates a custom QSystemLocale instance, so a hack with MySystemLocale
does not work.

As a drive-by: simplify the #ifery in initTestCase() and remove an
unused second parameter of QSKIP() in emptyCtor_data().

Fixes: QTBUG-87414
Pick-to: 6.3 6.2
Change-Id: Iefc587062362469856fdca77f9ec9d96f5552e45
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-29 13:56:14 +01:00
Ivan Solovev
9578a3f72f QFileSystemWatcher: Blacklist failing tests on macOS arm
The tests started failing for some reason, so blacklist them to
unblock the CI.

Task-number: QTBUG-102095
Task-number: QTBUG-102096
Change-Id: I3e0667581bb1a9fd08dedcdab08878b1f738ac92
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-29 00:39:20 +00:00
Edward Welbourne
7d60fde9a7 Include file and line information in TAP diagnostics blocks
When producing a diagnostics block, include the file and line
information, if we have it, to describe it. This presently only adds
this information for skip, but could in principle do the same for a
B?XPass.

Task-number: QTBUG-96844
Change-Id: I6cc375d98e2369eba262010f9c2dfbcba931a6f1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-29 00:05:12 +01:00
Edward Welbourne
ae37fa0464 TAP test logger: move messages into the diagnostics block
Our TAP output was delivering messages as comments before the test
line, where TAP clearly expects the details of a test to follow its
test line. Version 13 provides a YAML block to deliver diagnostics and
encourages use of this, so accumulate our messages in a
QTestCharBuffer instead of emitting them one by one.

However, messages produced after a test has produced its test line
belong to that test, but are too late to be included in its
diagnostics block, so should be emitted immediately as before, albeit
now with a type prefix. This at least separates such messages, from
the end of one test, from messages produced early in the next.

In the process, add a type-prefix to each, to make clear what type of
message it was. Since the Yamlish supported by TAP consumers doesn't
support a way to have many messages, use the extensions: top-level
hash tag with a messages: sub-tag to gather our messages as a list.
(This expands at least one expected output file significantly and
substantially rewrites some others.)

Add methods to QTestCharBuffer, and a helper function, to support this.

Task-number: QTBUG-96844
Change-Id: If44a33da5879ed1670ef0980042599afd516f9d2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-29 00:05:12 +01:00
Ivan Solovev
d329a98fa9 Android: re-enable skipped tests
Now when 71b3d18ea7 is merged,
we can re-enable the previously skipped tests, as they do
not crash anymore.

Task-number: QTBUG-101423
Task-number: QTBUG-101321
Task-number: QTBUG-87417
Pick-to: 6.3 6.2
Change-Id: I6b4b3619b0af5e48b5e92b514bc0ab6586a76d51
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-29 00:01:30 +02:00
Ivan Solovev
9a4c32cedd Android: unblacklist tst_QStringConverter::convertUtf8()
The test was failing because test data was not provided correctly.
That was fixed in 4aea86f5e8 but the
test was never unblacklisted.

Fixes: QTBUG-87418
Pick-to: 6.3 6.2
Change-Id: Ibef7dcfaf59ef50f90d6538a562d03af17f065e0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-28 08:52:31 +01:00
Marc Mutz
edb64351cd QDom: preserve empty CDATA sections
Restores Qt 5 behavior.

Fixes: QTBUG-101992
Pick-to: 6.3 6.2
Change-Id: I3b9fc077c0a0fd30f4fcce7bfa342dbe96b2c582
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-26 12:01:14 +01:00
Volker Hilsheimer
e709e254d7 Make QUnixEventDispatcherQPA XFAIL the test
Needed for QNX, don't be overly specific with XcbUnix.

Pick-to: 6.3 6.2
Change-Id: I240313bc48d9d81d1f18f27ee11f7c9352e3e452
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
2022-03-25 22:52:33 +01:00
Ivan Solovev
862f42e806 Android: activate tst_qfactoryloader
- Use QT_ANDROID_EXTRA_PLUGINS to specify a correct plugins directory
- Update plugin names on Android to match the expected format
- Add explicit dependency on the plugins, so that they always get built
  and included in the APK
- Update the test code to respect the fact that plugins are packed
  differently on Android.

All these steps allow to enable this test for Android in CMakeLists.txt

Task-number: QTBUG-87438
Pick-to: 6.3 6.2
Change-Id: I09e389c761688cea216d8922b94ea3a2600f7a67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-25 22:43:49 +01:00
Ivan Solovev
904d613a51 Android: activate tst_QPlugin
- Use QT_ANDROID_EXTRA_LIBS to correctly deploy libraries on Android.
- Update the test code to use the application libraries directory
  instead of resources on Android.

This allows to enable the test for Android in CMakeLists.txt

Task-number: QTBUG-87438
Pick-to: 6.3 6.2
Change-Id: I2f6d2d4f3ab3872cf7d7fad1668b5c2c3eef3aad
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-25 22:43:49 +01:00
Ivan Solovev
5ef748d321 Android: skip tst_QFileSystemModel::specialFiles()
The test will never pass on Android because it's missing permissions
to read root filesystem.
Skip the test instead of blacklisting it.

Fixes: QTBUG-87427
Pick-to: 6.3 6.2
Change-Id: Ib57a49b1d2bc4204f8aa2c3028c7220d23ff2a91
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-25 22:43:49 +01:00
Ivan Solovev
83a587bfa6 Android: activate tst_QThreadStorage
Skip a test that uses QProcess instead of blacklisting it.
Re-enable this test in CMakeLists.txt, so that it can be checked
in the CI.

Fixes: QTBUG-87431
Pick-to: 6.3 6.2
Change-Id: If8a4acd60735f355dffa60c28b8d07695ee33ec8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-25 22:43:49 +01:00
Ivan Solovev
68f7ba2150 tst_QAtomicInt: do not check qlonglong alignment for x86_32 CPUs
For x86_32 the alignment of QBasicAtomicInteger<8 bytes> is not
equal to the alignment of TypeInStruct<8 bytes>, so do not perform
the check.

Fixes: QTBUG-87422
Pick-to: 6.3 6.2
Change-Id: I6e6c6cb7b2b7195e430d6a6991004bcfce16d4cb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-25 21:55:51 +01:00
Edward Welbourne
a8a7f6c4e6 Fix parsing of .cmake.conf in generate_expected_output.py
It relied on the set(QT_REPO_MODULE_VERSION ...) line being the first
thing in the file. It no longer is, and the variable is referenced in
an earlier condition.

Change-Id: I2bd2abd2a5680782ddd61f4bf4a4a3265b444d52
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-25 21:55:51 +01:00
Pasi Petäjäjärvi
ce0d7477a9 Disable test tst_qxmlstream for QNX
Copying lot of testdata over NFS to qemu image start failing with
errors of "No space left on device" even there is enough space left.

Pick-to: 6.2 6.3
Change-Id: I2a417ed5b8c131e0a1f68c37b1fc2446ea013304
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-25 20:16:30 +02:00
Edward Welbourne
57742f7728 Include zone name on tst_QTimeZone::isTimeZoneIdAvailable() failure
The zone name was reported if isValid() failed, but not if
isTimeZoneIdAvailable(), where it also proved useful in uncovering
ICU's use of over-long zone name components.

Change-Id: I4b3b65b1a4a338b638c01fc7ad47294118ee0efc
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-25 17:04:37 +01:00
Edward Welbourne
9e01a9a5d1 Apply the East-Saskatchewan exception to zone-fragment lengths to ICU
The exception was previously limited to Android, but I now find that
ICU has the same over-long names; it seems likely that's where Android
gets them. Also update the link to the theory page from the TZ DB, as
it now has an official home on www.iana.org.

Task-number: QTBUG-99747
Pick-to: 6.3 6.2
Change-Id: I9af67426d15609dfaf5f335405ceb1218fcf40ff
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-25 17:04:37 +01:00
Volker Hilsheimer
71b3d18ea7 Notify about focus object changes upon widget destruction
If the active QWidget gets destroyed, then QWidgetWindow::focusObject
will return nullptr. If then no other object takes focus, then we'd
never emit change signals, and QGuiApplication's _q_updateFocusObject
(which then informs the input context and emits signals) didn't get
called. This left the input context with a dangling focus object
pointer, which resulted in crashes.

If the QWidget clears its focus, but the corresponding window doesn't
know that it had focus, then fall back to the widget's focus widget
to see if we have a change in focus, so that signals get emitted.

Add a test case that shows that we didn't call _q_updateFocusObject
by counting emissions of the QGuiApplication::focusObjectChanged
signal, which we emit in this function. The signal is emitted more
than once both when showing a widget, and now also when destroying
a widget that has a focus child. The former is a previous issue,
the latter is an improvement to not emitting the signal at all.

Pick-to: 6.3 6.2
Fixes: QTBUG-101423
Fixes: QTBUG-101321
Change-Id: Ib96a397211d442f52ce795a3eebd055a0ef51b0d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-25 17:04:37 +01:00
Sona Kurazyan
76a1c060ac Always cancel unfinished QPromises on destruction
If the QPromise is being destroyed, we should signal the associated
futures to stop waiting. No matter in which state the promise is, if
it's not finished, we should always cancel to avoid infinite waits.
This is also what docs state:

"The promise implicitly transitions to a canceled state on destruction
unless finish() is called beforehand by the user."

Fixes: QTBUG-101284
Pick-to: 6.3 6.2
Change-Id: I65ebfefe03b79b41afacda78a4f49938c54d8b37
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-25 08:05:12 +01:00
Pasi Petäjäjärvi
fe93a5f42d CI: Add docker support for tst_qiodevice test
Currently test relies solely for external test server. This makes it
not possible to run test successfully with environment where docker is
used.

Pick-to: 6.2 6.3
Change-Id: Idf7e99c19ab630065b651f2f6d957311f45f0db7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-24 22:09:43 +02:00
Pasi Petäjäjärvi
f00e332d39 CI: Add docker support for tst_qtextstream test
Currently test relies solely for external test server. This makes it
not possible to run test successfully with environment where docker is
used.

Pick-to: 6.2 6.3
Change-Id: If716921ce6ceea1ced2d0d7025c6e9768b4ed7a7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-24 22:09:43 +02:00
Laszlo Agocs
e25fc5a197 rhi: d3d11/vulkan: Allow passing in an array range override
Only (straightforwardly) implementable with modern APIs, and
only really exists to handle special platform cases, such as
when a video framework gives us a D3D texture array with
D3D11_BIND_DECODER | D3D11_BIND_SHADER_RESOURCE
which is only possible to use as a shader resource if the SRV
selects a single array layer.

Has no effect on the normal usage of texture arrays, where all
array layers are exposed, and it is the shader that selects the
layer when sampling or loading via the sampler2DArray. That
continues to be the standard way to work with texture arrays.

Change-Id: I0a656b605da21f50239b38abb83067e0208c1dbe
Reviewed-by: Piotr Srebrny <piotr.srebrny@qt.io>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-03-24 19:19:35 +01:00
Volker Hilsheimer
1fe5ea3f83 Fix compiler warnings in tests
Don't mix unsigned and signed types in comparisons.

Pick-to: 6.3
Change-Id: Ia4ba9c114177425a21cadc8cafe8179928315a5d
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2022-03-24 13:23:16 +01:00
Volker Hilsheimer
dfb4697e4a QAbstractItemView: with single selection, deselect on Ctrl+Release
After cbf1b4bc60bca3994b8f8685ee922e53a6b4eed2 the selected item got
deselected on Ctrl+Press, which made Ctrl+dragging a selected item
impossible.

Only deselect on Ctrl+Release. Add scenario to existing test case,
and update the documentation to clarify the properties involved, and
to point out that the event parameter might be nullptr.

Fixes: QTBUG-101647
Pick-to: 6.3 6.2
Change-Id: I749b1cb1a0a311f5c1d4c333984716f05f2c90b5
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Enderlein <volker.enderlein@ifm-chemnitz.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-24 00:42:00 +01:00
Mårten Nordheim
d34ae86a00 tst_QLocalSocket: Add helper to dependencies
To enable using `ninja tst_qlocalsocket_check` and have the
helper (re)built as part of the dependencies.

Pick-to: 6.3 6.2
Change-Id: I8703c4202a97606991d1cffe0d0f8e909a51f12f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-23 21:19:35 +00:00
Ivan Solovev
21e7216670 Android: activate tst_QLineEdit
Skip some of the obviously failing QCompleter-related tests instead of
blacklisting them.
Skip a test that causes a crash.

This allows to re-enable this test in CMakeLists.txt for Android.

Task-number: QTBUG-87417
Pick-to: 6.3 6.2
Change-Id: Ie7ee708df8ceddf117689e8ac749850ba86e8816
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-23 21:03:03 +01:00
Assam Boudjelthia
8c4894f94b Android: don't QEXPECT_FAIL in tst_QTextDocument::task240325()
This test doesn't fail on Android anymore, so don't use QEXPECT_FAIL.

Pick-to: 6.2 6.3
Task-number: QTBUG-100470
Fixes: QTBUG-69242
Change-Id: I5a96566728a486c701656aede1818e7ab7f019be
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-03-23 18:22:06 +00:00
Volker Hilsheimer
3fbe201d21 Try to stabilize QWidget::enterLeaveOnWindowShowHide
The test is very flaky on Windows 11. Make sure that we have a secondary
window to close before proceeding, and wait for fade effects to finish,
otherwise we might never get the leave event from the windowing system.

Also replace a QVERIFY(qWaitFor) construct with a simple QTRY_VERIFY.

With these changes, a local run of 20 repeats of this test on a stressed
VM improves from 75% to 100%.

Pick-to: 6.3 6.2
Fixes: QTBUG-98477
Change-Id: Iedcc175b336e3cab23817b954aba1736d02f1b9d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-03-23 03:31:44 +01:00
Edward Welbourne
02d130db7e Avoid duplicate descriptions in TAP's incident YAML
When a B?Fail's description doesn't match the QVERIFY/QCOMPARE
regexes, it got output as a comment in the YAML block after the test
line had already reported it as a TODO comment. An empty description
would also have lead to an empty comment in the YAML block. Condition
this fallback output case on there being a description that hasn't yet
been reported in the test line.

Task-number: QTBUG-96844
Change-Id: Id7fe81d26ddb01da3d8003ada8fa590a5e1a166f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-22 17:43:13 +01:00
Edward Welbourne
58b0d72f8d TAP test logger: treat blacklisted XFail the same as XFail
In all places but one they were treated the same; fix that last one to
match the rest. This removes one line from the YAML block for each
blacklisted XFail test; in each case, this message duplicates the one
on its "not ok ... # TODO..." test line.

Change-Id: Iff2028afccd979db7f2c84e85d1b78541900008e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-22 17:43:13 +01:00
Samuel Mira
2ba3cde348 Android: Blacklist failing tests on tst_QGraphicsProxyWidget
Backlist failing tests on Android. To be fixed later.

Task-number: QTBUG-100470
Task-number: QTBUG-101888
Pick-to: 5.15 6.2 6.3
Change-Id: Iaa33b555f6063702af683c683e0b07ce2910fe13
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-03-22 17:49:05 +02:00
Pasi Petäjäjärvi
5c85b0c7a4 CI: QNX qemu need docker service ports explicitly defined for visibility
Network autotests cannot connect to services on docker containers from
QNX qemu without all ports explicitly defined (both host and container)
side.

Pick-to: 6.2 6.3
Task-number: QTQAINFRA-4684
Change-Id: Iba44cfa17d42d43ecec3e29985e404f75d5fc232
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-03-21 22:30:01 +02:00
Ulf Hermann
908ee8aab1 QProperty: Allow manual scheduling of binding notification
In some situation we want to notify even if the value didn't change.

Task-number: QTBUG-101771
Pick-to: 6.2 6.3
Change-Id: I7d82a9f6e0f7d5eb48065e3f428b814939181ea8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-21 20:41:23 +01:00
Volker Hilsheimer
c924c05ae2 Replace deprecated QColor::fromString in tests and documentation
Don't use deprecated methods in tests, and don't refer to them in
documentation.

Change-Id: I110480742d9a7b9b0a2e194e3fe610208c1e07da
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-21 20:41:23 +01:00
Øystein Heskestad
eaabd0c545 QAnyStringView: constexpr detect 8-bit ASCII as Latin 1
This has performance benefits when doing comparisons.
The check is only performed at compile time.

Task-number: QTBUG-101014
Change-Id: I55694b045fe5e75d9671d0a3a70c80d998cf98c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-21 20:36:23 +01:00
Volker Hilsheimer
f3466fad53 Build QMenuBar test without warning
Adapt to changes in QWidget::addAction API from 08e4d2db08.

Pick-to: 6.3
Change-Id: If6e05b47de88cf55070238f08b96586b855cc5c1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-20 23:19:03 +01:00
Sona Kurazyan
d0f9e593d4 Rename tst_qlatin1string and switch to using QLatin1StringView
Task-number: QTBUG-98434
Change-Id: Iec477835880263175edbc03f21b40f1ad67dbef0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-19 18:51:08 +01:00
Marc Mutz
c52ebb3aba QRect: add toRectF()
For symmetry with QRectF::toRect().

[ChangeLog][QtCore][QRect] Added toRectF().

Fixes: QTBUG-73160
Change-Id: If2bda64b8fe4bc113191dda927e9bb86ebcb4c69
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-19 12:02:24 +01:00
Marc Mutz
5dc570f8b1 QLine/QMargins: add toLineF/toMarginsF()
For symmetry with QLineF::toLine().

[ChangeLog][QtCore][QLine] Added toLineF().

[ChangeLog][QtCore][QMargins] Added toMarginsF().

Task-number: QTBUG-73160
Change-Id: I69051cdd2fe4a3c0a000ab86e363a2918a7aea7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
2fb0135efa QSize/QPoint: add toSizeF/toPointF()
For symmetry with QSizeF::toSize().

[ChangeLog][QtCore][QSize] Added toSizeF().

[ChangeLog][QtCore][QPoint] Added toPointF().

Task-number: QTBUG-73160
Change-Id: I65b088b4f7365ab671ef2f0c75821b707f5ac26d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
f97daab7a6 QObject: restore flags printing in dumpObjectTree()
This was lost when QtCore, QtGui and QtWidgets were split up. Restored
now via a virtual function on QObjectPrivate.

Chose to return std::string instead of QString or QByteArray because
its SSO is usually sufficient to hold these flag strings.

[ChangeLog][QtCore][QObject] Restored printing of Qt3-style
information from dumpObjectTree().

[ChangeLog][QtWidgets][QWidget] Restored printing of Qt3-style
information from QWidget::dumpObjectTree().

Fixes: QTBUG-101732
Change-Id: I39ff5728ea5f5abbdbf81b5d7e13b8d16b6ee8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
6ec1dc904d QSettings: port key processing to QAnyStringView
... in preparation for replacing the QString keys in the public API
with QAnyStringView ones.

This removes the "important optimization" that avoids a detach in the
common case where the input is the same as the output of
normalization. But that optimization is beside the point, because it
trades a memory allocation avoided in the library for O(N) allocations
inserted into user code for each call to QSettings::value(), the vast
majority of which are calls with string literals.

With the public interface ported to QAnyStringView in the follow-up
patch, we can then internally optimize memory allocations _in a central
place_ (e.g. by returning std::u16string or QVarLengthArray<QChar> from
normalizeKey() instead of QString). But first we need to get rid of all
the unwarranted allocations in user code.

Change-Id: I45fc83d972c552a220c9c29508001d3f172e1162
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-19 07:09:55 +00:00
Volker Hilsheimer
5e566ab373 When clearing selected items, iterate over a copy of the QSet
Selection change handlers of the items might call a method that
implicitly recreates the selectedItems QSet, which then invalidates
the iterators of the ranged for loop, resulting in crashes.

Iterate over a copy of the set instead.

Add a test case that crashen without the fix.

Fixes: QTBUG-101651
Pick-to: 6.3 6.2
Change-Id: I6da6f4043fe1906b0186931a37283f635cb5a404
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-18 21:56:19 +01:00
Luca Di Sera
33d62de7c8 Enable move semantics for QTemporaryDir
Add move constructor and move assignment operator.

To allow for the the change to be implemented QTemporaryDir, the
internal d_ptr was modified from a QScopedPointer, which is not movable,
to a raw pointer.

Add member + free swap implementations.

Add tests.

[ChangeLog][QtCore][QTemporaryDir] Enabled move semantics.

Change-Id: I9f196a77c70b4ca0b7f0c06505d00fdd87a9785c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-18 20:56:19 +00:00
Ivan Solovev
30830e0cba Android: use empty Intent to clear clipboard data on API < 28
ClipboardManager didn't have any APIs to clear clipboard data before
API level 28.
As a workaround an empty Intent with MIMETYPE_UNKNOWN is created and
inserted into the clipboard for lower API levels.
This makes the QApplication::clipboard()->clear() method work more or
less as expected.
This allows to unblacklist tst_QPlainTextEdit::copyAvailable().

Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I454376199cf3b8eed0fa2ecf2f85b87f40892280
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-18 18:35:03 +01:00
Marc Mutz
9985cc330a uic: use C string literals for setObjectName()
Because setObjectName() now takes a QAnyStringView, passing C string
literals is much more efficient than using QString::fromUtf8().

This patch only deals with setObjectName() as a known property,
probably from a name attribute. If the objectName property is set by a
<property> element (or so I assume), we still emit a
QString::fromUtf8(). Detecting objectName there would be too much
magic.

Besides, I haven't been able to find why sometimes there's a second
setObjectName call right after the first, when in the XML it seems all
kosher (name attribute and objectName <property> agreeing on the
content).

Change-Id: Icf07bad841ac735a9c744bbd955428ba15758089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-18 18:35:03 +01:00
Janne Juntunen
a5ee74754d tst_qopengl: set surfaceType explicitly
Parent window in sizeLessWindow test was using software pipeline at
least on webOS, causing a QCRITICAL() exit when the test was executed.

Fixes: QTBUG-101869
Pick-to: 6.3
Change-Id: Ie8cc0ea0b6a09729475389be44197e01a45b217f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-03-18 13:02:11 +02:00
Giuseppe D'Angelo
1b14569753 QMutexLocker: strenghten the locking operations
There is no reason to allow relock() on a locked locker, or unlock()
or an unlocked one, just like we don't allow that on a plain mutex
to begin with. The docs already said that e.g. relock() locks an
_unlocked_ locker.

[ChangeLog][QtCore][QMutexLocker] QMutexLocker allowed relock() and
unlock() on an already closed (resp. open) locker object. These
semantics have always been undocumented and are now unsupported
(in both cases they yield undefined behavior.)

Change-Id: Id5f67beb5dc30d6435dae88a3085fba93ec7d96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-18 05:18:28 +01:00
Edward Welbourne
e10d613509 Add QByteArray::percentDecoded() as an instance method
Percent-decoding was previously only present as a static method taking
a QBA parameter; it might as well be an instance method of that
parameter. Change most QBA tests to use it rather the static method.

[ChangeLog][QtCore][QByteArray] percentDecoded() is now available as
an instance method of the byte array to be decoded, equivalent to the
static QByteArray::fromPercentEncoding().

Change-Id: I982101c44bdac5cc4041e85598d52ac101d38fa1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-18 01:22:54 +01:00
Sona Kurazyan
73e7fc2d8e Fix a few more {QString, QByteArray}::count() deprecation warnings
Change-Id: I0be2d5e7a8f6af3bc1077ae6d1f20cc5da8f2266
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-17 21:03:08 +01:00
Allan Sandfeld Jensen
173dd2a033 Fix lancebench after lancelot restructuring
Pick-to: 6.3 6.2
Change-Id: I5e17230761ca5482b3376787afab29d15de58dac
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-17 18:57:47 +01:00
Giuseppe D'Angelo
20d0ff1a39 QMutexLocker: add move semantics
The class is similar to unique_lock in that it allows for unlocking
and relocking. Since the locked state is tracked by QMutexLocker itself,
it's trivial to make it movable.

[ChangeLog][QtCore][QMutexLocker] The class is now movable.

Change-Id: I534044f8024575e996c12efb2236761d493798a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 18:57:47 +01:00
Fabian Kosmale
8f73b25e52 Benchmarks: Do not depend on transitive includes
Change-Id: I1d0dbfca130f43d76de2d6ac585a0f242d490b5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 17:14:37 +01:00
Fabian Kosmale
819e1bf91d Tests: Do not depend on transitive includes
Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-17 17:14:37 +01:00
Giuseppe D'Angelo
5089db0303 QFuture: fix QtFuture::connect corner-cases
Connecting to nullptr, or connecting to a non-signal PMF, would result
in a QFuture which would never finish. Catch these cases and handle
them.

Windows+MSVC for some reason fails the test. I can't entirely understand
why, so I've marked it as XFAIL, with QTBUG-101761 to track it.

Change-Id: I314980e7e9b7156d8cddd3b33d5cbf1d0bcd6116
Pick-to: 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-03-17 17:14:36 +01:00
Alexey Edelev
8adacba3e6 Add VERBATIM option to add_custom_command calls
Use VERBATIM option to prepare the correct command line for the
add_custom_command. This especially sensitive when using build
directories with names containing special symbols, that cannot be
handled by shell correctly.

Change-Id: I51d7041cb806411135fd59bf6273c04a3c695443
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-17 15:15:06 +01:00
Sona Kurazyan
893dd5d7be Add QStringView::localeAwareCompare()
QString already has a localeAwareCompare(QStringView, QStringView)
static method. Use it in QStringView::localeAwareCompare(QStringView).

[ChangeLog][QtCore][QStringView] Added
QStringView::localeAwareCompare().

Task-number: QTBUG-98431
Change-Id: Iec3865a5439d9fb653cc1150da21042186bdee98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 14:27:45 +01:00
Sona Kurazyan
b86b22cfde Move localeAwareCompare tests from tst_qstring to tst_qstringapisymmetry
Pick-to: 6.3 6.2
Change-Id: I3c395d989e4659ebfa24b78f34b2a99769b734dc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 14:27:45 +01:00
Liang Qi
f08e57540d GUI: add ScreenWindowGrabbing capability
On Wayland, there is no protocol to do it yet.

Task-number: QTBUG-100792
Task-number: QTBUG-101145
Change-Id: Id72625a8161359111a2d0f43f3215e787778ba6b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-17 14:27:44 +01:00
Eirik Aavitsland
9619cec279 Baseline testing: Fix overriding of Project property
Remove some kludgy, redundant and never used functionality for setting
project and test case names, as it also hindered overriding those
properties at runtime.

Pick-to: 6.3 6.2
Change-Id: Ibef7d7d0cb5fc1e462752f2ba2db76cc088dbd48
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-17 14:27:44 +01:00
Marc Mutz
9f8da21239 QDateTime: future-proof swap()
In Qt 7 32-bit builds, the ShortData will be larger than the
d-pointer.

So don't swap() the d-pointer, but a) delegate to Data to swap itself
and b) swap the ShortData there, adding a static_assert in the .cpp
file that triggers when the assumption that ShortData is always at
least as large as a pointer is violated.

Found while porting away from overly-generic qSwap(), so done that,
too.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I5139da58d99e9491a582ff2cb2f817cd96952044
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-17 06:14:58 +00:00
Laszlo Agocs
bc54031d57 Exercise reparenting more in QOpenGLWidget autotest
Change-Id: I771250ba889835e886c2801066ef023d82c5186d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-03-17 05:34:55 +00:00
Giuseppe D'Angelo
979ee48ca1 QObject: add another couple of tests for broken connect()
Connecting to a non-signal should fail, but apparently it doesn't on
Windows+MSVC under certain conditions.

Task-number: QTBUG-101761
Change-Id: I3e014660e4e5b287242e32307f677bb22ab10a39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-17 01:02:15 +00:00
Tatiana Borisova
715420095a Fix has_signaling_NaN usage for INTEGRITY
- The newest GHS compiler versions set the value of has_signaling_NaN to False.
  Add compilation and autotest fix for GHS-compiler 2021/2022 releases.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I45e5da6759a15c60c17f896e565002cbba8524ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 20:09:37 +02:00
Marc Mutz
1977c922e9 QFlatMap: make insertion STL-compatible
That is, insert() doesn't overwrite an existing entry, and range
insert inserts the first of equivalent keys' values, not the last.

This allowed this author to optimize the implementation of
makeUnique() to a O(N) algorithm (was: O(N²)). Said optimization would
have been possible with the old semantics, too, but I wrote the
algorithm first and only then noticed the broken insert() behavior is
present on QFlatMap, too, so I decided not to let good code go to
waste and to fix both problems at the same time.

In order to give users a hint of the changed semantics, make the new
API opt-in until Qt 6.5, so Qt 6.4 ships with the both the old and the
new semantics disabled, where they contradict.

Fixes: QTBUG-100092
Change-Id: Ic96d8bfe6bed9068dbe8c0d7171bd8921050fd95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-16 18:28:27 +01:00
Volker Hilsheimer
58a14d9433 Enable tests to turn off Windows Vista animations
Animations in that style depend on the current time, which makes it
impossible to run baseline tests. Introduce a dynamic property that
allows us to set the time that animations use.

This way, tests can turn the animation off, or control which time should
be used.

To keep performance overhead low, check only once whether the dynamic
property is set at all.

Pick-to: 6.3
Change-Id: I9bc57b9867fb0d852e101570eca4c7609e7fe1a8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-16 15:56:17 +01:00
Alexandru Croitor
21bffeec90 CMake: Add deployment auto test
Add a cmake test that builds a simple widgets application, installs
it, in a shared Qt build deploys the runtime dependencies and then
runs it to confirm that the app works.
With a static Qt, the installation of the runtime dependencies is
skipped, but the app should still run.

The test is expected to pass only when targeting Windows and macOS
(both when using shared and static Qt).

Pick-to: 6.3
Task-number: QTBUG-98545
Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:17 +01:00
Marc Mutz
e74e27e67e QObject: give some TLC to dumpRecursive()
In no particular order:

- use the variable field width feature of QString::asprintf() to
  generate the indentation implicitly, instead of fill()ing a
  QByteArray with the desired number of spaces

- just default-construct 'flags', don't assign an empty string

- use qUtf16Printable() to avoid funneling UTF-16 data through 8-bit
  encodings

- use a C++11 ranged for instead of a counted loop

- remove a pointless isEmpty() guard (the loop won't execute when the
  children().isEmpty())

- avoid copying object->children() (returns by cref, so it's also ok
  to stuff it directly into the ranged for loop).

Add a test.

Pick-to: 6.3
Change-Id: Ie7314713cb48de7e890cdee0760c0361dd24fd18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 02:26:56 +00:00
Andreas Buhr
50f6356f8e Repair some of tst_qtableview tests on Android
The test task191545_dragSelectRows relied on the fact
that the view is not scrolling. But on a small screen,
it scrolls automatically.

Fixes: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: I691361c965ab03d8a012f2b83715c7c96d990ec5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Marc Mutz
f3c340c276 QStringTokenizer::toContainer(): allow more types of target containers
The previous constraint called for the value_type of the container to
exactly match the value_type of the tokenizer, which means
toContainer() could only ever work on containers of views. But there
is value in allowing QStringList, even though it works only on QL1S
needles (QStringView -> QString isn't implicit). But users may have
other types that for better or worse implicitly convert from views, so
we shouldn't over-constrain the function.

[ChangeLog][QtCore][QStringTokenizer] toContainer() now works on
containers whose value_type can be constructed from the tokenizer's
value_type. It no longer requires an exact match.

Fixes: QTBUG-101702
Change-Id: Ie384cd1c4b51eaa57675f2a014141ceec8651c81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Assam Boudjelthia
a818885a3d Android: expect QPlainTextEdit::canPaste() to fail after clipboard clear
Android 9 introduce an API call to clear the clipboard, before that
it wasn't possible to do that, the test QPlainTextEdit::canPaste()
should expect that to fail.

Pick-to: 6.3 6.2
Task-number: QTBUG-100470
Change-Id: Ie2d8aabf77672c62b3a6c72a080a4e37f1696303
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-03-15 16:09:04 +02:00
Eirik Aavitsland
f46db29d8c Painting: fix overriding and combining different clip types
In a recent improvement (6de36918c0) the
last set clip region or path was stored in separate variables, in
order to be set again if the aliasing mode changed. That solution was
too simplistic, as it would break down as soon as more than one clip
area was set, with the latter either replacing or intersecting the
first. It was also unnecessary to introduce new storing of clip areas
and transforms, as those are already recorded in the clipInfo stack in
the painter state. This patch hence reverts much of that implementation.

However the basic idea of setting the clip area again after AA change
is good, so that part is kept, implementated instead by calling a
pre-existing function to replay the clipInfo stack.

One of the baseline test cases is extended to excercise the
combination of clip areas. As a driveby, support for setClipRectF is
added to the painting baseline test scripts, and the build of the
manual lance tool is fixed.

Fixes: QTBUG-101474
Pick-to: 6.3 6.2
Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 12:45:46 +01:00
Volker Hilsheimer
1822550529 QFormLayout: Fix assert when showing with hidden rows
Amends a74cdf778c, after which the
initialization of items in invisible rows is skipped. Since data members
in QFormLayoutItem were lazily initialized, this resulted in out-of-bounds
access of QList entries.

Use member initialization for all QFormLayoutItem fields, and check that
vLayoutIndex is valid before using it to access the list entry. Skip
labels and fields for which it is not initialized.

Add test case. As a drive-by, silence the test's provoked warning
messages via ignoreMessage.

Change-Id: I374b414a51df20b9af3087a2676061fc6b7f23e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 12:45:46 +01:00
Marc Mutz
0aaada0ddc QString::asprintf: check that passing field widths as arguments works
Pick-to: 6.3 6.2 5.15
Change-Id: Ifb36179b9c26ce15378f10c2947c8cb1e38e10d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
Marc Mutz
ce83a03cfd QColor: deprecate isValidColor, setNamedColor, string-ish ctors
[ChangeLog][QtGui][QColor] The constructors from string-ish type, as
well as the setNamedColor() and isValidColor() functions, have been
deprecated effective Qt 6.6 in favor of fromString() and
isValidColorName(), resp.

Fixes: QTBUG-101389
Change-Id: I002646bd48c1e4340dc6842fd136fc9f35bb9b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 10:36:09 +00:00
Heikki Halmet
ee0908228f Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"
This reverts commit d3a297c0ab.

Reason for revert: Unnecessary blacklisting

Task-number: QTBUG-101332
Change-Id: I1e2c94585e719199724695347b243dffcde49259
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-03-15 07:32:32 +00:00
Giuseppe D'Angelo
9b8015ed8d QMutexLocker: add isLocked()
It's basically for free.

[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.

Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 03:32:14 +01:00