Commit Graph

13314 Commits

Author SHA1 Message Date
Tor Arne Vestbø
10dc445d7c Blacklist quitOnLastWindowClosedWithEventLoopLocker on B2Qt
It's flakey according to http://testresults.qt.io/grafana/goto/1WdyblA7k

Pick-to: 6.2 6.3
Change-Id: I4e5a3492d55222675534359416c1017dcba2cbfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-06 17:11:48 +01:00
Laszlo Agocs
0a59101495 rhi: Add support for separate image and sampler objects
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>
2022-01-06 14:56:25 +01:00
Kai Köhne
93c1f481ab Add QTextDocumentFragment::toRawText()
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>
2022-01-06 07:58:39 +01:00
Marc Mutz
b385632ea6 tst_QGraphicsView: fix memleak
Found by asan.

Amends 01aeb5f7e4.

Pick-to: 6.3 6.2 5.15
Change-Id: Id61fc1bc1f40494371ac27cb258a22c89db24683
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 21:29:21 +01:00
Morten Johan Sørvig
9b096e8cb8 wasm: add secondary thread exec manual test
Pick-to: 6.3
Change-Id: Id16cddd703682d325d77ad597996960a8f521d1c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-01-05 21:25:42 +01:00
Marc Mutz
682831a00c tst_qanimationgroup: fix memleaks
Silences asan.

Pick-to: 6.3 6.2 5.15
Change-Id: I4995d9a6f0d4bb617fbb82b68289f7ad1ec0e96b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-05 08:22:00 +01:00
Marc Mutz
9f713e8d25 tst_QItemModel: fix memleaks
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>
2022-01-05 08:22:00 +01:00
Giuseppe D'Angelo
9ea1f0f8b9 Fix qobject_cast on partially destroyed QWidget/QWindow
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>
2022-01-05 02:47:47 +01:00
Laszlo Agocs
23f8d6c57f rhi: Drop the profiler for now
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>
2022-01-04 13:00:40 +01:00
Eirik Aavitsland
0f051815a0 Remove faulty #include from widgets baseline test
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>
2022-01-04 05:53:30 +01:00
Volker Hilsheimer
be8792d4fe Add baseline test for text rendering
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>
2022-01-04 00:11:48 +01:00
Laszlo Agocs
04cdde30d6 rhi: Enable exposing separate image and sampler objects from the shader
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>
2022-01-03 14:57:01 +01:00
Marc Mutz
ab24390804 tst_qtranslator: fix memleak
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>
2022-01-03 11:22:53 +00:00
Tatiana Borisova
72ba7cb186 Exclude filesystem autotests for INTEGRITY
- 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>
2021-12-30 15:38:14 +00:00
Marc Mutz
a5076c54fe tst_QStringList: check that join(u'\0') embeds NULs
... 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>
2021-12-28 23:09:44 +01:00
Tatiana Borisova
83906b8779 Exclude tst_qxmlstream test for INTEGRITY
- 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>
2021-12-28 18:56:07 +00:00
Tatiana Borisova
b076e84a7f Fix tst_qtextstream / tst_json run time failures on INTEGRITY device
- add test resources to binaries

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Ibeed93af43b4f951ca55f044fbfab00d4ab30468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2021-12-28 09:24:58 +02:00
Jeremie Graulle
3162f04dee Windows: Fix handling of childGroups() when fallbacks are disabled
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>
2021-12-27 10:41:43 +01:00
Marc Mutz
50ad52d804 tst_qsharedmemory: skip readOnly() test under asan
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>
2021-12-23 08:14:02 +01:00
Oliver Eftevaag
b369dc6021 QTextHtmlParser: fix prefix lookahead and html comments
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>
2021-12-22 15:56:30 +01:00
Marc Mutz
58058794b1 tst_qmetatype: fix memleaks
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>
2021-12-22 13:41:30 +01:00
Marc Mutz
b6239f70f5 tst_QStringBuilder: remove test that doesn't test anything
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>
2021-12-22 13:01:25 +01:00
Janne Juntunen
bd40e43695 Exclude tst_QLocalSocket::verifySocketOptions() on webOS
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>
2021-12-22 09:58:21 +02:00
Volker Hilsheimer
5d04c27a27 Stabilize tst_QGraphicsProxyWidget::scrollUpdate
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>
2021-12-22 01:34:56 +01:00
Marc Mutz
3552cf48e8 tst_QStringBuilder: verify a comment is actually misleading
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>
2021-12-21 22:56:00 +01:00
Marc Mutz
11409f4c02 QStringBuilder: handle freeSpaceAtBegin() in op+=
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>
2021-12-21 18:14:17 +01:00
Tianlu Shao
87b93c29be QtConcurrent::run crashes on program exit
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>
2021-12-20 13:18:26 +01:00
Tatiana Borisova
43e9f86cc1 tst_qglobalstatic is halted on INTEGRITY device
- 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>
2021-12-20 10:14:38 +02:00
Ivan Solovev
f8b74a4957 QXmlStreamReader: update test distribution
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>
2021-12-19 18:58:44 +01:00
Marc Mutz
dc672cf35a tst_QPropertyAnimation: fix leaks occurring under normal operation
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>
2021-12-18 10:38:21 +01:00
Thiago Macieira
46dc8e453a QVariant: use a typedef name when saving user types to QDataStream
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>
2021-12-17 17:54:05 +01:00
Mårten Nordheim
26267ef57e tst_QHash: Update the erase_edge_case test
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>
2021-12-17 16:37:49 +00:00
Marc Mutz
2fef4636aa tst_QPropertyAnimation: fix wrong comment
... 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>
2021-12-17 17:24:36 +01:00
Dimitrios Apostolou
38e7b5dcd6 Blacklist flaky tst_qgraphicswidget:initialShow on OpenSUSE
Task-number: QTBUG-98921
Change-Id: Ie2c3bed56fdd548a54035565639803c19819d4be
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-12-17 07:03:26 +01:00
Dimitrios Apostolou
725fc4da44 Properly indent qtestlib's XML output
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>
2021-12-17 07:03:26 +01:00
Dimitrios Apostolou
df0351836e Fix helper script to run successfully on X11
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>
2021-12-17 07:03:25 +01:00
Marc Mutz
572b55baa4 tst_QIODevice: fix UB (precondition violation) in SequentialReadBuffer::readData()
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>
2021-12-16 23:25:47 +01:00
Marc Mutz
b1938e5787 tst_QByteArray: fix UB (signed overflow)
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>
2021-12-16 23:25:47 +01:00
Tatiana Borisova
4aea86f5e8 Fix autotest runtime failures on INTEGRITY
- 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>
2021-12-16 19:45:08 +02:00
Marc Mutz
0d91ad44a7 tst_qmetatype: remove traces of compiler workarounds again
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>
2021-12-16 18:45:08 +01:00
Lars Knoll
d1626ca6b0 Fix hash lookup using the value of a key iterator
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>
2021-12-16 18:44:01 +01:00
Marc Mutz
82d90fbb9e tst_qmetatype: remove the previous MingW workaround
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>
2021-12-16 12:47:39 +01:00
Marc Mutz
81bf3e68b9 Make QRingBuffer a move-only type
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>
2021-12-16 00:01:41 +01:00
Marc Mutz
63a35898f4 QIODevice: use QVLA to hold the ring buffers, not QList
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>
2021-12-15 17:35:13 +00:00
Morten Johan Sørvig
292bdac4cf wasm: add rasterwindow manual test
Simplest possible graphical app, with event logging.

Change-Id: I6b1eb88c270a190becb23cc63d6d755ffbafcf52
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2021-12-15 18:06:11 +02:00
Marc Mutz
eb4206ba23 tst_qmetatype: remove the previous clang-arm workaround
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>
2021-12-15 15:11:17 +01:00
Ralf Habacker
2e2f1e2af7 Add css media rule support for QTextDocument::setHtml()
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>
2021-12-15 11:36:37 +00:00
Marc Mutz
9440c1a1fc Revert "tst_qmetatype: Temporarily disable expensive tests on QNX"
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>
2021-12-15 01:33:05 +01:00
Marc Mutz
daaa3088ec QVarLengthArray: don't allow syncqt to export base classes
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>
2021-12-15 00:04:45 +01:00
Andreas Buhr
72e802f3b0 Use QAbstractItemModelTester in all QSortFilterProxyModel tests
This patch installs a QAbstractItemModelTester in the
QSortFilterProxyModel tests.

Change-Id: I9bdcc21ba12f919c91c5b9514a5f4362437318c2
Reviewed-by: David Faure <david.faure@kdab.com>
2021-12-14 14:11:26 +01:00