The QSinglePointEvent ctor assumes that the given globalPos is correct,
so it was wrong that the QHoverEvent ctor passed along a local position
as global. It's better to require globalPos as an argument; and in fact
it seems that everywhere we construct a QHoverEvent, global position is
available, or possible to get by transformation (which is better than
resorting to QCursor::pos()).
Also, don't convert to QPoint: pointer events have qreal resolution and
there's no reason to truncate them.
Fixes: QTBUG-100324
Change-Id: I919455da36265988d3d149eb97563c9ed0d2c660
Pick-to: 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
On X11 we already had to wait as window managers might scroll windows
in. On macOS we also waited - albeit a bit shorter - also because
screens scroll in slowly.
We didn't wait on Windows, and on Windows the test is quite flaky.
Attempting to make it run stably by waiting for long enough so that all
paint events are flushed to the screen.
As a drive-by, break some overly long lines.
Task-number: QTBUG-100412
Pick-to: 6.3
Change-Id: I49b1e447aced2fe1af3c5d30b514f8df3cc1813c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
A default-constructed QPluginLoader erroneously reports that the
load hints are empty. However, setting a filename would then
automatically set the PreventUnload hint, surprising the user.
Return the correct flags instead.
Amends 494376f980
Change-Id: I7a95964cb680afd3adf2f71ed73d2f93023238f2
Fixes: QTBUG-100416
Pick-to: 5.15 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When running a test under increased verbosity levels, QTestLib would
print "failure location" for every QTest function (QVERIFY, QCOMPARE,
...), even if there's no failure at all.
Keep the code centralized, but split the formatting of failures and
non-failures (other messages).
Task-number: QTBUG-96844
Change-Id: I3c508653176b68579dc0eb0cffcc153a52da2e2c
Pick-to: 5.15 6.2 6.3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
While investigating an assertion failure I noticed that the existing
tests didn't even exercise these methods for local time or zone time.
Of course, we can't robustly test these time-specs, due to vagueries
of offset details and zone availability, but we can at least verify
that they return date-times on the specified date. Add a test-case for
the start of 1900, on which the assertions were first seen; it is the
earliest moment representable with tm_year >= 0, after all.
One of these tests fails on 6.2 but the fix for that (as opposed to
the the assertion) requires 6.3's improvements to the handling of
time_t's fuller range - too risky a change to pick back to 6.2.
Pick-to: 6.3
Task-number: QTBUG-99747
Change-Id: I98f5d7850a701972b2d8ea2ce203a2b3e7071354
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
qt_internal_undefine_global_definition disables an internal global
definition that is defined by the qt_internal_add_global_definition
function for a specific target.
Remove the ability to set the custom "undefine" flag for the
definitions since it's hard to control it using the introduced
function.
Pick-to: 6.2 6.3
Task-number: QTBUG-100334
Change-Id: Ic1637d97aa51bbdd06c5b191c57a941aa208d4dc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Not MSVC, but pretends to be.
Pick-to: 6.3 6.2
Change-Id: I5c201dd917e79a22d6ef15715bf1d3a7010d123e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In 63eea5e5c69434871eaef9d9dc7184d7e54d7276, the
Qt::ItemNeverHasChildren flag was introduced. QFileSystemModel
was modified to use this flag for items which are not directories,
but only if the QFileSystemModel is not read-only and
the directory is writable.
This patch modifies QFileSystemModel to use the ItemNeverHasChildren
flags also if the model is read-only and if the item
is read-only.
Amends 63eea5e5c69434871eaef9d9dc7184d7e54d7276
Change-Id: Ie7f7d58ecf7baade93f9f03d120da84d3c005d42
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Amends e3b2b12a91, which made the
style sheet calculate the font-dependent text size, but didn't
add the space needed for the close button or a tab icon.
QTabBar's layout code already adds the space needed for icons
and margins to the size; so instead of overwriting that size,
subtract the size needed by the normal font, and then add the
size needed for the font form the style rule, considering both
vertical and horizontal tab bars.
Fix the test case to style only one tab rather than the entire
tab bar, otherwise the font is applied to the entire tab bar,
and not just to a specific tab, which is the style sheet style
code in question.
Pick-to: 6.2 6.3
Task-number: QTBUG-6905
Change-Id: Ieed0ba146a32e81229419adecaf41f467cfd5959
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Task-number: QTBUG-100362
Change-Id: Ib09aec5ea03867163d476a2c92562bc949fc1b1a
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The code was trying to avoid a detach in the case no element needed to
be removed, by first running find_if() on const_iterators, and then,
after converting its result to (mutable) iterators, start the
remove_if() algorithm where find_if() left off.
But this applies the predicate to the element found by find_if() (if
any) _twice_: first just before we exit the first find_if() and then
just as we enter remove_if(), which will start by running find_if()
again, with the result of the initial find_if as 'first'.
Apart from being needlessly inefficient, this violates the
specification of Uniform Erasure, which defines sequential erase_if()
as being equivalent to remove_if() + container erase(), with the
former being specified to apply the predicate exactly once per
element.
Fix by writing the remove_if() part by hand.
Instead of doing the dance with the loop invariant documentation
twice, simply implement erase() via erase_if() (complicated a bit by
the weird passing of predicates by lvalue reference instead of by
value, as would be idiomatic). This exposes users to:
[ChangeLog][QtCore][Potentially Source-Incompatible Changes] A fix in
the implementation of the erase-like algorithms of sequential Qt
container may re-enable signed/unsigned comparison warnings previously
suppressed by having occurred in std library code. To fix, cast the
value to look for such that it has the same signedness as the
container's elements.
... but the issue would be the same had we inlined std::remove()
instead of passing a lambda to sequential_erase_if(), so it's nothing
we can, nor should, work around.
[ChangeLog][QtCore][Containers] Fixed a bug in the implementation of
most sequential Qt container's erase-like algorithms (member
removeAll()/removeIf() and free erase()/erase_if()) where the equality
operator or the predicate, respectively, was applied to the first
matching element twice. Each element is now tested exactly once.
Pick-to: 6.3 6.2
Change-Id: Ib6d24b01b40866c125406f1cd6042d4cd083ea0d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Some calling code did this beforehand, other didn't. Now, the function
itself checks for an existing handler before doing anything else.
Change-Id: I8fc43fb8788c9dfe825b15ffa2fa69ee43915cd6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
.. but this will only be supported on Vulkan, OpenGL 3.2+, and Open GL
ES 3.2+ for the time being.
The situation is:
- Vulkan is working. qsb accepts .geom files already, and QShader has
existing geometry shader support.
- OpenGL 3.2 and OpenGL ES 3.2 are working.
- D3D11 is not working. D3D11 supports geometry shaders, but SPIRV-
Cross does not support translating geometry shaders to HLSL.
- Metal is not working. Metal does not directly support geometry
shaders.
Change-Id: Ieb7c44c58b8be5f2e2197bf5133cf6847e6c132d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Support for Polygon Mode (Triangle Fill Mode in Metal, Fill Mode in D3D)
in the RHI graphics pipeline.
Options are Fill and Line
Status:
OpenGL - ok
Vulkan - ok
Metal - ok
D3D11 - ok
OpenGL ES - does not support glPolygonMode.
Change-Id: I20b7ef416624700c3dc8d1cbe6474f4ca3889db8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Restore the 'QT_NO_JAVA_STYLE_ITERATORS' and
'QT_NO_NARROWING_CONVERSIONS_IN_CONNECT' definitions for Qt
targets.
Add the function that adds global definitions for Qt targets according
to the provided scope and the target property-based switch to disable
the definition for a specific target.
Pick-to: 6.2 6.3
Task-number: QTBUG-100295
Change-Id: I28697e81f9aabc45c48d79aae1e5caea141e04e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
If the signal passed to QtFuture::connect() takes multiple arguments,
we need to wrap the arguments in a std::tuple when reporting the result.
To detect this case we were checking if the result type of a QFuture
returned by QtFuture::connect() is a std::tuple, but this was not
correct: the result type could be a std::tuple also if the passed
signal takes a single std::tuple argument. Instead, check if the signal
takes more than one argument.
As a drive-by modified the tst_QFuture::signalConnect to use const
values for tuples used in multiple test-cases, to avoid repetition.
Fixes: QTBUG-100071
Pick-to: 6.2 6.3
Change-Id: I1ce39cf87028f36ef94a9d1a4423b0c51473afd4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The test was already blacklisted for Windows 10 and Windows 7. Now it
is flaky on Windows 11 as well.
Blacklist it for all windows platforms.
Task-number: QTBUG-98478
Pick-to: 6.2 6.3 5.15
Change-Id: I870fb6ce80cfe244a76d08bf40677fdb6becab97
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
The IGNORE directive was likely removed as an oversight
in the linked change.
This fixes the test to pass when bumping the Qt version.
Amends 9836dbd6ee
Change-Id: I497325d6d8b8b67cce7b0840bfb9bfa70d85fe73
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
From the API review.
Pick-to: 6.3
Change-Id: Ic05737db79327e7811fcd974a70914b837e06601
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The test also fails on Windows 11
Pick-to: 6.2 6.3
Task-number: QTBUG-98475
Change-Id: Iab079587d743500d222f2272d1145424e079b4a3
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Update Catch2 header to latest released version. Needed
to build correctly with glibc 2.34.
Two patches applied on top of the upstream release. Previously
used Qt specific change extracted to a separate patch file.
Fixes: QTBUG-95842
Pick-to: 6.3 6.2
Change-Id: I67e442bbe756ff00c96a45eabf593f7aecddd628
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Add a level of indirection via void_t such that
struct is_transparent {};
works, and not just
using is_transparent = <unspecified>;
Pick-to: 6.3
Change-Id: I3ca2af6a07e6989dc95abc10fb2d0078a5269e5b
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
The test has been XPASS'ing recently on Android.
Reverts 67e209f59f.
Fixes: QTBUG-69216
Change-Id: Ic629cc28936e0ef27277c243717e97226bf01b1c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
- It should not be built for systems without process feature.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I71caa59c2168435894c7d1afcc8226e44178439f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
If id == 0, then we should grab the specified rect from the screen.
To do that, find all windows intersecting with the screen geometry, and
compose their backing store images into a screen-size pixmap.
Otherwise, find the respective backing store and grab only that.
Remove the old code respecting the desktop widget, which is no longer a
thing in Qt 6. The code was also wrongly grabbing only the first
containing - not intersecting - window's backing store into the screen
pixmap.
Enable the QScreen::grabImage test for the offscreen platform, where it
now passes.
Task-number: QTBUG-99962
Change-Id: I16eca7b082d65095a62c73624f86a4423e997a7a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
QSqlQuery::exec() took for granted that it can dereference driver(),
which should be true for all sane usage; however, it should not crash
if used misguidedly. Added regression test, based on bug report's
reproducer, which crashes without the fix.
Fixes: QTBUG-100037
Pick-to: 6.3 6.2 5.15 5.12
Change-Id: I94600bc60f89e82a1121b418144006a683921a38
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
577d698b8e changed QString::isUpper /
isLower behaviors to match Unicode semantics: a string is uppercase
if it's identical to its own toLower/toUpper folding. These semantics
come from Unicode so they're not up for debate.
That commit however left QByteArray untouched. Generally speaking, we
want to move away from QByteArray as "text storage" -- this has
partially happened between Qt 5 and Qt 6, where QByteArray went from
Latin-1 semantics to ASCII semantics. Still, QByteArray offers
toUpper/toLower and isUpper/isLower and all this family of functions
should be consistent in behavior.
Apply the same fix that was applied to QString.
[ChangeLog][Important Behavior Changes] The semantics of
QByteArray::isLower() and QByteArray::isUpper() have been changed. Now
lowercase (resp. uppercase) byte arrays are allowed to contain any
character; a byte array is considered lowercase (resp. uppercase) if
it's equal to its own toLower() (resp. toUpper()) folding. For instance,
the "abc123" byte array is now considered to be lowercase.
Previously, the isLower() (resp. isUpper()) functions checked whether
the byte array only contained ASCII lowercase (resp. uppercase)
characters, and was at least 1 character long. This had the side effect
that byte array containing ASCII non-letters (e.g. numbers, symbols,
etc.) were not lowercase nor uppercase.
[ChangeLog][QtCore][QByteArray] QByteArray::isLower() and
QByteArray::isUpper() now work correctly with empty byte arrays. The
semantics of these functions have been changed.
Pick-to: 6.3 6.2
Fixes: QTBUG-100107
Change-Id: Id56a42f01b2d1af5387bf0e6ccff0f824f757155
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is an issue for QQuickWindow in practice, although it is not hit
by our current tests.
Pick-to: 6.3
Change-Id: Ia73704c1af6a82b2689ce7b844d3b0eb9a17ec18
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
QThreadPool automatically deletes the runnable after it finishes running
the task. In case QThreadPool is nullptr, we should delete the runnable
manually. This amends 87b93c29be.
Pick-to: 6.3 6.2 5.15
Change-Id: Id7e4ed3d4d6de05990edf62e4099852983debc64
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Take the argument by value instead of rvalue ref. In C++17, this is as
efficient, and enables the
return big;
to use the QByteArray move constructor, avoiding the need for a manual
std::move(), which always looks suspicious on a return statement,
because more often than not, it's a pessimization that breaks NRVO.
This code doesn't seem to exist in Qt 6.2, so only
Pick-to: 6.3
Change-Id: I8bf678102f5df1870cfc61090d12f327478d74d1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Clang 10 warns about unused results of relational operators, which is
where this is coming from.
Fix by adding the usual prefix
[[maybe_unused]] auto r = ~~~;
to silence the warning. Do this elsewhere, too, since [[nodiscard]] is
slowly being rolled out across all our APIs. This is not a complete
sweep, though.
Not picking to 5.15, because this pattern doesn't work there and I
don't want to introduce a new one.
Pick-to: 6.3 6.2
Change-Id: I40dd8ad07496b686979dce533e044cbb486e30f3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The timeToTest constant doesn't need to be captured, claims Clang.
Since I don't recall seeing this warning on GCC, be pragmatic and fix
by letting the compiler choose what to capture: [&]. timeToTest is
const, so it doesn't matter whether we capture by reference or value,
the lambda cannot change it either way.
This code doesn't seem to exist in 5.15, so merely
Pick-to: 6.3 6.2
Change-Id: I48d42ab13ed22ac5eb512dc61235b72a19636ea3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The function name suggests that the *= operator is to be benchmarked,
not simple multiplication.
Use the correct operator.
Pick-to: 6.3 6.2 5.15
Change-Id: I6718e8aea640a153083858b39963199e7bab26e9
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The class is not intended for inheriting from it (see also
e502906305), so we can mark it as final
to explicitly forbid this. The tests were still using it as a base
class to clean the results during destruction, so fix them accordingly.
Task-number: QTBUG-99883
Pick-to: 6.3
Change-Id: I4a7ee3e2b462bd704e4b5a95ed733144805d6e5b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Unlike QString and QStringView, QByteArrayView and QByteArray don't
overload well.
Solve the overload issue the usual way: by making the QByteArray one a
Q_WEAK_OVERLOAD. This is trivial for QStaticByteArrayMatcher, which
isn't exported, but require QT_REMOVED_SINCE magic for
QByteArrayMatcher, which is.
The additional const char* overload has shielded us from the worst
fall-out so far, it seems, but it makes for a truly horrible overload
set:
matcher.indexIn(str, 3);
Q: Is the 3 here the length of the haystack or the value of the from
parameter?
A: It depends on decltype(str)!
If the (const char*, qsizetype, qsizetype=0) overload is the better
match, then 3 limits the haystack's length.
If, otoh, the (QByteArray(View), qsizetype) overload is the better
match, then it's the value of the from parameter.
As if this wasn't bad enough, QByteArray implcitly converts to const
char* by default!
A follow-up patch will therefore deprecate the (ptr, size) overloads,
so we de-inline the QByteArrayView ones to avoid having to touch the
implementation once more.
Found during 6.3 API review.
Pick-to: 6.3
Change-Id: I9640e0bdd298d651511adebcc85f314db9221d34
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Add a test (same techniques as for the 4+GiB check in
tst_qcryptographichash).
Takes ~1s to build the 4GiB test data here, and skips
when RAM is too low:
$ qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork
[...]
QDEBUG : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() created dataset in 891 ms
[...]
$ (ulimit -v 2000000; qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher haystacksWithMoreThan4GiBWork)
********* Start testing of tst_QByteArrayMatcher *********
[...]
SKIP : tst_QByteArrayMatcher::haystacksWithMoreThan4GiBWork() Could not allocate 4GiB plus a couple hundred bytes of RAM.
Loc: [/home/marc/Qt/qt5/qtbase/tests/auto/corelib/text/qbytearraymatcher/tst_qbytearraymatcher.cpp(242)]
[...]
Found during 6.3 API review.
[ChangeLog][QtCore][QStaticByteArrayMatcher] Fixed searching in
strings with size > 2GiB (on 64-bit platforms).
Fixes: QTBUG-100118
Pick-to: 6.3
Change-Id: I1df420965673b5555fef2b75e785954cc50b654f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When int is 32-bit, 0x80000000L is int-min, and (consequently)
negating it makes no difference, so MSVC warns about this. Instead of
using an L suffix, wrap the constant in Q_INT64_C(). Do the same for
similar large constants in the same block.
Pick-to: 6.2 6.3
Change-Id: Ib371b932792f170ab7db2e472a4283df3a205af3
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
The animateClick method is a QAbstractButton member, and neither
QCommandLinkButton nor QPushButton override it. The method is tested in
the QAbstractButton test, and 3a9b7d1f18648d7236664d3adfc65c009b01e668
made that test more robust. The previous, flaky version of the test was
almost duplicated here. They add no additional code coverage, so remove
them.
Pick-to: 6.2 6.3
Change-Id: I1fa988c1eabd5054193acb1f5fa1c81d29b3878d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
It was missing #if-ery on feature regularexpression for one test that
depends on it. One of its comments had a long line. Added some
annotations to make clear what's going on in messier tests.
Change-Id: I06d8748a134591f93b36029713e52ffd826a24dc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Continuations were using QFutureInterface to create and return the
associated future to the user. Attaching a continuation to the returned
future could cause memory leaks (described in an earlier commit). Use a
QPromise when saving the continuation, to make sure that the attached
continuation is cleaned in the destructor of the associated QPromise, so
that it doesn't keep any ref-counted copies to the shared data, thus
preventing it from being deleted.
Task-number: QTBUG-99534
Pick-to: 6.3 6.2
Change-Id: I52d5501292095d41d1e060b7dd140c8e5d01335c
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Capturing a QFuture in the continuations attached to it results in
memory leaks. QFuture's ref-counted data can only be deleted when the
last copy referencing the data gets deleted. The saved continuation
that keeps a copy of the future (as in case of the lambda capture) will
prevent the data from being deleted. So we need to manually clean the
continuation after it is run. But this doesn't solve the problem if the
continuation isn't run. In that case, clean the continuation in the
destructor of the associated QPromise.
To avoid similar leaks, internally we should always create futures via
QPromise, instead of the ref-counted QFutureInterface, so that the
continuation is always cleaned in the destructor. Currently QFuture
continuations and QtFuture::when* methods use QFutureInterface directly,
which will be fixed by the follow-up commits.
Fixes: QTBUG-99534
Pick-to: 6.3 6.2
Change-Id: Ic13e7dffd8cb25bd6b87e5416fe4d1a97af74c9b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Avoid some unnecessary comparisons and add more tests.
Task-number: QTBUG-99799
Change-Id: I3aee9f0b62461d38dadbe8e969444e1cd1f94e68
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This is added specifically for the QPA platform and theme plugins, to
honor the QT_QPA_PLATFORM_PLUGIN_PATH environment variable and the
(inadvisable) -platformpluginpath command-line argument.
This removes the last QFactoryLoader used with an empty path (also the
only two that could be reached), which were causing a scan of the
application's binary directory whenever the platform plugin path was
set. In case of applications installed to /usr/bin, the entire /usr/bin
was scanned, which can be qualified as "not good".
Fixes: QTBUG-97950
Pick-to: 6.3
Change-Id: Ice04365c72984d07a64dfffd16b47fe1d22f26d3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
The test is timing sensitive; if it takes more than 100ms
to process events, then the timer that clicks the button might
have fired. So only verify that the button is still down if 100ms have
not yet passed, and verify that at least 100ms have passed when the
click is complete.
Also use QSignalSpy to test the signal emissions.
Pick-to: 6.2 6.3
Change-Id: I95f99e204a17c6709f8e2913eefe4b487e949123
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
It's used by the lancebench and the lance tool, and it will probably be
useful for writing some high-dpi related unit and baseline test cases,
so move it to the shared folder.
Change-Id: I969bab51c9504be13b4c192b4f29f69cd9102868
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
The current behavior for handling the angle delta of a wheel event
changes index the instant there is a change in angle delta. This works
fine for mouse wheels that send events with 120 angle delta units and
there is also already behavior defined for devices with pixel deltas,
but there is nothing good for handling events from high resolution mouse
wheels that don't have pixel deltas.
This patch makes it so that the current index doesn't change until the
accumulated angle delta for the X or Y axis reaches 120.
[ChangeLog][QtWidgets][QTabBar] Scrolling with a high resolution mouse
wheel changes the current index at a rate more like a normal mouse
wheel.
Task-number: QTBUG-97844
Pick-to: 6.3
Change-Id: I2e7fd88984a253f6ef8a0008deb7233e4cb4d84a
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Commit 289f909621 ("Test conversion of
ulonglong variant to JSON") was trying to ensure the result becomes a
double. So there's no reason to make a test in the _data() function.
Drive-by fix the UB condition on Windows (ulong is 32-bit, so 1ul << 63
is UB).
Change-Id: I0e5f6bec596a4a78bd3bfffd16ca4f8f5219f785
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
It was Linux-only and now even Linux is complaining:
tst_qmetatype.cpp:421:26: warning: ‘int pthread_yield()’ is deprecated: pthread_yield is deprecated, use sched_yield instead [-Wdeprecated-declarations]
Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1eadfa301f16
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
All primitive types are initialized and have been since at least commit
33cd680ddb ("New QMetaType
representation").
Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1fe22dc5c8f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
When some test function fails (even as expected), it can leave the
event dispatcher in an inconsistent state where the posted events
queue might not be empty. As a result, this may break the internal
logic of the next test function that is run.
So, calling eventDispatcher->processEvents() after each completed
function resets the event dispatcher to its initial state, which
fixes the problem.
Pick-to: 6.2 6.3
Change-Id: I5a54f892d09a6eca73c8fc82875ce3b9ce4a3242
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We set the wakeUps atomic to prevent multiple WM_QT_SENDPOSTEDEVENTS from
being posted. However, this might happen right after the event processing
thread cleared the atomic, but before it processed the previous
WM_QT_SENDPOSTEDEVENTS message. In that case, we end up with a set
atomic and an empty event queue, resulting in the event loop to block
even though there are posted QEvents.
To prevent that, always reset the atomic when we handle the
WM_QT_SENDPOSTEDEVENTS message. In that case, we either call
sendPostedEvents, or startPostedEventsTimer. The former already resets
wakeUps; reset it in the latter as well.
Fixes: QTBUG-99323
Pick-to: 6.2 6.3 5.15
Change-Id: I931c02be9c42b02e8ca20daba5059cd8185f0a37
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
Add two tests for some problematic scenarios where the behavior is not
consistent across platforms and depending on which event dispatcher is
used:
1) reliably waking up the dispatcher when posting events from a worker
thread.
That test fails 100% of the time on Windows no matter what type of
application is created. It passes reliably on Linux and macOS for both
core and gui applications.
2) waking up the dispatcher when we post an event from within an
event handler.
That test fails 100% of the time on Windows, both with core
and GUI event dispatchers. On macOS, the test fails 100% of the time
with the core dispatcher, and passes 100% of the time with the GUI
dispatcher. On Linux, it passes only if a Glib based event dispatcher
is used; the default Unix event dispatcher (which is also the one
used on macOS for core applications) fails.
Task-number: QTBUG-99323
Pick-to: 6.2 6.3 5.15
Change-Id: I2489533b9f0032488707777be0512bb933669a7d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alex Trotsenko <alex1973tr@gmail.com>
The compiler generated special functions are just fine.
Pick-to: 6.3 6.2
Change-Id: I64fba1fac59f55d2a82ab18e32c1a2b854df72f0
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The 'misc' data field was not copied in the assignment operator.
That field is normally not used, so this bug went undiscovered for a
long time. But in certain cases, the bug would cause an image size
mismatch to be reported as just a normal mismatch.
Fix the source of the problem by following the rule of zero - the
compiler generated special functions are just fine for this value
type.
Done-With: Volker Hilsheimer <volker.hilsheimer@qt.io>
Pick-to: 6.3 6.2
Change-Id: I8fc8d32d1b83b78cd4ef3f4ec9a8f22661b0e025
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Get rid of the function-static main window, which would be destroyed
after QApplication if the test is run with a subset of test row (that
does not include the TestEnd state test).
Make the MainWindow a class member of the test class instead, and rename
it from "mainW" to "mainWindow" to avoid shadowing by "mainW" widgets in
other test functions.
Amends 55928821d1.
Task-number: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I83efce5b54afc3a0027a7c0e63efee6a235af585
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Bug introduced in 6.0. This is the only unprotected d_ptr I could find.
[ChangeLog][QtCore][QMetaType] Fixed a bug that would cause
QMetaType::compare() and QVariant::compare() to crash on invalid meta
types and variants.
Pick-to: 6.2 6.3
Fixes: QTBUG-99960
Change-Id: I0e5f6bec596a4a78bd3bfffd16cb1f7b2d146688
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Previously, if you had multiple entries with the same name in an object,
and some of them were again objects or arrays, parsing the JSON document
would leak memory.
Also, we use std::stable_sort instead of std::sort now, so that we don't
accidentally randomize the order of elements with equal keys.
[ChangeLog][QtCore][JSON] A memory leak in the JSON parser when reading
objects with duplicate keys was fixed.
Pick-to: 5.15 6.2 6.3
Fixes: QTBUG-99799
Change-Id: Ic2065f2e490c2d3506a356745542148ad9c24262
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We can handle the UTF-8 case by reinterpreting it as Latin-1.
This way, the suffixIndex stays valid as a return value.
As a drive-by, optimize away toLatin1() calls by using a QVLA.
We really need a better way of converting UTF-16 -> L1 than
qt_to_latin1()...
[ChangeLog][QtCore][QVersionNumber] fromString() now takes
QAnyStringView (was: QString, QStringView, QLatin1String)
and a qsizetype pointer (was: int pointer).
Change-Id: I86abaadba2792658fbf93ccd1e0b86e3302c697c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This completes the update to qsizetype in this class, adding a couple of
methods that need to be removed in Qt 7. They're only required where int
is not qsizetype (i.e., 64-bit platforms).
Change-Id: I0e5f6bec596a4a78bd3bfffd16c9de29bec4c637
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
qstrncmp() would stop at the first null character, which isn't correct.
The tests that had been disabled in tst_qstring.cpp (with an inaccurate
comment) were actually passing. I've added one more to ensure that the
terminating null is compared where needed.
[ChangeLog][QtCore][QLatin1String and QUtf8StringView] Fixed a
couple of bugs where two QLatin1Strings or two QUtf8StringViews
would stop their comparisons at the first embedded null
character, instead of comparing the full string. This issue
affected both classes' relational operators (less than, greater
than, etc.) and QUtf8StringView's operator== and operator!=.
Pick-to: 5.15 6.2 6.3
Change-Id: I0e5f6bec596a4a78bd3bfffd16c90ecea71ea68e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
QNetworkHeadersPrivate::toHttpDate() used a custom format to output a
date-time; the format supplied GMT as suffix, but neglected to convert
the date-time to UTC, so local-time was formatted as if it were UTC,
regardless of its actual offset from it. Fixing this (by the obvious
toUTC() call) broke formatting when the supplied header value was a
QDate, since it's packaged as a QVariant and QVariant's conversion of
QDate to QDateTime uses local time's (not UTC's) start of day. So fix
headerValue() to separate QDate and QDateTime cases and use
startOfDay(Qt::UTC) to get the right start of the day. Added tests for
non-UTC date-times appearing correctly in HTTP headers.
Fixes: QTBUG-80666
Pick-to: 6.3 6.2 6.2.3 5.15
Change-Id: I2792bce14a07be025cf551b0594630260c112269
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Very simplistic initial test, inspired by the fix in 'fusion' style,
but not style-specific.
Pick-to: 6.3
Change-Id: I55ceca7ad214c86cb11032c5342bdae2a83852f1
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Force takeStandardSnapshots() to take and log all snapshots before
launching QFAIL. Macros QBASELINE_CHECK_DEFERRED and
QBASELINE_CHECK_DEFERRED_SUM have been added in qbaselinetest.h
Task-number: QTBUG-99790
Pick-to: 6.3
Change-Id: Ia015de808f354e842ac4029c5c84be18c4a4e209
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Files that are not meant to be executed should not have the execute
permission bit set.
Task-number: QTBUG-81503
Pick-to: 6.3 6.2 5.15
Change-Id: I10666bd958adfc5c425216bcff7456facd1fe5f3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Some lines in tests had to be updated because they lost the implicit
conversion from char* to QString.
Change-Id: I95af5859ced95b9ca974205398e38c0bd4395652
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is heavily inspired by the patch written by Inho Lee
<inho.lee@qt.io>, which says "There is a precision problem in the
previous algorithm when checking pitch value. (In the case that the
rotation on the X-axis makes Gimbal lock.)"
In order to work around the precision problem, this patch does:
1. switch to the algorithm described in the inline comment to make
the story simple.
2. forcibly normalize the {x, y, z, w} components to eliminate
fractional errors.
3. set threshold to avoid hidden division by cos(pitch) =~ 0.
From my testing which compares dot product of the original quaternion
and the one recreated from Euler angles, calculation within float range
seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999)
Many thanks to Inho Lee for the original patch and discussion about
rounding errors.
Fixes: QTBUG-72103
Pick-to: 6.3 6.2 5.15
Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10
Reviewed-by: Yuya Nishihara <yuya@tcha.org>
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
In Qt 5 style sheets, objects could be selected by an enum-type property
using the integer value of the enum value, e.g
QToolButton[popupMode="1"] { ... }
In Qt 6, the the new meta type system and QVariant implementation enabled
QVariant::toString to return the string representation of the enum value
instead for a property containing an enum. Since QStyleSheetStyle's
attribute matching is string based, this breaks the Qt 5 style selector,
and QCSS code instead needs to use e.g.
QToolButton[popupMode=MenuButtonPopup] { ... }
While the new syntax is arguably preferable, this is an unintentional
change that silently breaks style sheet code (no error or warning at
compile- or run-time).
To support Qt 5-style selectors, we have to change the StyleSelector
interface of the QCssParser API so that we can pass through what type
of value the attribute extractor should return; if an integer string "1"
is provided, then we need to compare the enum integer value; if the
string provided does not represent a number, then we need to compare the
name of the enum value.
Since the pure virtual attribute() method that needs to be implemented
to extract the attribute value of the node is implemented in modules
outside qtbase, add a second virtual method that takes the entire
QCss::AttributeSelector, which includes the value to match. Extractor
implementations can use it to evaluate which type of data to return for
an exact match. The default implementation calls the old attribute()
method so that existing StyleSelector implementations continue to work.
Make the respective change in the QStyleSheetStyleSelector, and simplify
the surrounding code. Adjust other StyleSelector implemnentations in
qtbase. As a drive-by, remove the superfluous virtual declaration from
those overrides.
Once submodules are adjusted to override this virtual function instead
of the (now no longer pure) virtual attribute() method, that method can
be removed.
Pick-to: 6.3 6.2
Fixes: QTBUG-99642
Change-Id: I9a2b3498f77bf7cab5e90980b7dab2f621d3d859
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This code didn't actually use QMutableEventPoint::from(), so didn't
run into the UB that from() depended on, but it's in the way of making
QMutableEventPoint a befriendable namespace instead of a public
subclass of QEventPoint.
Replaced the QMutableEventPoint ctor that takes a timestamp, and
therefore isn't compatible with the ctors on QEventPoint, with a
static function that returns QEventPoint instead.
Port QList initialization to braced-initialization as a drive-by.
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: If5a1dbea21cc31cdefdb640716793421c8ec0af4
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
In Qt 5, such selectors have to use the integer value of the enum
value. Using the enum value name does not work.
In Qt 6, such selectors must use the enum value by name, using
the integer does not work.
It's not clear yet what changed, possible a side effect of the
changes and improvements in the meta object system and QVariant in
Qt 6. So for now, document the difference in behavior in a test.
Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99642
Change-Id: I96e0280b191b8ca06b16a97ab3ed367e9a8f43a0
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
The header no longer uses QMutableEventPoint.
Fix TUs that relied on the transitive include.
Task-number: QTBUG-99615
Pick-to: 6.3
Change-Id: Iae4ff34ea708304fcd365fd763875dd4a97a1cf8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
The test is impacted by the position of the mouse cursor, and fails if
the mouse enters the test window when it gets shown. Try to move the
cursor away from the window.
As a drive-by, const'ify some of the local variables.
Revert 7b4b5115dd by removing the
blacklisting of the test on macOS in CI.
Pick-to: 6.3 6.2
Change-Id: Ia0c554fdf161fd4eb4aa3965e937c7db8ceeef8f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
The test uses a static MainWindow so that we can execute a series of key
simulations on the same window. The window is then destroyed when we
reach the final test row.
If some of the tests fail, then the window is left in an unknown state,
resulting in cascading failures for the other tests. Fix this by always
trying to show and activate the window, and always destroying the static
window if we have reached the last test data row.
Fixes: QTBUG-99630
Pick-to: 6.2 6.3
Change-Id: I466669f387e8b199e9e719a7ebbe3ae670658b7e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The QDateTimeData &d it's passed is a copy that's about to be
modified; before we do so, we haven't detached so its internals have a
ref-count of two, contradicting an assertion in the non-const
Data::operator->(); so just directly access d.d->m_timezone, since we
know that spec == TimeZone implies !isShort().
Added test that triggered the assertion and now doesn't.
Fixes: QTBUG-99668
Pick-to: 6.3 6.2 6.2.3 5.15
Change-Id: I07321ad91be5adce524be18e4ab82eee7110dc6a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Do not try to test writing of image formats which are not supported on
the platform under testing. This test was failing for .ico files on
webOS.
Fixes: QTQAINFRA-4722
Pick-to: 6.3
Change-Id: Ic7d40d9751e0f921d9721c01492cca28d798e141
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Added tests for repeated skips and failures (from within void lambdas,
to simulate skips and failures from within event handlers). These
exhibit yet more ways to count more than one outcome for a test. The
new QTest::failOnWarning() can also provoke more than one failure from
a single test, and several existing selftests exhibited various ways
for the Totals line's counts to add up to more than the number of
actual tests run.
Fixed counting so that only the first decisive incident is counted.
Tests can still report later failure or skipping, but only the first
is counted.
Added a currentTestState in qtestlog.cpp, by which it keeps track of
whether the test has resolved to a result, and clearCurrentTestState()
by which other code can reset that at the end of each test. This
brought to light various places where test-end clean-up was not being
handled - due to failure or skipping in a *_data() method or init, or
a skip in cleanup.
Fixes: QTBUG-95661
Change-Id: I5d24a37a53d3db225fa602649d8aad8f5ed6c1ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Adds a function for setting the baseline Project name, which selects
the top level server directory and hence config settings.
Also adds a function that lets the client override the server config
setting for the project image keys (ItemPathKeys). This is the list of
properties that will be used to determine which clients are "the
same", i.e. which baseline to compare against. Overriding that is
handy since it allows experimentation and customization of clients
without involving changes in the project config on the baseline
server.
Pick-to: 6.3 6.2
Change-Id: Id3998356494a9a2cb71c009b43593d3dc1b6963a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
A derived gadget has an is-a relationship with its base type. It
should be convertible. In fact, canConvert() already tells us it is.
Change-Id: I71a5ac9afd78e88adb23b4d0e757f34077f63207
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Moved tst_QImageReader::readText() and tst_QImageReader::preserveTexts()
behind QT_NO_IMAGEIO_TEXT_LOADING flag. The tests were failing on
webOS.
Fixes: QTBUG-99717
Pick-to: 6.3
Change-Id: Ib23decbaffe8d87c07fd68c41a28a3f7ca969cb1
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
...but this will only be supported with Vulkan and OpenGL 4.0+ and
OpenGL ES 3.2+ for the time being.
Taking the Vulkan model as our standard, the situation is the
following:
- Vulkan is ok, qsb secretly accepts .tesc and .tese files as input
already (plus QShader already has the necessary plumbing when it
comes to enums and such) To switch the tessellation domain origin to
bottom left we require Vulkan 1.1 (don't bother with
VK_KHR_maintenance2 on top of 1.0 at this point since 1.1 or 1.2
implementations should be common by now). The change is essential to
allow the same evaluation shader to work with both OpenGL and
Vulkan: this way we can use the same shader source, declaring the
tessellation winding order as CCW, with both APIs.
- OpenGL 4.0 and OpenGL ES 3.2 (or ES 3.1 with the Android extension
pack, but we won't bother with checking that for now) can be made
working without much complications, though we need to be careful
when it comes to gathering and setting uniforms so that we do not
leave the new tessellation stages out. We will stick to the Vulkan
model in the sense that the inner and outer tessellation levels must
be specified from the control shader, and cannot be specified from
the host side, even though OpenGL would allow this. (basically the
same story as with point size in vertex shaders)
- D3D11 would be no problem API-wise, and we could likely implement
the support for hull and domain shader stages in the backend, but
SPIRV-Cross does not support translating tessellation shaders to
HLSL. Attempting to feed in a .tesc or .tese file to qsb with
--hlsl specified will always fail. One issue here is how hull
shaders are structured, with the patchconstantfunc attribute
specifying a separate function computing the patch constant
data. With GLSL there is a single entry point in the tessellation
control shader, which then performs both the calculations on the
control points as well as the constant data (such as, the inner and
outer tessellation factors). One option here is to inject
handwritten HLSL shaders in the .qsb files using qsb's replace (-r)
mode, but this is not exactly a viable universal solution.
- Metal uses a different tessellation pipeline involving compute
shaders. This needs more investigation but probably not something we
can prioritize in practice. SPIRV-Cross does support this,
generating a compute shader for control and a (post-)vertex shader
for evaluation, presumably in order to enable MoltenVK to function
when it comes to tessellation, but it is not clear yet how usable
this is for us.
Change-Id: Ic953c63850bda5bc912c7ac354425041b43157ef
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
We want to preserve nullness where possible. Test that various ctors
do the right thing when presented with null input.
Pick-to: 6.3
Change-Id: Ia1a1d4fb3c919b4fed2d9b87827815a1b5072c54
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Any of these timers must be stopped before the corresponding test
function completes. Otherwise, functors will operate on dangling
pointers, which can lead to failures or unreliability of other tests.
Fix this by setting a correct context in the QTimer::singleShot()
call.
Pick-to: 6.2 6.3
Change-Id: Icd23f6d9a2c6e7f33495d6badc4080a1b10c19f8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Since Qt 6.0, QImageIOHandlers by default take care of this themselves
by not allocating more than 128 MiB for an image.
This change will not significantly reduce code coverage of the fuzzer
because QImage::loadFromData() calls QImageReader::read() which does
everything QImageReader::size() does except for returning the read size
in the end. On the other hand, it will speed up the execution because
the same image will not be read twice by different QImageReaders anymore.
Change-Id: Iab63d9e5ec02fbe5765fbf7ccb0b82896ec37692
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
By GHS the only C locale is supported.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I3d89f1b2d9eb7f77b75e13a5ca65cebc24538890
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
At some point we decided to support a custom set of ciphersuites specified
by QSslConfiguration (which if you ask me was never a good idea). The law
of unforseen consequiences bit us again: since we now give a set of ciphesuites
to QSslConfiguration and set ciphesuites from the configuration a socket has,
we are limited by the ciphersuites we know about at the moment of 'coding'.
Meaning if an SDK was updated and CipherSuite.h later adds more ciphersuites,
we miss them and 'don't support them', while we ... actually do.
This patch tries to add some more ciphersuites introduced in TLS 1.3 (interesting,
SecureTransport does not support TLS 1.3, but TLS 1.3 suites can be used in TLS
1.2 session).
Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99368
Change-Id: I439b63845c4893e5621cffaf3bcaf62e2b643c74
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Mainly because we do have legacy code in the Qt 5 graphical effects that
tries to dynamically determine the max number of varyings. Make it
easier to port such code.
Change-Id: I846cab2c2fe7b4cd473b5ced0146ca36f1c8169b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
The CALayer backingstore never had a scroll implementation because we
were relying on the QRasterBackingStore implementation, but as it turned
out that implementation was not applicable for the CALayer backingstore.
We now implement scroll() by determining which part of the back buffer
can be scrolled directly in-place, and then scrolling the rest by
copying from the front buffer. We have to handle both cases, as clients
may scroll multiple times before flushing, and the scrolled area may
overlap both valid back-buffer content and content that needs to be
pulled from the front-buffer.
Pick-to: 6.3 6.2
Change-Id: Icc09c9488386925116779c9024669a4329b38247
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
In Qt 5, QVariant::isNull returned true if either the variant didn't
contain a value, or if the value was of a nullable type where the type's
isNull member function returned true.
In Qt 6, QVariant::isNull only returns true for variants that don't
contain a value; if the value contained is e.g. a null-QString or
QDateTime, then QVariant::isNull returns false.
This change requires a follow up in the SQL drivers, which must
still treat null-values the same as null-variants, lest they write data
into the data base.
Add a static helper to QSqlResultPrivate that implements isNull-checking
of variants that contain a nullable type relevant for Sql, and add a
test case to the QSqlQuery test that exercises that code.
Pick-to: 6.2 6.3
Fixes: QTBUG-99408
Fixes: QTBUG-98471
Change-Id: I08b74a33aa3235c37d974f182da1f2bdcfd8217e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This does exactly what insert() on Qt associative containers does, but
allows to express the intent of using the STL-incompatible Qt insert()
semantics, in an STL-compatible way, instead of leaving the reader of
the code wondering what semantics are expected.
This is part of a very-long-term goal of fixing Qt associative
container's insert() behavior, in which QFlatMap, being an affected,
but private-API type, is used for proof-of-concept purposes.
Task-number: QTBUG-99651
Pick-to: 6.3 6.2
Change-Id: I69010285438259918aef659d3235180c1b5be696
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
We use raw pointers to the Nodes in the QHash which is
inherently fine, but we are then subject to invalidation when
nodes are moved around during deletion.
In trim() we don't actually need to iterate the linked-list
since the node we are interested in is always chain.prev
Pick-to: 6.3 6.2 6.2.3
Fixes: QTBUG-99710
Task-number: QTBUG-99224
Task-number: QTBUG-99240
Change-Id: I9c2ed69b29e3cadca013113a3553deb44d7382fc
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
setPos() takes a screen argument, however this argument
indicates which cursor should be moved only and is
not usable as an argument to toNativePixels() since
the position may be on a sibling screen.
Add call to QScreen::virtualSiblingAt to get the target
screen.
Task-number: QTBUG-99009
Pick-to: 6.3 6.2 5.15
Change-Id: I8714ebc93a283c58bc67911315f787c484fb0dd8
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
... in an attempt to foster the use of this data structure by making
it less onerous to spell.
Pick-to: 6.3 6.2
Change-Id: Ib9d17029c75278edde6ba90f65f68af179a6d230
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
QFlatMap, like its public brethren, features the broken Qt-style
insert() behavior (what the STL calls insert_or_assign()), which
makes its insert() unusable for actual STL-style insert() work,
with no replacement except the size-check-and-index-operator trick:
const auto oldSize = c.size();
auto &e = c[key];
if (c.size() != oldSize) {
// inserted
}
Even though QFlatMap::insert() appears to return the correct info,
it's useless, because the old value has been assigned over by the
time insert() returns.
Pick-to: 6.3 6.2
Change-Id: If4173c42523a128dfd22ab496dde0089ba73f41c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Add some sort of autotest for both RGBA16F and the new RGB10A2. The
latter is introduced particularly because ideally we should have a
texture format that corresponds to the D3D/Vulkan swapchain color
buffer format with HDR10.
Change-Id: I1e1bbb7c7e32cb3db89275900811c0bcaeac39d6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
The documentation says that if it's negative, we find the null
termination. This bug was introduced with the clean up to use
QByteArrayView in commit 8897aa071a.
Fixes: QTBUG-99640
Pick-to: 6.3 6.2
Change-Id: Ib42b3adc93bf4d43bd55fffd16c89fa4a960f3a9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
If the editing app (like qtbase/examples/widgets/richtext/textedit)
has controls only for setting a specific font, and someone uses it to
write markdown "from scratch", then we need to detect that they chose
Courier or some other fixed-pitch font, and write the backticks,
because Markdown has no syntax for selecting a specific font family.
If the user loads markdown into such an application, the font
is set to QFontDatabase::systemFont(QFontDatabase::FixedFont).
Round-trip editing was already working, as long as such a font exists.
QTextCharFormat::setFont() calls setFontFixedPitch(font.fixedPitch()),
but for the chosen "mono" font, font.fixedPitch() can be false.
For semantic completeness and separation of concerns, we now
set fontFixedPitch explicitly if a `backtick` span is encountered.
As a followup to f1e60de665 this
should get its autotest passing reliably.
Fixes: QTBUG-99676
Pick-to: 6.3 6.2 5.15
Change-Id: I4987a1f0f819f82ec64546bdc3ef53e7d29933de
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Add test to verify that allowing wordWrap actually breaks long lines.
Pick-to: 6.3
Change-Id: I09bd2d754e86ebf35db551ee76f7f037371acec9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Remove unused column in test data and unused local variables.
Pick-to: 6.3
Change-Id: Ia012fe8240cf9831c1053b76ae31216145d61732
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Suppress the error:
C1128: number of sections exceeded ... limit: compile with /bigobj
Fix by setting the correct target in CMake script.
Pick-to: 6.2 6.3
Change-Id: If241fbaa70b68ca698dae2d484146e7bac970609
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Do not build and run tst_QIcoImageFormat when QT_FEATURE_ico is
disabled. This test was failing on webOS since there is no
imageformatplugin for .ico when the feature is disabled.
Fixes: QTBUG-99633
Pick-to: 6.3
Change-Id: I410b351f773639c0c29e09d4d0b5bc6da13df1d9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
As these are QList and QHash. All existing usages are based on this
anyway, no value in being able to indicate "not available" - an empty
container fulfills the same role.
Change-Id: I8059025fa7a4acb6fc674cd98b16fcafa19ed85d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
We want an ordered list item's number to be rendered with default char
format, like the others in the same list, even if the list item's text
begins with a span that has a different char format. So insert the
list item's block with a default char format first, then change the
char format of the cursor to suit the text that's about to be inserted.
In HTML interpretation, it means the <li> does not have a style, but
contains a styled span.
Fixes: QTBUG-92445
Task-number: QTBUG-3583
Task-number: QTBUG-99148
Pick-to: 5.15 6.2 6.3
Change-Id: I7eb58a8d1171c16503cac01c8cce109d9f12e1af
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
For Direct 3D, Metal, and Vulkan this is natively supported. (and
makes no difference in particular for D3D and Metal because they do
not have the legacy combined image sampler concept anyways)
With OpenGL it will work too, but this relies on SPIR-Cross magic and
is still using a combined sampler (e.g. a sampler2D) in the GLSL
shader. The GL backend walks back and forth in the mapping tables from
the shader baker in order to make this work, which is presumably
slightly more expensive than combined image samplers.
Do note that combined image samplers (i.e. sampler2D in the shader and
QRhiShaderResourceBinding::sampledTexture() in code) continue to be
the primary, recommended way for any user of the rhi for the time
being.
Change-Id: I194721bc657b1ffbcc1bb79e6eadebe569a25087
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Like QTextDocument::toRawText(), QTextDocumentFragment::toRawText()
does allow access to the raw string without normalizing nbsp,
line separator, paragraph separator unicode characters.
[ChangeLog][QtGui][Text] Added QTextDocumentFragment::toRawText() function.
Task-number: QTBUG-99572
Change-Id: Ia74150a3870ea0e6326fdcda4d9d0410019124ae
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
When creating proxied models, make the source model a QObject child of
the proxy model, so the source isn't leaked when the proxy is deleted.
This drove asan nuts.
Pick-to: 6.3 6.2 5.15
Change-Id: I0f7fc9ab8e99d030c941cfb336ee4e2323b362ae
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
QWidget and QWindow use bits in QObjectPrivate to provide for a couple
of shortcuts -- one in qobject_cast, and another in the isWidgetType() /
isWindowType() functions in QObject. These can be optimized by simply
looking at the bits, without actually doing more expensive runtime
casts.
These bits were set on construction, but not unset on destruction. The
result was for instance that destroying a QWidget would report that the
object was still a QWidget when ~QObject was reached.
Fix this
1) by setting the bits only when QWidget / QWindow constructors start;
2) by resetting the bits once ~QWidget / ~QWindow are completed.
Technically speaking this is not 100% correct in the presence of data
members, but luckily those classes don't have any.
Amend an existing test for QWidget (whose comment said exactly the
opposite of what the test actually did) and add a test for QWindow.
Some other code was wrongly relying on isWidgetType() returning true
for destroyed QWidgets; amend it as needed.
[ChangeLog][QtCore][QObject] Using qobject_cast on partially constructed
or destroyed QWidget/QWindow instances now yields correct results.
Similarly, using the convenience isWidgetType() / isWindowType()
functions now correctly return false on such instances. Before,
qobject_cast (and the convenience functions) would erroneously report
that a given object was a QWidget (resp. QWindow) even during that
object's construction (before QObject's constructor had completed) or
destruction (after QWidget's (resp. QWindow's) destructors had been
completed). This was semantically wrong and inconsistent with other ways
of gathering runtime type information regarding such an object (e.g.
dynamic_cast, obj->metaObject()->className() and so on).
Pick-to: 6.3
Change-Id: Ic45a887951755a9d1a3b838590f1e9f2c4ae6e92
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The system we inherited from the original Qt 5.14 introduction of QRhi
is a text stream based solution where resource creation and frame
timings are sent in a comma-separated format to a QIODevice.
This, while useful to get insights about the number of resources at a
given time, is not actively helpful. The frameworks built on top (Qt
Quick, Qt Quick 3D) are expected to provide solutions for logging
timings in a different way (e.g. via the QML Profiler). Similarly,
tracking active resources and generating statistics from that is
better handled on a higher level.
The unique bits, such as the Vulkan memory allocator statistics and
the GPU frame timestamps, are converted into APIs in QRhi. This way a
user of QRhi can query it at any time and do whatever it sees fit with
the data.
When it comes to the GPU timestamps, that has a somewhat limited value
due to the heavy asynchronousness, hence the callback based
API. Nonetheless, this is still useful since it is the only means of
reporting some frame timing data (an approx. elapsed milliseconds for
a frame) from the GPU side.
Change-Id: I67cd58b81aaa7e343c11731f9aa5b4804c2a1823
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Since there is an actual qwidgetbaselinetest.h header file, one should
not include a .moc file. The build system will take care of it, and
currently warns about this #include.
Pick-to: 6.3
Change-Id: I4fbff9ef75c901fe3db4df54d6f3ff0d9307edce
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Data-driven test case that renders the HTML files into an 800x600 image
for baseline comparison.
Task-number: QTBUG-99148
Pick-to: 6.3
Change-Id: I9ccc0cd21a1e94ff68d23bb82b84e1da46d6335a
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Adds the following in a QShader/QShaderDescription:
- a list of separate images
- a list of separate samplers
- a list of "combined_sampler_uniform_name" -> [
separate_texture_binding, separate_sampler_binding ] mappings
(relevant for GLSL only)
On the QShader (and qsb/QShaderBaker) level not having separate image
(texture) and sampler objects exposed in the reflection info is not
entirely future proof. Right now we benefit strongly from the fact
that Vulkan/SPIR-V supports both combined and separate
images/samplers, while for HLSL and MSL SPIRV-Cross translates
combined image samplers to separate texture and sampler objects, but
it is not given that relying on combined image samplers will always be
possible in the long run; it is mostly a legacy OpenGL thing that just
happens to be supported in Vulkan/SPIR-V due to some benefits with
certain implementations/hw, but is not something present in any newer
APIs.
In addition, before this patch, attempting to run a shader with
separate textures and samplers through qsb will just fail for GLSL,
even though SPIRV-Cross does have the ability to generate a "fake"
combined sampler for each separate texture+sampler combination. Take
this into use. This also involves generating and exposing a
combined_name->[separate_texture_binding,separate_sampler_binding]
mapping table for GLSL, not unlike we have the native binding map for
HLSL and MSL. A user (such as, the GL backend of QRhi) would then use
this table to recognize what user-provided texture+sampler binding
point numbers correspond to which auto-generated sampler2Ds in the GL
program.
Take the following example:
layout(binding = 1) uniform texture2D sepTex;
layout(binding = 2) uniform sampler sepSampler;
layout(binding = 3) uniform sampler sepSampler2;
Inn the reflection info (QShaderDescription) this (assuming a
corresponding qtshadertools patch in place) now gives one entry in
separateImages() and two in separateSamplers(). Assuming sepTex is
used both with sepSampler and sepSampler2, the GLSL output and mapping
table from QShaderBaker will have two auto-generated sampler2Ds (and
no 'texture2D' or 'sampler').
One immediate benefit is that it is now possible to create a shader
that relies only on separate images and samplers, feed it into qsb,
generate all the possible targets, and then also feed the SPIR-V
binary into a tool or library such as Tint (e.g. to generate WGSL)
that canot deal with combined image samplers.
Change-Id: I9b19847ea5854837b45d3a23edc788c48502aa15
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
QCoreApplication::installTranslator() does not take ownership of the
QTranslator. The QTranslator dtor removes itself from QCoreApplication
again.
Pick-to: 6.3 6.2 5.15
Change-Id: I17eb7ab350631eb32fe76af29d9a576a0efa05d8
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
- There is no mounted partition, where we can create/delete files at runtime.
Tests should be excluded for now.
Pick-to: 6.2 6.3
Change-Id: I1c4db13d35da7d570c4bf787299d829e08951195
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... as opposed to QByteArray::toHex('\0'), which doesn't.
Picking to all LTSs because it's in a test.
Pick-to: 6.3 6.2 5.15
Change-Id: I392d5714c4865e530a246ed30a13cdac26b98e0b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
- There is no possibility to unpack *.zip archive anywhere on test device or save any file.
Currently we don't have mounted file system.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I8c8d272a92b4475a7548bd10d32fc4203672926b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
When fallbacks are disabled for QSettings then it should not be
falling back to any child groups or keys that might exist in a
fallback set of settings.
Fixes: QTBUG-85295
Change-Id: I563999293a103702035c8d3b027b59b94ca43c0e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The test helper is expected to crash, but when built with asan, it
just fails.
Skip the test in that case.
Pick-to: 6.3 6.2 5.15
Change-Id: I583142f5ec623895df62498100c1a30539b149ab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
The hasPrefix() function would only use the second 'lookahead' parameter
to check if there was more unparsed text after the current character.
When it's obvious from the codebase that it should actually look ahead
of the current character being processed, and compare againt that future
character.
Html comments were also not handled quite right. Partially because of
the broken hasPrefix() function, but also because it would advance the
current index tracker by 3 instead of 2. Remember that the beginning of
an html comment is <!-- meaning that there are only supposed to be 2
dashes required, not 3. The result would be that something like this
<!----> would not automatically close, because the current index tracker
would jump over the first 3 dashes when it begins a comment, and the
remaining unprocessed string would be ->
Also, because of the broken lookahead in hasPrefix(), a comment could
actually be started with just <!- not requiring a second dash at all.
Pick-to: 6.3 6.2 5.15
Fixes: QTBUG-99147
Change-Id: I8f4d4a1107eaf2dae16d16b7b860525d45a1c474
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
We didn't delete the new'ed up QMetaTypeInterfaces, causing asan to
complain.
Fix by storing them in strong references alongside their users in a
statically-allocated container.
We use shared_ptr to hold them, because QMetaTypeInterface doesn't
have a virtual destructor, so deleting objects of the TypeInfo types
(plural!) derived from QMetaTypeInterface though a pointer to the base
class is UB. The shared_ptr constructor, however, is templated, so it
stores the correct call (~TypeInfo()) in its type-erased deleter.
We can't use std::make_shared(), because that doesn't support
aggregate initialization until C++20, so we manually new up the
TypeInfos.
5.15 is not affected.
Pick-to: 6.3 6.2
Change-Id: Ic7ec88c34e02a9e0dd3421848c0c0885f4756702
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
We now have a more reliable test for the case with freeSpaceAtBegin(),
so remove the old test, after we verified it actually doesn't even
test that case.
Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: Ic108a722cd2fef1e63a05085a76d7572d1f8c875
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
This test case fails on qemux86_64-webos-linux environment and based
on comment on the test case, it probably cannot be expected to pass on
webOS.
Fixes: QTQAINFRA-4717
Change-Id: Ifb34b0c85da2d180a59529791d1109185fef2665
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
The test waits a bit hoping that all paint events are delivered after
showing the widget so that we can count the rectangles that are getting
updated when scrolling.
Waiting for 20ms is too short unless the system is completely idle.
Based on testing on a local VM, 150ms produces reliable results.
Pick-to: 6.2 6.3
Change-Id: I7729e94eae41476be67291a2f664cff784f96c7d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
The construction of the byte array doesn't actually yield
freeSpaceAtBegin() (anymore?), so the comment above it is misleading
(and the test didn't manage to catch QTBUG-99330, either).
Before removing the misleading test, verify that this assumption is
actually correct across all platforms.
Task-number: QTBUG-99330
Pick-to: 6.3 6.2
Change-Id: I2f497321abc26c4148ced5ac12a5880b9ff5ba9f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Amends 9b320edb53.
The above commit made the mistake of relying on the 30yr+ old
fundamental relation
size() - capacity() == freeSpaceAtEnd()
which, however, Qt 6's prepend()-optimization (freeSpaceAtBegin())
broke. Because of that, while size() - capacity() may be large enough
to hold the new data, if freeSpaceAtBegin() > 0, then freeSpaceAtEnd()
may not.
Fix by inspecting freeSpaceAtEnd() instead of capacity(). The
following reserve() call is unaffected, since it internally already
adds freeSpaceAtBegin() to the requested size, which is why the
unconditional reserve() in 9b320edb535a0fbe118933d2e983b73f90c32685^
worked while 9b320edb535a0fbe118933d2e983b73f90c32685's capacity()
check did not.
Fixes: QTBUG-99330
Pick-to: 6.2 6.3
Change-Id: I520f36216011423f97a24484263acd40d8b1fa43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
When an application is about to be closed and all the
destructors are called, if there isQtConcurrent::run on
the way, it crashes as the internal threadpool pointer
is nullptr.
Fixes: QTBUG-98901
Pick-to: 6.2 6.3
Change-Id: Idd84d1518fc6a225263e6666a0f1de2ccef79c82
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
- Stress test creates too many threads on run time.
Testing system is limited in 123.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I215074fa432c8aa18b2a753169646841c01d0b2a
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
As mentioned in the linked bugreport, we are not allowed to distribute
the uncompressed files from one of the XML test datasets that we use
in our tests.
This patch removes the uncompressed version, and replaces it by the
xmltest.zip archive taken from [0].
Once the test is started, QZipReader is used to uncompress the archive,
and once the test is done, the uncompressed data is removed.
However the test data from [0] is very old, so it is slightly different
from what we had previously (the previous data was taken from w3c).
As a result, 4 test cases are failing with this data. To fix it, we
store the updated versions of 4 xml files separately, and replace them
after uncompressing the archive.
[0]: http://www.jclark.com/xml/
Fixes: QTBUG-81503
Pick-to: 6.3 6.2 5.15
Change-Id: Ied5233970a529deebca56b1eab07fe1c328a2ee0
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Tests were leaking objects even if all tests passed. In two cases,
there just wasn't a delete at all, in a third, the existing delete
wasn't reached because of a QSKIP.
tst_QPropertyAnimation is now, locally, LSan-clean.
Pick-to: 6.3 6.2 5.15
Change-Id: Ia53d6f6e467f1d2598a7c50efcdf3a3732fe54df
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Due to the way Qt 5 and 6 registered type names, they end up producing
different type names for the same content for a typedef. For example,
because Q_DECLARE_METATYPE can't manage a comma (it's a macro), users
are forced to write something like:
using MyTypeMap = QMap<QString, MyType>
Q_DECLARE_METATYPE(MyTypeMap)
Qt 5's Q_DECLARE_METATYPE's argument "MyTypeMap" was the only name we
knew about the type, so that's what got saved in the stream. However, Qt
6 QtPrivate::typenameHelper is much more clever and obtains the name
from the compiler itself, so it "sees through" the typedef and registers
"QMap<QString,MyType>" as the official type name.
If another library/plugin has a different typedef name for the same type
(e.g., StringTypeMap), it's indeterminate which type gets saved and will
even change from run to run (depends on the QHash order).
[ChangeLog][QtCore][QDataStream] If QDataStream is used with a
QDataStream::Version < Qt_6_0 to serialize a user type that was
registered via a typedef with the metatype system, the typedef's name is
used in the stream instead of the non-typedef name. This restores
compatibility with Qt 5, allowing existing content to read the same
QDataStreams; reading from older Qt 6 versions should not be affected.
(Note: if more than one typedef name is registered, it's indetermine
which name gets used)
Fixes: QTBUG-96916
Pick-to: 6.3 6.2
Change-Id: I2bbf422288924c198645fffd16a8d811aa58201e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
By using the bucketForHash function we can loop through and find
some appropriate keys to test the edge-case. This will then
automatically keep the test working even if some internals
of QHash changes.
We do this because certain changes which change the bucket the
pre-selected keys would end up in could make the test a no-op,
without warning. And recent and upcoming changes have changed
both this and erase(). We limit the search-space to
the minimum numBuckets * 4, where minimum numBuckets is current
128.
Change-Id: I13b0bce15ee884144e3248846be34667fb5d35cc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
... and add some additional checks that hopefully leave the next
reader of the code a little less confused than this one was.
Pick-to: 6.3 6.2 5.15
Change-Id: I73c1b9b1ed1683e3b2de0d811d9b20d65464dff4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Also regenerate the expected output for tst_selftests, to match new
output. Changed one line source code in tst_seftests for the
same purpose.
Change-Id: I930ba4bb290568d6f67a8910a781725f01f08bf1
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Without the fix, some tests from tst_selftests were failing with:
Invalid MIT-MAGIC-COOKIE-1 key
Change-Id: I2d07f28d9b2c69fe8575fdf10b362d962f456970
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
memcpy() mustn't be called with a nullptr, even if the size is zero.
Fixes ubsan error:
tst_qiodevice.cpp:561:15: runtime error: null pointer passed as argument 1, which is declared to never be null
Even though ubsan only complained about one of them, fix all three
occurrences of the pattern in the test.
Pick-to: 6.3 6.2 5.15
Change-Id: I5c06ab4a20a9e9f8831392c46c6969c05248fdac
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
The first case is simple, as it's a static overflow. Theoretically,
the compiler would be allowed to just remove the complete function as
dead code. This is an error left from the port from int to qsizetype:
Qt 5.15 there has uint(MaxAllocSize) + 1, so use quint here again,
qint64 is wrong.
In the second case, we _may_ reach alloc == MaxAllocSize. Check that,
if we do, we don't then add 1 to it.
Pick-to: 6.3 6.2
Change-Id: I93044ed6f1b77559642fa1e4e8f313cf59eeeb79
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
- add test resources to binaries
- link Qt::Gui to tst_qpointer for static build case
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I311827b9c641eaf9537091b051c15f9fcbcb9f0c
Reviewed-by: Kimmo Ollila <kimmo.ollila@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Now that all platforms can deal with the full tst_QMetaType again,
remove the last traces of the workaround.
Pick-to: 6.3
Change-Id: I530cab8413f8b68903991b30a1f29b5871877a88
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QHash::operator[] could grow the hash even if the key being
looked up already existed. This in turn invalidated all iterators.
Avoid this by refactoring findOrInsert() to not grow if the key
already exists.
Added advantage is that this should make lookups of existing keys
slightly faster.
Fixes: QTBUG-97752
Pick-to: 6.3 6.2
Change-Id: I9df30459797b42c434ba0ee299fd1d55af8d2313
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Let's see whether splitting the TUs has made the test amenable to be
compiled with MinGW again.
Pick-to: 6.3
Change-Id: Icde1bad20943c7648dbb119ca879bce62325bd6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
There's no sense in copying a ring buffer. Moving is enough. This
marks an important step on the way to preventing accidental copies of
ring buffer content, because the 'QList buffers' member can now no
longer be implicitly shared. While the compiler will still emit the
code for detach()ing, it will now never be executed.
Pick-to: 6.3
Change-Id: I968bfe3e50c46720ed4baca55c99c1f9c518f653
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The only users of more than one read- or write channel are the SCTP
code and QProcess. SCTP being pretty rare, optimize for the common
case of at most two QRingBuffers for reading (QProcess) and one for
writing. Even with more channels, QVLA shouldn't be slower than QList
- on the contrary.
Need to adjust tst_toolsupport and TypeInformationVersion, as
QFilePrivate::fileName has changed.
Pick-to: 6.3
Change-Id: I3baf982ba1f4dc51463be8730e414f6164072d8b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Simplest possible graphical app, with event logging.
Change-Id: I6b1eb88c270a190becb23cc63d6d755ffbafcf52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Let's see whether splitting the TUs has made the test amenable to be
compiled on Clang for ARM again.
Pick-to: 6.3
Change-Id: I6bf1e31189f5058dc393adefabaf3014dce4bcf2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CSS styles can contain '@media <rule> {...}' blocks, which were
previously ignored for all values except "screen".
To use a media rule other than the default "screen" rule,
specify it before calling setHtml() with setMetaInformation()
and the new info value 'CssMedia'.
[ChangeLog][Gui][QTextDocument] Add css media rule support
for QTextDocument::setHtml()
Pick-to: 6.3
Fixes: QTBUG-98408
Change-Id: Ie05f815a6dedbd970210f467e26b116f6ee3b9ca
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This reverts commit 925ad78024.
Reason for revert: Meanwhile, the QNX VM has been assigned more
resources, and the offending test function been split. Re-enable the
test on QNX, to get back to previous test coverage.
Fixes: QTQAINFRA-4669
Pick-to: 6.3
Change-Id: Ib085fbfa7e0d8445f007d1a9346cee3113620720
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Check, in tst_qvarlengtharray, that the forwarding header still works.
Pick-to: 6.3
Change-Id: Ia03cf48457f538287880bb676aea3fa44aeb255f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This patch installs a QAbstractItemModelTester in the
QSortFilterProxyModel tests.
Change-Id: I9bdcc21ba12f919c91c5b9514a5f4362437318c2
Reviewed-by: David Faure <david.faure@kdab.com>
We were clipping the source rect to the image, both pre and post
scrolling, but did not apply the same logic to the target position.
By computing the target position based on the already clipped source
rect we ensure that the target position is also correct.
This was causing valgrind warnings on Linux, and crashes on Windows,
when trying to test the lower level QBackingStore::scroll() function.
The reason we were not seeing this in practice was that QWidget does
its own sanitation and clipping of the arguments before passing them
on.
As a drive-by, fix the access of image to use constBits instead of a
manual cast, and rename variables to better reflect their use.
Pick-to: 6.3 6.2 5.15
Change-Id: Ibc190c2ef825e634956758f612a018f642f4202b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Change the minimum amount of buckets to be at least
128, ie. one full Span. This will simplify some assumptions
in the code.
Regeneration of rcc test-data needed because the extra buckets
causes the order of the keys to change.
Task-number: QTBUG-91739
Task-number: QTBUG-98436
Change-Id: Ic0c7da03570cc4c4e6aacc9645e536aec3667a98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QHash changes some of its preconditions, so we must not call
findNode without verifying !isEmpty()
Task-number: QTBUG-91739
Task-number: QTBUG-98436
Change-Id: I2701b9a01187530f541a7c9a12db56c92f856d87
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Make sure configure fails early if a component cannot be found.
Task-number: QTBUG-98867
Pick-to: 6.2 6.3
Change-Id: I4baa35a84342df58ce8932601fb602be92ed5ab9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Especially static inline variables. This greatly reduces the amount of
code that existed in macros, moving them to templates.
Additionally, this removes one level of indirection from
Q_APPLICATION_STATIC by removing the std::unique_ptr. We now directly
manage the object's storage.
Change-Id: I2cffe62afda945079b63fffd16bcc825cc04334e
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Large amount of threads is unstable and do not finish in given time
Pick-to: 6.2
Change-Id: I0ce4c8cd278d6611c9e9da7326048279ccc458fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Also change usage of QDir::currentPath to QDir::tempPath
instead as QNX tests are run on CI at qemu over NFS.
Pick-to: 6.2
Change-Id: I2e1d6629299acd125117bcce90320c70eeb4a1a5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Modify similar like is used for Windows
Pick-to: 6.2
Change-Id: I133a8dde2e78cc66aa9544246cd750a6543b4883
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Filter out the last argument of type QPrivateSignal from the signal's
arguments passed to QtFuture::connect().
Pick-to: 6.2
Fixes: QTBUG-92501
Change-Id: Idcd6baba1f01fcc94fa64b1c7030a629d01ed7a1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
All Qt 6 containers have "fast" prepend these days. Except
QVLA. Instead of enabling "fast" prepend for QVLA, slowing down
idiomatic QVLA use, simply deprecate prepend().
There appear to be no users of this function in qtbase outside tests.
[ChangeLog][QtCore][Deprecation Notices][QVarLengthArray] Deprecated
prepend() because QVarLengthArray is the only Qt container without a
"fast" prepend. If you require that functionality, even though it's a
linear operation, then use insert(cbegin(), ~~~) instead.
Change-Id: I39ff1dd7d4de7fc08d5380a5a7450dd8c8996fe2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
After 7369c31ca1f446e81eda1c93ba13767ffcd83efe, unaccepted touch points
were not grabbed anymore in calls to activateImplicitTouchGrab. However,
gesture recognition relies that widgets for which a gesture has been
partially recognized grab also unaccepted touch points.
Add a parameter to allow the implicit grabbing to take place also for
unaccepted event points.
Add test case that replays touch events similar to what Squish is doing,
and fails without this fix.
Pick-to: 6.2
Change-Id: Idb0b20301b1827be57a03013a59043d97c2ee7b6
Reviewed-by: Stefan Gehn <stefan.gehn@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Unlike the shader resource binding lists that automatically recognize
in setShaderResources() when a referenced QRhiResource has been rebuilt
in the meantime (create() was called i.e. there may be completely
different native objects underneath), QRhiTextureRenderTarget has no
such thing. This leads to an asymmetric API and requires also rebuilding
the rt whenever an attachment is rebuilt:
rt = rhi->newTextureRenderTarget({ { texture } })
rt->create()
cb->beginPass(rt, ...)
texture->setPixelSize(...)
texture->create()
rt->create() // this should not be needed
cb->beginPass(rt, ...)
Avoid having to do that second rt->create().
Change-Id: If14eaa7aac3530950498bbdf834324d0741a7c4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Remove scaffolding in the test again.
[ChangeLog][QtCore][QList] Fixed a regression that caused the range
constructor to fail for pure input_iterator's.
Pick-to: 6.2
Fixes: QTBUG-99036
Change-Id: I72d01a9c44c3862c335d96538f26a453b4c7c554
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>