Commit Graph

59366 Commits

Author SHA1 Message Date
Thiago Macieira
5aa66034c2 tst_qlogging: fix preprocessor directives
Reorganize them and fix the comment.

Pick-to: 6.4 6.5
Change-Id: I69ecc04064514f939896fffd1732dd57203cb21f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-21 23:22:59 -03:00
Volker Hilsheimer
c9cf4037ca QTextImageHandler: Add test coverage for resources and URLs
If an image source in HTML is specified via local file name or resource
path (i.e. without qrc prefix), then the correct image is loaded.

With file:/ or qrc:/ schema however, the image is either not loaded at
all, or the 2x image is not loaded. The qt_findAtNxFile helper in
qicon.cpp gets a URL path, but expects a file path (that can be tested
with QFile::exists).

Task-number: QTBUG-109212
Pick-to: 6.5 6.4 6.2
Change-Id: Ibcf687c69b3e53a10f21d718d28c8177a02d6be6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-22 00:48:08 +01:00
Volker Hilsheimer
d8e213a9e6 Enable and fix the test for QTextImageHandler
Amends 52ce0c177e, which added the test
without adding it to the parent directory.

Refactor the test code to be data driven, add the image files as
external test data files, and adjust the test code to find the files.

Use the QTextImageFormat from the document rather than a manually
crafted one, as otherwise we don't test a real usecase.

This also makes the test more flexible for adding qrc, resources, and
file URLs.

Task-number: QTBUG-109212
Pick-to: 6.5 6.4 6.2
Change-Id: Id0771037b961d95ec3cadd0cd6467d2448f22884
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2022-12-22 00:48:08 +01:00
Tor Arne Vestbø
0f16c76e83 Export the lcQpaFonts logging category
It's used by the WASM and iOS platform plugins.

Change-Id: Ia0c833e11a8db8d68782c84937fb444e5430cefe
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-12-21 23:45:06 +01:00
Samuel Gaist
253a4a146b examples: port xml examples to new connection style
Task-number: QTBUG-106893
Change-Id: I1cab8949700d7449f0615731c85a77bb9136b0d3
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 22:33:02 +01:00
Samuel Gaist
e686a13b7b examples: port network examples to new connection style
Task-number: QTBUG-106893
Change-Id: Id0f558362108fedececb9eede36becc04ff4e307
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Samuel Gaist
cf6522e5d7 examples: port qpa examples to new connection style
Task-number: QTBUG-106893
Change-Id: Icf9a40403029c6973167f468f51b2dbdc365a848
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Samuel Gaist
d9dd875301 examples: port qmake examples to new connection style
Task-number: QTBUG-106893
Change-Id: Ie4a4874359ac7750de344f4e3702ea7be09e7b53
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 22:52:17 +02:00
Samuel Gaist
c47e2aebb6 examples: port embedded examples to new connection style
Task-number: QTBUG-106893
Change-Id: I6d00c53b7747b36c5f0094e566713f13fe74f3de
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-21 21:52:17 +01:00
Bartlomiej Moskal
abe3bc1c43 Android: Do not close the keyboard for NO_ENTER_ACTION
After commit cc9144b4f3, virtual keyboard
is hiding after clicking the done button. This is expected behavior,
but not in case when imOption is set to IME_FLAG_NO_ENTER_ACTION[0]

This commit removes hiding keyboard in mentioned case.

[0]https://developer.android.com/reference/android/view/inputmethod/EditorInfo#IME_FLAG_NO_ENTER_ACTION

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-107662
Change-Id: Id280c4a67e3940fce5045724f77284a77c886f06
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-21 18:56:28 +00:00
Jaishree Vyas
46d2b45d2c Doc: Increase Test Function Timeout
Documentation on QTEST_FUNCTION_TIMEOUT environment variable

Pick-to: 5.15 6.2 6.4 6.5
Fixes: QTBUG-88652
Change-Id: Ib851eb2312088cf6b9ab277faa571757f4076ad4
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-21 16:48:50 +00:00
Joerg Bornemann
1f142d9038 CMake: Avoid repeating DESTDIR when deploying Qt libs and plugins
Let CMAKE_INSTALL_PREFIX be "/usr/local", and consider a project with a
call to qt_generate_deploy_app_script.

Installing the project with DESTDIR set to "/tmp/bla" would install the
project targets to "/tmp/bla/usr/local" but the Qt libraries to
"/tmp/bla/tmp/bla/usr/local".

That happened, because we used QT_DEPLOY_PREFIX as DESTINATION in
file(INSTALL). QT_DEPLOY_PREFIX starts with $ENV{DESTDIR} and
file(INSTALL) also prepends DESTDIR.

The value of QT_DEPLOY_PREFIX is controlled by CMAKE_INSTALL_PREFIX. Use
the latter as DESTINATION in file(INSTALL) calls.

Pick-to: 6.5
Task-number: QTBUG-109553
Change-Id: I8f06d81968fa0de4f17c4f8bc9b17cc052da4c12
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-12-21 15:46:53 +01:00
Assam Boudjelthia
c203ec2720 Android: handle move operation with content uris
Allow moving content uris if the destination is provided
a full content uri with a parent that's different from the
source content uri (i.e. different folders).

Note: since the underlaying Android APIs don't always know about
the parent of a uri, we do some step to deduce that, but that's
not always guaranteed to work.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-98974
Change-Id: If21954e5963f4eb0b96c7ccd983943ea2cab5b24
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-21 11:09:13 +02:00
Mikolaj Boc
0f18dadd5d Run clang-format on qwasmdrag.h/.cpp
Change-Id: Id67238566b6e25d8bf1645b5b83d898622eb5f89
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-12-21 09:58:09 +01:00
Mikolaj Boc
3e78331dac Use a smart pointer for QWasmDrag::m_mimeData
Change-Id: I10e27a92d37e5bf131c7c0f22860a957d1f1592d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-12-21 09:53:54 +01:00
Lu YaNing
ada9c2f8f8 QGraphicsProxyWidget: Don't unnecessarily check focusWidget twice
Amends commit bf5011815d

Change-Id: I18a8d26b08b4035d7a76fc51873696590292b181
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-21 13:03:14 +08:00
Bartlomiej Moskal
02f1e72d5a Android: Set EnterKeyNext as default type for QLineEdit
Behavior of EnterKey for virtual keyboard need to be changed for
QLineEdit. Before this commit, ImeOption was set to IME_ACTION_DONE.
Because of that, setting any text in QLineEdit automatically accept
QDialogs. That was annoying, when more than one QLineEdit need to be
set.

[ChangeLog][Widgets][Android] EnterKey type is now changed from
EnterKeyDefault to EnterKeyNext for virtual keyboard in QLineEdit. It is
done only if the focus can be moved to widget below.

Fixes: QTBUG-61652
Change-Id: I98a7686f9f675fccf0112b8d27d48ad8fd7a887f
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-21 04:11:58 +01:00
Assam Boudjelthia
4b892b1034 Android: fix jni function name from standardIcon to setStandardIcon
The issue came from 53b413f1c5.

Change-Id: Idb77a66dbd8649bdece213298b1e1676b22cc8ba
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-21 02:28:56 +02:00
Assam Boudjelthia
31a0d99fa5 Android: fix deprecations for getDrawable() on QtMessageDialogHelper
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Icd359663af11f44b4bcf0cd4e4f1f7f5a51242e4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-21 02:28:56 +02:00
Assam Boudjelthia
40b42ac517 Android: Fix deprecations AlertDialog.setButton()
https://developer.android.com/reference/android/app/
AlertDialog#setButton(java.lang.CharSequence,
%20android.content.DialogInterface.OnClickListener)

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I470acba581b7226b2d4a56754cf6372baa167eb4
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-21 02:28:56 +02:00
Mikolaj Boc
32666691c2 Move the window through the title bar element itself
The compositor is redundant in the process of moving the window.
Have the title bar react to move all by itself.

Additionally, a clearer structure in the window was introduced.
The non-client area has been extracted into a separate class, as
was the icon store and free DOM functions used across files.

Since it was now easy, made the window maximize/restore on double click
on the title element.

Fixes: QTBUG-107626
Pick-to: 6.5
Change-Id: Iba7f207e46806ae7162656965892ae5a48ac5ebe
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-21 00:20:01 +01:00
Yuhang Zhao
09141ebad7 Cleanup QGtk3Theme
1. Remove unused include.
2. Replace unnecessary null checks with asserts.
3. Remove dead code after the cleanup.

Change-Id: Ia3c01ae8a1fb491d513071c09f8095c93e35c292
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2022-12-21 06:38:09 +08:00
Yuhang Zhao
528f28f380 QStyleHints: code tidies
1. Use Q_D and Q_Q instead of d_func() and q_func().
2. Use early return.
3. Remove unnecessary semicon.
4. Add one new line to separate two unrelated functions.

Change-Id: Ie6171c857f00ca171e97723a0d517d2295bbbbd1
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-20 20:53:02 +00:00
Volker Hilsheimer
f21c4500a6 Android input context: don't connect to non-existing signal
Not all focus objects have a cursorPositionChanged signal, so don't
connect unless there is one. The code should perhaps not show the
software keyboard at all unless the focus object responds to the input
method query with cursor positions, but that's for a different patch.

Pick-to: 6.5
Change-Id: I0e01da42e96eb579d260b9158f005ad3215d0c26
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-20 19:35:20 +01:00
David Skoland
4b1229e523 Set WASM platform default to synchronous window event handling
Based on existing code, it appears that it's always
preferred in wasm to use synchronous delivery
(<QWindowSystemInterface::SynchronousDelivery>),
however, we can simply define this as the default mode
of operation, which will make these unnecessary.

Change-Id: Ia4c78593333e314f91efb266268917317794e2f5
Pick-to: 6.5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-20 18:13:47 +00:00
Doris Verria
af0f13b460 iOS File Dialog: Allow picking files if name filter is '*' (all files)
Name filters may be not empty and include all files ('*'). We should
not add any file type limitations in this case. Ammends commit
ce20b81070

Pick-to: 6.5
Change-Id: I3983e576a0ada4b7b40837c5c797359114b1ae02
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-20 16:21:01 +01:00
Ahmad Samir
8f0c366087 QStringConverter: don't shadow variables
Change-Id: I3c209585de2a7599f1cd4e58c1d3b3501425b903
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-20 15:16:31 +02:00
Marc Mutz
78db5cb643 tst_QByteArray/tst_QString: use new QtMiscUtils::toAsciiUpper()
... in lieu of <cctype>'s toupper(), which is locale-dependent, and
out-of-line.

The code doesn't run into the toupper(i) issue in the Türkiye locale,
because we don't run tests in that locale and because 'i' is not a
valid format specifier, but don't let the next reader of the code
guess when the use of toAsciiUpper() provides unambiguous guidance.

Task-number: QTBUG-109235
Pick-to: 6.5
Change-Id: I8988f5190441e1ae5cb57370952cda70ca6bb658
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-20 14:16:31 +01:00
Bartlomiej Moskal
eda4049a01 Android: Fix for low contrast status bar
After we start to use THEME: Theme_DeviceDefault_DayNight, status bar
icons have low contrasts on some devices.

That is why we need to set APPEARANCE_LIGHT_STATUS_BARS[0] in case when
Status bar color is too bright.

[0]https://developer.android.com/reference/android/view/WindowInsetsController#APPEARANCE_LIGHT_STATUS_BARS

Fixes: QTBUG-108365
Pick-to: 6.5 6.4 6.2
Change-Id: I38a31cfb0a3a1b912b86ed1b302c567e14a7ffcc
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-20 13:42:31 +01:00
Assam Boudjelthia
c1fa5d602c Android: handle rename() operation with content uris
Allow renaming content uris if the destination is provided
as a direct fileName (i.e. not full content scheme path),
and if the destination has the same trailing path (or parent)
which means a rename in the same folder structure.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-98974
Change-Id: Ibc4973366807dd5284c19912ab04ff90f2a573cb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-12-20 12:42:31 +00:00
Xavier BESSON
30efb24d45 CMake: Expose generated resource files to IDEs
Add generated qrc files to source of the target so they will be
displayed (and reachable by Follow Symbol in QtCreator) under
the '<Build Directory>/.rcc' node in the Project Tree of QtCreator.

Fixes: QTCREATORBUG-28604
Change-Id: I0c56e168de03027ec2981cfa0bceb8f10a8d71b2
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-12-20 08:29:43 +00:00
Ahmad Samir
348911a4e7 RCCFileInfo: use QString prepend optimization
Instead of using QStringBuilder (which always allocates a new QString to
hold the result of the concatenation), reuse the existing QString, and
use prepend which will typically have allocated extra space, reducing
the chances it will reallocate.

Change-Id: Ic4ef775246db58e56152a6ede1a75f7621950dd9
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-12-19 20:37:05 +00:00
Axel Spoerl
ff83fc7590 Map toolbar drag delta from native pixels
The delta (drag distance) for dragging a tool button with in a tool
bar was calculated by subtracting the global mouse press position from
the drag event's global position.

This has lead to a miscalculation when dragging the button across
screens with different resolutions. The new relative position within
the tool bar became negative, which eventually has lead to resizing of
other tool buttons in the same tool bar.

This patch calculates the delta based on native pixels, which ensures
a correct value in all cases. It falls back to the existing calculation
if no window handle can be established from the tool bar.

Fixes: QTBUG-103720
Pick-to: 6.5
Change-Id: I09168b597f6c43a119041d00f5b07e1895fdf4b3
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-12-19 21:16:38 +01:00
Christian Ehrlicher
13053d455e SQL: remove unneeded CMake commands - these plugins were removed in Qt6
Change-Id: I6880b514a92a01b9a8a8d84fc814aa38c95b09ef
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-12-19 20:32:18 +01:00
Christian Ehrlicher
64ed1cab2d SQL/OCI: replace deprecated QDateTime() ctor
Change-Id: I0d36f036a9814e85f4606644e0fd8801e76ffccf
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-12-19 20:32:18 +01:00
Marc Mutz
451dbca16c QString: use new QUtf8StringView overloads
... to prepend/append/insert QByteArray and const char*, instead of
the old inline QString::fromUtf8(), which litters the call sites with
temporary QString objects.

Can't use qToUtf8StringViewIgnoringNull() for QByteArray parameters to
avoid the extra isNull() check, because some QString tests depend on
whether we append/prepend/insert null or empty.

Pick-to: 6.5
Fixes: QTBUG-109092
Change-Id: Ibf7b99aad844d0c2219ccc1c30f6666c5dfc7758
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-19 19:05:46 +01:00
Ville Voutilainen
413798cc01 Skip tst_qconcurrentrun completely if running under an emulator
Task-number: QTBUG-106906
Pick-to: 6.5 6.4
Change-Id: I1836f5be42528c71470c2cd6509f7125feb47691
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-19 15:31:10 +00:00
Ville Voutilainen
f7559904d0 Autoclose a FILE* if we open it
Task-number: QTBUG-105736
Change-Id: I2bc10b54b77436cad914ec21fd85678c54de4305
Pick-to: 6.5 6.4 6.2
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-19 15:31:10 +00:00
Assam Boudjelthia
f77668ffec Return the QFileInfo::baseName/QDir::dirName() from fileEngine impl
Get those values from the file engine instead, this is relevant
especially on Android for content uris.

Pick-to: 6.5 6.4 6.2
Task-number: QTBUG-98974
Change-Id: I65fe4c59e5f1feed0dcf14cc8988b4a40d9d979e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-19 11:17:00 +00:00
Leena Miettinen
d77b5fbcf1 Doc: Add link to Tools Examples from the Qt Widgets module front page
The example docs were difficult to find.

Pick-to: 6.4 6.5
Change-Id: Id7003b140275e722dad2c41767eabc24fef728e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-19 09:19:53 +01:00
Nicholas Bennett
2e3793a91b Docs: Fix broken link to "Adding OpenSSL to Android" page
Fixed the link.

Pick-to: 6.2 6.4
Change-Id: I015ca7d2052255b96cf2053b81c47d658bab677e
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-19 09:29:40 +02:00
Marc Mutz
b8c2a0c18a QtMiscUtils: add missing toAsciiUpper(), use it in moc
... to make moc code locale-independent.

The C toupper function is locale-dependent. Given the right locale
(Türkiye, e.g.), toupper('i') is either

- İ (LATIN CAPITAL LETTER I WITH DOT ABOVE; if representable) or
- i (unchanged; if it isn't)

Both results are wrong for the present use-case.

Fix by adding QtMiscTools::toAsciiUpper(), complementing existing
toAsciiLower(), and using that. It's private API, but moc.h, despite
the name, is not a public header.

Pick-to: 6.5 6.4 6.2 5.15
Task-number: QTBUG-109235
Change-Id: Iaf071ba2113b672aa0aed3da6a4e1d47fb659365
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-18 12:45:30 +01:00
Ulf Hermann
5a0dcda171 CMake: Allow contents of resources to be replaced by empty files
This makes it possible to process QML files using qmlcachegen, and
retain the file nodes in the resource file system, but remove their
actual content from the binary. To do so, you need to mark your files
with the QT_DISCARD_FILE_CONTENTS source file property.

Fixes: QTBUG-87676
Fixes: QTBUG-103481
Fixes: QTBUG-102024
Fixes: QTBUG-102785
Change-Id: I93d5a2bfca1739ff1e0f74c8082eb8aa451b9815
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-12-17 20:43:51 +01:00
Yuhang Zhao
3034d698eb Windows QPA: remove long-time dead code
It has been commented out since at least 5.3 (the earliest version
hosted on the GitHub mirror), so it seems this code is not used
by anyone for more than 10 years. We can safely remove them.

Change-Id: Ia475ce5a5fdd6db48f415b3647677a35c79bfc5d
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-12-17 20:34:31 +08:00
Marc Mutz
ba52b29d33 QLatin1/String/View: don't decay the arg() arguments
This turns const char[] arrays into const char* pointers and
therefore prevents the implicit conversion of string literals
to QString in QT_RESTRICTED_CAST_FROM_ASCII.

Fix by avoiding the decay.

Also simplify the template magic.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I88164a1866ac71b41d9cd1564f3a5e83d2d42aaa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-17 07:18:07 +00:00
Juha Vuolle
67d7d8746c Fix minor permission doc typo
Pick-to: 6.5
Change-Id: I4af4f2859940bd121cdd0a42eab52f94f3cbc673
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-17 00:38:23 +02:00
Axel Spoerl
5edb71c6d4 Fix QWidget::restoreGeometry when restored geometry is off screen
If a widget's geometry is restored to a screen, which is smaller than
the one it was saved from,
- the widget could appear (partly) off screen
- the widget's title bar and resize handles could be inaccessible

This patch refactors and documents checkRestoredGeometry.
In a first step, the restored geometry's size is checked against
a given screen size. It is corrected if necessary.
In a second step, the restored geometry is moved inside the screen,
if necessary.
It makes the function a static member of QWidgetPrivate in order to
expose it for auto testing and adds a respective test function to
tst_QWidget.

Fixes: QTBUG-77385
Fixes: QTBUG-4397
Task-number: QTBUG-69104
Pick-to: 6.5 6.4
Change-Id: I7172e27bfef86d82cd51de70b40de42e8895bae6
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-16 22:58:11 +01:00
Marc Mutz
4ccb10dc91 QXmlStreamWriter: fix a thinko in doWriteToDevice(QSV)
Check for state.remainingChars to signal an encoding error only after
the last chunk has been processed. Splitting surrogates at chunk
boundaries is normal operation, not an error. Only if this happens at
the end of the whole input should we raise an error.

Amends fa2153bd10.

Pick-to: 6.5
Change-Id: Id92e37becaed25bbc11e0c22dedc4d41fb23f92a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 22:58:11 +01:00
Marc Mutz
26c190f57e QTest::WatchDog: fix missing timeout resets on test function change
Since e0cad1aab5, the code suffered
from an ABA problem where the TestFunctionStart expectation is set
in testFinished(), but by the time WatchDog::run() gets around to
examining the state when returning from condition_variable::wait()
in waitFor(), the next beginTest() has already set the expectation
back to TestFunctionEnd.

There are several known solutions for ABA problems. Embedding a
generation count into the expectation state seemed to be the most
straight-forward fix, and can be done without DWCAS support, because
the state is just 2 bits, leaving the other 30 or 62 bits for the
generation counter, so do that.

[ChangeLog][QTestLib] Fixed a bug which caused
QTEST_FUNCTION_TIMEOUT to be applied to the whole test execution,
as opposed to each test function.

Fixes: QTBUG-109466
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: If71ade932330407b85d204d45c74350c651325fe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-16 22:58:10 +01:00
Marc Mutz
17a7e5cfdd QTest::WatchDog: Extract Method setExpectation()
Keeps the code DRY and enables a follow-up commit to fix QTBUG-109466.

Task-number: QTBUG-109466
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I2b904ea7b38286b07049524ba63c2c5028e680bb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-16 22:58:10 +01:00