Commit Graph

13337 Commits

Author SHA1 Message Date
Axel Spoerl
5cc5ba8aac Remove unused legacy testdata directory from QWidget kernel unit test
Pick-to: 6.3
Change-Id: Id857c12321b72a7f35e9e7a157dc39f7fb95ecde
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-12 14:27:59 +00:00
Morten Johan Sørvig
eef865cdc5 Make QCursor::setPos() use the correct screen
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>
2022-01-12 03:17:47 +01:00
Zhang Hao
38a66aa53a xcb: Correctly update primary screen status with RandR 1.5
This amends d8f37d94e5 .

Fixes: QTBUG-99605
Pick-to: 6.3
Done-with: Liang Qi <liang.qi@qt.io>
Change-Id: Ia4cf67d6ebeed36596c0342302aa0b4af01769bc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-01-12 03:17:47 +01:00
Marc Mutz
d4611ba3a5 QFlatMap: add an alias for using QVarLengthArrays
... 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>
2022-01-12 02:03:15 +01:00
Marc Mutz
f044664c68 QFlatMap: add try_emplace (w/o hint)
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>
2022-01-12 02:03:15 +01:00
Shawn Rutledge
1abaf9d5d6 Enable markdown writer 'preformats with embedded backticks' test
It happens to pass now.

Pick-to: 6.2 6.3
Change-Id: I0f6132251c3ee4ee2fef5530f8ed6997e3c946ab
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-01-12 00:18:35 +01:00
Shawn Rutledge
8d2417ed9a Add a markdown writer test for a checklist item ending with code
Task-number: QTBUG-81583
Change-Id: I32540615be66f4e45bb1b3b19e914bea3aacf3e7
Pick-to: 6.3 6.2 5.15
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-01-12 00:18:35 +01:00
Laszlo Agocs
cdfbe70923 rhi: Improve the handling of HDR capable texture formats
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>
2022-01-11 22:38:35 +01:00
Thiago Macieira
bb35b2f64d QByteArray: fix append() with a negative length
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>
2022-01-11 15:12:30 +00:00
Shawn Rutledge
17dca04a61 Use QTextCharFormat::fontFixedPitch to remember Markdown backtick spans
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>
2022-01-11 15:04:25 +00:00
Axel Spoerl
12c56aa43a Turn QLabel wordWrap unit test into data driven test
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>
2022-01-08 07:43:40 +01:00
Axel Spoerl
000f8b8c0b Cleanup of getSetCheck method in QLabel unit test
Remove dead code and replace QCOMPARE with QVERIFY.

Pick-to: 6.3
Change-Id: I756bc0f160b8a27f38b705e919df2aa9d3b1f38a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-08 07:43:40 +01:00
Axel Spoerl
ef0b8a535a Clean up QLabel unit test for unicode
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>
2022-01-08 07:43:40 +01:00
Alex Trotsenko
6076c9fa13 tst_qfuture: fix compilation on MSVC
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>
2022-01-08 01:54:18 +02:00
Volker Hilsheimer
13ca705b48 Fix compiler warnings by marking overrides in test
Pick-to: 6.3
Change-Id: Iab5f121ee49c71821a2b71b20ddb36846b1bbaf7
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-01-07 21:49:57 +01:00
Janne Juntunen
60c22f05e9 tst_QIcoImageFormat: move the test behind a feature flag
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>
2022-01-07 20:34:50 +02:00
Axel Spoerl
b4e15c9b30 Remove unused legacy files from QLabel unit test
Pick-to: 6.3
Change-Id: Ibd4ec0bc987d52877154ff2fd0d43e583f08455b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-01-07 19:34:50 +01:00
Milla Pohjanheimo
e4c2460507 Add BC files for 6.2.0
Binary compatibility files added.

Change-Id: Ic237e3b2105bc84ea802b9f65ec7440c26ee7328

Pick-to: 6.2
Change-Id: Ic237e3b2105bc84ea802b9f65ec7440c26ee7328
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-01-07 13:31:38 +00:00
Marc Mutz
e6cd1eb079 QFlatMap: fix mixed rvalue/lvalue insert overloads
They never worked.

Pick-to: 6.3 6.2
Change-Id: I9a15c848416419823f28ea580248fbe93a4365dd
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2022-01-07 14:31:38 +01:00
Laszlo Agocs
7cbac745dc rhi: Returns mapping tables by value from QShader
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>
2022-01-07 01:03:47 +01:00
Marc Mutz
521fea9169 tst_qtouchevent: remove two QMutableEventPoint::from() uses
The input is already a QMutableEventPoint.

Task-number: QTBUG-99615
Pick-to: 6.2 6.3
Change-Id: I82b3e83ffa5b87c9a562cb3bb1d7bad0a0cd5245
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-01-06 22:06:10 +01:00
Shawn Rutledge
f1e60de665 QTextMarkdownImporter: don't apply text char format to list item block
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>
2022-01-06 22:06:09 +01:00
Shawn Rutledge
7b4b5115dd Blacklist tst_QTouchEvent::multiPointRawEventTransOnTouchPad - macOS
Task-number: QTBUG-99489
Change-Id: Ia74b0f7e3a82fe7cf68248109e84e8decbbc4ae3
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-01-06 21:06:09 +00:00
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