Commit Graph

13626 Commits

Author SHA1 Message Date
Ivan Solovev
a8261e327d QPromise: improve documentation snippet
The multi-thread snippet in the documentation, when copied as is,
could actually crash because of the race condition between the main
thread and the thread that generate results for the promise.
This is fixed by explicitly calling QPromise::start().
Actually, the underlying snippet already has this call, it just was
not included in the documentation.

This patch modifies the documentation snippet to include calls to
both QPromise::start() and QPromise::finish().

Fixes: QTBUG-109230
Pick-to: 6.5 6.4 6.2
Change-Id: Ic25f31a6b3b16ba6bc06a0b199289c8c5d50bab6
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
2023-01-09 10:03:48 +01:00
Kaj Grönholm
df00f9ea86 Support serializing the QShader for qsb version
Support serializing shaders with specific qsb version. The default
behavior remains the same, using the latest version.

Task-number: QTBUG-101062
Pick-to: 6.5
Change-Id: I090a88c1ccb3be4ac5eee1da4058afaa8bf3111c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-01-07 18:24:47 +01:00
Ahmad Samir
26b5325767 QFileInfo: use currentDateTimeUtc()
Instead of the more verbose currentDateTime(QTZ::UTC).

Pick-to: 6.5
Change-Id: Ie759f4270b12fca39c458bf85c8296f5342033db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-06 17:57:52 +00:00
Sona Kurazyan
9e61cc4f72 Fix crash when cancelling a QFuture that has continuation with context
To support cancellation of continuations attached via the parent future,
we store a pointer to continuation future's data in parent. This
requires preserving the lifetime of continuation future's data while the
parent is still alive (see 24dedaeaa1).
This is achieved by capturing the promise in the continuation's lambda,
which is only cleaned up after the parent's data is destroyed. This is
already the case for continuations without context, but was overlooked
for continuations with context: they transfer the ownership of the
continuation promise to lambda passed to QMetaObject::invokeMethod(),
which destroys the lambda's context after it's run. As a result, the
continuation's promise (and data, if there are no other copies of it)
is also destroyed, leaving the parent pointing to deleted continuation
data.

To fix this, capture a copy of continuation future's ref-counted data in
the continuation's lambda. This will guarantee that the continuation
data remains alive until the parent is destroyed and the continuation
is cleaned up.

Fixes: QTBUG-108790
Pick-to: 6.5 6.4 6.2
Change-Id: Ief4b37f31e652988d13b03499505ac65c7889226
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-06 14:00:56 +00:00
Øystein Heskestad
e088e01ace Accept U+2212 as minus sign in negative year unit test
Not all locales use ASCII hyphen-minus U+002D as minus sign. On macOS
using the nb_NO locale the U+2212 character is used instead when
displaying negative years. Verify that one of the two characters is
found.

Fixes: QTBUG-109853
Change-Id: I424539cc8d427ac199b4528e44bef98e45312d07
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-06 14:51:05 +01:00
Christian Ehrlicher
65a5efae69 SQL: more documentation and test cleanups
Remove some stuff no longer supported and refine others.

Pick-to: 6.5
Change-Id: I29730d5acfcf4a7ef3f569f101d3a4f72dd8b3aa
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-01-06 05:42:01 +00:00
Amir Masoud Abdol
2b2065bf35 Slow Deprecation of FILENAME_VARIABLE, replacement by OUTPUT_SCRIPT
As discussed in the latest CMake API Review, we are deprecating the
FILENAME_VARIABLE variable name everywhere, and replacing it with
OUTPUT_SCRIPT.

[ChangeLog][CMake] The FILENAME_VARIABLE option of
qt_generate_deploy_script and qt_generate_deploy_app_script is now
deprecated, use OUTPUT_SCRIPT option instead.

Change-Id: Ic8be33eefbc48540166ea0fcf1d1948b052d4b8a
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2023-01-05 21:56:21 +01:00
Ahmad Samir
2ed4e5d37d Fix two compiler warnings
Comparing singed/usigned ints.
Use override keyword.

Change-Id: I03d2c4359e0600360ebcfece593a3b125e5c9c53
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-01-05 21:01:22 +02:00
Ahmad Samir
b5701ca5a2 RCCFileInfo: get lastModified file time in UTC directly
These are time stamps, and they use toMsecsSinceEpoch(), no point
getting the time in Local time zone then converting it.

Change-Id: I2db2db5f9ebc062e65514a592fa7fa00cf1d179d
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-01-05 14:46:38 +02:00
Volker Hilsheimer
a2e38207da Blacklist the QAccessibility::focusChild test on the wayland platform
Task-number: QTBUG-109763
Change-Id: I2ef258a34743568dbbb90a802ea387e52c8cc613
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-04 18:38:00 +01:00
Ahmad Samir
41867c25f8 Use QFileInfo's file times in UTC for file timestamps
This is inherently faster than getting it in UTC from the underlying
native API stat call, then converting it to the Local Time Zone just to
compare them. The same goes for any use-case where you get a QDateTime
then the first thing you do is call t.to{Msec,Secs}SinceEpoch().

Change-Id: Ic13bcfd99b937c9f10f102ea7741832950a553c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-01-04 19:15:52 +02:00
Volker Hilsheimer
fb8701cb8b QListView: Prevent infinite loop when wrapping text of item with null-icon
If an item in a list view has a null icon, then the decorationSize gets
calculated as -1, -1. The style would then try to wrap the text to a
lineWidth of -1, ending up in an infinite loop in viewItemTextLayout.

To prevent that, don't set the HasDecoration flag of the style option
when the icon is null, and don't fall back ot the decorationSize unless
the flag is set.

Add a test for this particular item configuration. This also fixes the
widget baseline test with styles that don't provide all standard icons.

Pick-to: 6.5
Change-Id: I691db6abede9a9b2ad300f3ee7fbfdae5fb6097f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-01-04 13:42:06 +01:00
Axel Spoerl
df62cefdcb Skip tst_QWidget::optimizedResizeMove and ..._topLevel on wayland
Wayland omits optimizations tested in tst_QWidget::optimizedResizeMove()
and optimizedResize_topLevel() under certain circumstances, e.g. on
Ubuntu 22.04 / Gnome. This makes the test functions fail.

This patch skips the test functions on wayland platforms, if an
omission is detected.

This amends 2ec7a6322f.

Fixes: QTBUG-109746
Pick-to: 6.5 6.4
Change-Id: If0df6b1cf451a7f0dccfc1bb7411e895d7ae29a3
Reviewed-by: Liang Qi <liang.qi@qt.io>
2023-01-03 19:21:39 +00:00
Liang Qi
f09f516ac1 tests: skip tst_QComboBox::cancelClosesPopupNotDialog() on Wayland
QWindow::requestActivate() is not supported.

This amends c95de359b4.

Task-number: QTBUG-107153
Pick-to: 6.5 6.4
Change-Id: I45f53b5e9de85049ca41cc139a78a82450f53bed
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-01-03 12:07:43 +01:00
Axel Spoerl
71e67dec95 Stabilize tst_QSpinBox::sizeHint()
The test function used to flake on Linux occasionally.
8e6ede7cd1 provided a fix. While it
seemed to work, further analysis has shown that the root cause is
event sequence in case of multiple paint events.

This patch re-engineers the test function:

1. Allocate test widget on the stack instead of the heap.
2. Send layout requests posted by QHBoxLayout constructor and
QLayout::addWidget() before showing the widget.
3. Remove calls to QCoreApplication::processEvents().
They are unnessecary, because
- the size hint request counter is supposed to increase (by any number)
- QTRY_VERIFY processes events anyway until the counter increases or it
times out.

Pick-to: 6.5 6.4 6.2
Change-Id: I54998483725cbdd4899ba6f5469d7dae0980ab1d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-01-03 10:57:21 +01:00
Alexey Edelev
0a746a30a5 Remove QT_USE_SYNCQT_CPP
Option has not effect anymore.

Pick-to: 6.5
Change-Id: I199ff15ac68b785ba1787d44494c0b2dff3b1ad0
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-01-02 23:16:30 +01:00
Tor Arne Vestbø
ad31b5f4c7 Don't use native dialogs for tst_QApplication::closeAllWindows()
The test shows an application modal QMessageBox, but assumes that doing
so will be non-blocking, which for macOS is not the case (yet). Instead
of making the dialog window-modal, which would potentially affect the
logic of the test, we disable native dialogs. This should be fine, as
the purpose of the test is to test the is_closing logic of
closeAllWindows, which lives on a layer above the native dialogs.

Pick-to: 6.5
Change-Id: I6d627984a6ca452b876f34404b669fce41a00851
Reviewed-by: Doris Verria <doris.verria@qt.io>
2023-01-02 23:12:30 +01:00
Ahmad Samir
bab660d124 QStringConverter: add QLatin1::convert{To,From}Unicode()
With the methods that use helpers from qstring.cpp defined in the
latter.

Change-Id: I11d6b0bfb95efe34e56d33d2ecbfe8f4423a9e6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-30 16:36:24 +02:00
Marc Mutz
f68a2316d8 Long live QPromise::addResults()!
Makes the pre-existing QFutureInterface functionality available via
the public QPromise API.

[ChangeLog][QtCore][QPromise] Added addResults() to report multiple
results at once.

Change-Id: I18e6ef2781df422020b9022d78d6c45107b01668
Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-30 07:03:51 +01:00
Giuseppe D'Angelo
227b9cd084 QTypeInfo: remove further usages of isPointer / isIntegral
In preparation to their deprecation / removal.

Change-Id: Ia073a9f7caabbc06063a1e416b23cdb12788b283
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-30 01:51:27 +01:00
Giuseppe D'Angelo
e8f5f20319 QMetaType: fix value-initialization in a corner case
If a type is trivially default constructible, QMetaType (and QVariant)
think that it can be built and value-initialized by zero-filling a
region of storage and then "blessing" that storage as an actual instance
of the type to build. This is done as an optimization.

This doesn't work for all trivially constructible types. For instance,
on the Itanium C++ ABI, pointers to data members are actually
value-initialized (= zero-initialized, = initialized to null) with the
value -1:

https://itanium-cxx-abi.github.io/cxx-abi/abi.html#data-member-pointers

This means that a type like

  struct A { int A::*ptr; };

is trivially constructible, but its value initialization is not
equivalent to zero-filling its storage.

Since C++ does not offer a type trait we can use for the detection that
we want to do here, and since we have also decided that Q_PRIMITIVE_TYPE
isn't that trait (it just means trivially copyable / destructible), I'm
rolling out a custom type trait for the purpose.

This type trait is private for the moment being (there's no
Q_DECLARE_TYPEINFO for it), and limited to the subset of scalar types
that we know can be value-initialized by memset(0) into their storage
(basically, all of them, except for pointers to data members).

The fix tries to keep the pre-existing semantics of
`QMetaType::NeedsConstruction`. Before, the flag was set for types which
were not trivially default constructible. That included types that
aren't default constructible, or types that cannot do so trivially.
I've left that meaning unchanged, and simply amended the "trivial" part
with the custom trait. A fix there (to clarify the semantics) can be
done as a separate change.

Change-Id: Id8da6acb913df83fc87e5d37e2349a4628e72e91
Pick-to: 6.5
Fixes: QTBUG-109594
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-30 01:51:08 +01:00
Axel Spoerl
c69e727274 Use minimum size for in tst_QDockWidget::createTestWidgets
tst_QDockWidget::createTestWidgets did not set a minimum size for
test widgets. Upon unplugging, that can lead to a size correction in
connection with 8687c3f938cac56c4a2518576a5c9fac150d8de1, if the widget
gets too narrow to correctly display window handles. Test functions
checking the size after unplugging can fail in that case.

This patch sets a minimum size to each test widget created. The minimum
size corresponds to QStyle::PM_TitleBarHeight.

Task-number: QTBUG-106531
Pick-to: 6.5 6.4 6.2
Change-Id: I3e552b37416d57d8ed30e0b9de4eec55f07ea158
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-29 13:53:40 +00:00
Marc Mutz
92e913a541 tst_QStringApiSymmetry: fix a typo and deal with the fallout
Turns out we don't support QStringView/QUtf8StringView comparison, and
the only reason the corresponding test succeeded was because it
contained a typo (QStringView instead of QUtf8StringView).

Fix the typo and disable the now-failing test.

Pick-to: 6.5 6.4 6.2
Change-Id: I2210a247aac66743851e53578172a563ee1e96f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-29 12:20:27 +01:00
Axel Spoerl
8e6ede7cd1 Stabilize tst_QSpinBox::sizeHint() by explicitly calling setLayout()
The test function places a QSpinBox in a QHBoxLayout, which has a
QWidget parent. The spin box is expected to be shown with the widget.
While the widget is the layout's parent, the layout is not explicitly
set. That makes the test function flaky in some cases.

This patch adds QWidget::setLayout() to explicitly set the layout on
the widget.

Pick-to: 6.5 6.4 6.2
Change-Id: I3a1cc77c302c5ba96d3628d035139f9718dda9e5
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-12-26 22:49:53 +01:00
Wang Fei
936cae6b53 Add QFileInfo::readSymLink() to read the raw link path
The existing symLinkTarget() always resolves the symlink target to an
absolute path; readSymLink() provides access to the relative path when
that is how the symlink references its target.

[ChangeLog][QtCore][QFileInfo] Added readSymLink() to read the symlink's
raw target, without resolving to an absolute path.

Fixes: QTBUG-96761
Change-Id: I360e55f1a3bdb00e2966229ea8de78cf29a29417
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-23 06:26:44 +01:00
Christian Ehrlicher
ebd94489a3 SQL: remove unneeded test functions
testWhiteSpaceNames() returns true for all current database drivers so
it's useless and can be removed. safeDropView() and getPSQLVersion()
is not called anywhere, getMySqlVersion() is only used for a check for a
MySql version we no longer support.

Change-Id: I8d02f17f475821e81d309ee96897e772cdfb895d
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-12-22 19:26:51 +01:00
Volker Hilsheimer
2d87c4d881 QTextImageHandler: Resolve Nx images correctly for file or qrc URLs
The qt_findAtNxFile helper in qicon.cpp expects a local file name that
can be probed with QFile::exists. If the src attribute of an <img>
element specifies the location of the image as a file:/ or qrc:/ url
rather than as a local file name, then we need to strip the scheme
off the file path, and in the case of a qrc URL leave the :/ prefix
before calling the qt_findAtNxFile helper.

Amends, and partially reverts, 760df72565.
We can't avoid testing whether the source in the HTML is provided as a
URL before interpreting it as a file name.

Pick-to: 6.5 6.4 6.2
Fixes: QTBUG-109212
Change-Id: I7ea7a5bfde79bab90a8025c42e754129813dd0fc
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-12-22 19:19:33 +01:00
Marc Mutz
8420d3e0b2 tst_QString: test with QT_RESTRICTED_CAST_FROM_ASCII, too
QtBase didn't contain any checks for QT_RESTRICTED_CAST_FROM_ASCII, so
a recent addition to the QString::append/insert/prepend overload set
made calls with C string literal arguments ambiguous without the CI
noticing. We had a similar problem with QString::multiArg.

To increase test coverage, we now run tst_qstring two times:

- without any define
- with QT_RESTRICTED_CAST_FROM_ASCII (lots of changes necessary)

Most removals are expected, because they disable tests that check the
implicit conversions from QByteArray and const char*, but the
relational operators with QLatin1String objects might warrant fixing.

In some places, when the conversion wasn't the functionality under
test, replaced C string literals or QByteArrays with QLatin1String.

We should also test with QT_NO_CAST_FROM_ASCII, but that's even larger
surgery.

QString doesn't have a ctor from std::nullptr_t, so QString s =
nullptr; doesn't compile in C++17 mode, but does in C++20 mode, due to
the const char8_t* ctor.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: I0c5a31719a4b8dd585dd748e0ca0d99964866064
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-12-22 11:16:02 +00:00
Thiago Macieira
6e68b4d838 tst_qlogging: Skip backtrace tests under ASan
ASan inserts a lot of function calls in between our calls, so they end
up in the backtrace and cause unexpected results.

Similar to c672f148db.

Fixes: QTBUG-109559
Pick-to: 6.4 6.5
Change-Id: I69ecc04064514f939896fffd1732dd2bc0317ae4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-21 23:22:59 -03:00
Thiago Macieira
b242457d34 tst_qlogging: don't skip all tests under static builds
We only need to skip the backtrace ones, because there's no library
called "Qt6Core".

Pick-to: 6.4 6.5
Change-Id: I69ecc04064514f939896fffd1732dd680058ba6e
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-12-21 23:22:59 -03:00
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
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
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
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
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
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
6b5419f435 Extend tst_qxmlstream::readBack() to all Unicode characters
... not just those in the BMP.

The use of char32_t makes the isValid helper function easier to
read. Its passing to write() is enabled by the recent port to
QAnyStringView, which has a char32_t ctor.

Split into per-plane executions of the test function to avoid
running into timeouts on asan builds down the road.

As a drive-by, replace use of QPair with a proper struct, and
make the intervals symmetrically inclusive the bounds.

Pick-to: 6.5
Change-Id: I2c6858d7e6a88f448eac1b1e124d7d7b82828d4c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 22:58:10 +01:00
Thiago Macieira
686c02224c QUuid: add the ability to specify the byte order for 128-bit IDs
Some more modern protocols like Bluetooth LE transmit data in little
endian. QtBluetooth will benefit from this.

Change-Id: Id8e48e8f498c4a029619fffd1728c94ddd444537
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-16 19:29:10 +01:00
Thiago Macieira
0f932b9a5d QUuid: add a trivial structure to support exactly 128 bits
This is inspired by QBluetoothUuid's quint128, but with a better
name. It also matches systemd's sd_id128.

Change-Id: Id8e48e8f498c4a029619fffd172893dc1545adda
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-12-16 19:29:09 +01:00
Laszlo Agocs
4d36a83b6d rhi: vk: Fix up some legacy queue (family) index inconsistencies
Relevant mainly if we want to consistently expose these as the
theoretically correct uint32_t/quint32 from Qt Quick's
QSGRendererInterface. (not that int is not sufficient for
indexing the typical 3-4 families and 2-16 queues per family)

Some checks are not actually needed since the family index
must always be valid after create().

Pick-to: 6.5
Task-number: QTBUG-108895
Change-Id: I474ccea51a81e7a096281604ff79b7db4cdd2484
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-16 17:49:28 +00:00
David Edmundson
c7425aa295 dbus: Fix path to moc file in generated qdbusxml2cpp
qdbusxml2cpp takes a filename to use for generated output. It may be in
the form 'name.cpp' or just 'name'.

For the moc file we need to convert this from a path to a name of a file
in the same relative folder. It's not uncommon for this name to contain
dots as sometimes a dbus interface name is used directly.  For the cases
where a suffix is not provided the whole name should be used.

Pick-to: 6.5
Change-Id: I3bf4ae8b2b9121184c2786009e8b5abcc5e3e410
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-12-16 17:21:57 +00:00
Marc Mutz
7d0f08094a tst_qxmlstream: swap WHEN and THEN in readBack()
WHEN writing an invalid character, THEN we expect the writer to report
an error.

The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.

The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.

Pick-to: 6.5 6.4 6.2
Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-12-16 18:21:57 +01:00
Marc Mutz
7fa6670fa4 tst_qmlstream: re-use QBuffer instance in readBack()
This improves the runtime of this particular test function by
almost 17% on my machine.

Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Icd77cdda92374b92121988c99e56787d405fa2d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-16 18:21:57 +01:00
Ville Voutilainen
c672f148db Skip QProcess tests when run under ASan
These tests exhibit weird crashes when run under ASan, but sometimes
they fail sometimes they don't. Pending more insight, just skip this
test under that configuration.

Fixes: QTBUG-109329
Change-Id: I49d940de419f7166aab0da0b8c2b44297c4b6d74
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-12-16 19:21:56 +02:00
Alexandru Croitor
5e00c0c5e5 CMake: Remove direct qt_android_generate_deployment_settings call
in our tests.

They are not needed anymore since
d20f4ae706 got merged and the
QT_ANDROID_PACKAGE_SOURCE_DIR property is read at generation time
rather than configure time.
This means the
qt_internal_add_test ->
qt_internal_add_executable ->
_qt_internal_android_executable_finalizer ->
qt_android_generate_deployment_settings
calls take care of generation the right value for the property even
with CMake 3.16.

Remove the direct qt_android_generate_deployment_settings calls,
in preparation for their deprecation in public api.

Pick-to: 6.5
Task-number: QTBUG-88506
Task-number: QTBUG-88840
Task-number: QTBUG-108508
Change-Id: Ief1d0f9f620bd37beeedde26dedb66f728fa4a6f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-12-15 20:23:28 +01:00
Ben Fletcher
509fd9f2bb RHI: Buffer readback fixes and unit test
Fixes issues with readback of storage buffers modified on GPU for D3D
and Metal.  Adds unit test for storage buffer readback.

D3D
*  Fixes issue where QRhiBufferReadbackResult::completed callback could
be called twice on buffer readback completion.

Metal
* Fixes issue where buffer readback occurred prior to command buffer
being committed.

Change-Id: If55ac005f4438d66d2f65ea2e1ee0d5686c884ff
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-12-14 17:29:53 -08:00