Commit Graph

14604 Commits

Author SHA1 Message Date
Mårten Nordheim
d1e8a9978b tst_qapplication: Add dependency to helpers
It's convenient.

Pick-to: 6.4 6.2
Change-Id: I1877754bee038e0313765efe2dc845ea5504cc61
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-28 18:41:18 +02:00
Thiago Macieira
bfd8463f4d QOperatingSystemVersion: fix ABI problem with dllimport on Windows
I'm not entirely sure whether this is a toolchain bug or if this is
intended. This commit ODR-uses all the static inline variables in
QOperatingSystemVersion so they are added to the list of exported
symbols in QtCore.

On Windows:

$ objdump -p bin/Qt6Core.dll | grep Windows11E
        [2534] _ZN23QOperatingSystemVersion9Windows11E

On Linux:

$ eu-readelf --dyn-syms lib/libQt6Core.so | grep Windows11E
 1985: 0000000000575430     16 OBJECT  GNU_UNIQUE PROTECTED     18 _ZN23QOperatingSystemVersion9Windows11E@@Qt_6

Pick-to: 6.4
Change-Id: Ia317fd249bcd80dbd02c198803a3a61178c0c219
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-28 09:41:17 -07:00
Yuhang Zhao
32774f13d9 QWinRegistryKey: Fix how we handle the default value, take 2
It seems the value name correction is not needed at all,
and we must not do such correction.

Amends commit 738e05a55a

Task-number: QTBUG-107794
Change-Id: I903a762aafab4b55275beb8438e6769285821567
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-10-28 09:27:13 +00:00
Assam Boudjelthia
c7b93d471d Android: delete dead code for tst_android under tests/auto/other/android
This amends 23780891a5 which moved the.txt
test to tets/auto/corelib/platform/android and kept the old location
mistakenly.

Pick-to: 6.4 6.2
Change-Id: If58422f9a94cfe4d6a941cc5453d8f0506057dcb
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-10-26 14:57:40 +03:00
Thiago Macieira
c2445aeadb tst_QFile: remove unused variable on Windows
Removes a warning in the build.

Pick-to: 6.4
Change-Id: I07ec23f3cb174fb197c3fffd17215c40b40333cb
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-25 18:33:14 -07:00
Thiago Macieira
d18d341341 Tests: fix namespaced build on Windows
Amends 371214dea7.

tst_qfile.cpp:401:9: error: reference to ‘QTest’ is ambiguous
qttestglobal.h:27:11: note: candidates are: ‘namespace TestNamespace::QTest { }
filesystem.h:28:11: note:                 ‘namespace QTest { }’

Pick-to: 6.4
Change-Id: I07ec23f3cb174fb197c3fffd17215c1eeeadf7fd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-25 18:33:14 -07:00
Ahmad Samir
997713283e QFile: remove unconditional QTest::qWait calls
The whole unittest still passes on my machine.

Before:
tests/auto/corelib/io/qfile/tst_qfile    =  19.30 sec*proc (1 test)

After:
tests/auto/corelib/io/qfile/tst_qfile    =   4.28 sec*proc (1 test)

Change-Id: I46fd51abeaecacd44cac1c56e76871fde2a44a52
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-25 21:18:17 +02:00
Amir Masoud Abdol
2625e5f050 Make the PREFIX Parameter of the qt_add_resources Optional
The `rcc_PREFIX` will be set to `/` if it is not passed to the
function and it is not defined in `QT_RESOURCE_PREFIX`.

I also removed an unnecessary check of the `rcc_PREFIX`.

[ChangeLog][QtCore][CMake] The `PREFIX` parameter of the
`qt_add_resources` is now optional. If not passed, and
`QT_RESOURCE_PREFIX` is not defined, `/` will be used as the path
prefix.

Fixes: QTBUG-104938
Change-Id: I6524ab5dc54f035272e4c2e3154eb67591efb650
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-25 16:39:25 +02:00
Johannes Kauffmann
30eac4a4f9 benchmarks: fix configuring with -no-feature-sql
With -no-feature-sql, CMake would error out because the target Qt6::Sql
didn't exist. Fix this by checking if the target exists.

Task-number: QTBUG-102480
Pick-to: 6.2 6.3 6.4
Change-Id: I411631acfd336ea699833954f86711067d160c04
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-25 16:39:25 +02:00
Jani Heikkinen
283e29e539 Revert "Android: fix Android assets handler not listing dirs with only sub dirs"
This reverts commit 89f89cedc0.

Reason for revert: QTBUG-107879

Task-number: QTBUG-107627
Fixes: QTBUG-107879
Change-Id: I31ceec5156837281b25fd17024c01e3477550ce0
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-25 13:38:46 +00:00
Laszlo Agocs
2c639aea76 rhi: Add a manual test for simple stencil-based outline
Interesting on its own just because it exercises stencil testing,
unlike any of the other existing manual tests.

In addition it serves as a base example for how outlines could be
done, it is one possible approach at least. (render with stencil
write, then render again slightly scaled up with a solid color with
testing against the stencil buffer content)

Change-Id: I0c845a9004136f229cab037f6f0aab2f772bdd76
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-10-25 15:19:41 +02:00
Harald Sitter
75e8754875 a11y: support GetAccessibleId for at-spi
This introduces a new helper function accessibleIdForAccessible
(inspired by Windows' automationIdForAccessible) to synthesize an id out
of the objectNames of the accessible parent chain. The id is then
exposed via the GetAccessibleId D-Bus function for consumption in a11y
tools.

Change-Id: If72b86c5864c43f4ca842aa11423dd8aea0dde4a
Reviewed-by: Aleix Pol Gonzalez <aleixpol@kde.org>
2022-10-25 15:19:41 +02:00
Tor Arne Vestbø
4709c938db Apple: Add CFBundleAllowMixedLocalizations=YES to Info.plist files
We currently don't have any machinery for qmake or CMake to map
translations declared via TRANSLATIONS += or qt_add_translations
to the Info.plist CFBundleLocalizations key.

This results in macOS and iOS falling back to the development region,
CFBundleDevelopmentRegion, as the only supported localization of the
app, which is in most cases set to 'en'.

Unfortunately this doesn't work well with the behavior of iOS 11+
and macOS 10.13+ where the OS will set the locale of the app to
the best match between the app's supported localizations and the
user's preferred language.

https://developer.apple.com/library/archive/qa/qa1828/

Since we only support a single localization, the development region,
the locale always ends up as 'en_<REGION>', which after QTBUG-104930
is also reflected in the QLocale's uiLanguages(), resulting in the
QTranslator machinery always picking English translation for the app.

As long as we don't explicitly declare CFBundleLocalizations we need
to opt out of the system's behavior of finding the best match between
the app's declared localizations and the user's preferences, which we
can do via the CFBundleAllowMixedLocalizations key.

Fixes: QTBUG-63324
Pick-to: 6.4
Change-Id: If7586d342148cbbb1d2a152cef039aad4448b13c
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-25 10:06:59 +00:00
Volker Hilsheimer
483ae6c448 StyleSheet: use item background rule when filling row backround
QTreeView draws the different sub-rects of an item's background over
multiple calls to drawPrimitive(PE_PanelItemViewRow). The item row is
not separately stylable, but the item might have a styled background
property. To get a consistent background, we must use the item's
background rule when filling the item's row background.

To fix that, delegate the filling of the branch background to
drawPrimitive(PE_PanelItemViewRow), and implement PE_PanelItemViewRow
handling to render the rule for the ViewItem pseudo element if there is
a background rule defined for it.

Add a baseline test stylesheet for this scenario. Note that the selection
in an item view is better styled via the selection-background-color
qss property.

Task-number: QTBUG-73251
Task-number: QTBUG-106227
Pick-to: 6.4 6.2
Change-Id: I5d0c170f78009fe5015dd749975e6df27485b3b8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-10-25 05:16:15 +02:00
Volker Hilsheimer
6f9d31be49 Baseline: add stylesheet setting show-decoration-selected for treeview
The fix for QTBUG-73251 in f4976f86cd
resulted in QTBUG-106227. Add baseline test coverage for the respective
configuration to make sure we don't regress.

Refactor mapping of index to configuration to make accessing of subitems
more robust.

Task-number: QTBUG-73251
Pick-to: 6.4 6.2
Change-Id: I530ecd67fa5663f219884f641bc5e25c7ac5fe73
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-10-25 05:16:15 +02:00
Christian Ehrlicher
05ec29f76c SQL/Tests: fix tst_qsqldatabase::caseSensivity() for MySQL on linux
MySQL has a different default setting for case sensitive table names on
linux and windows which makes the test fail on linux but work on
windows when using the database with the default settings. Read out the
respecitive setting so the test will pass every time.

Change-Id: I8651858d47652022ddc4b6386a6153cf70c6fed6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-24 19:08:17 +00:00
Volker Hilsheimer
94039c9a6a Baseline test: add coverage for treeview with alternate rows
After f4976f86cd, alternate rows are no
longer painted all the way, as the code is never called for styles that
don't include the tree item decoration in the selection, such as the
Windows styles.

Add a baseline test to record the appearance of such trees.

Task-number: QTBUG-106227
Pick-to: 6.4 6.2
Change-Id: If21076393fdf65205cab91299f8e557dbe9c4ea9
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-10-24 14:20:28 +02:00
Yuhang Zhao
bea5649cd1 Windows: bump NTDDI_VERSION to latest version and remove some duplicated code
We have NTDDI_WIN10_NI (0x0A00000C) in the Win11 SDK (10.0.22621)
so bump the value in Qt (currently 0x0A00000B) to it.

And when searching for _WIN32_WINNT/WINVER/NTDDI_VERSION throughout
the whole qtbase codebase, I found some duplicated code, mostly
leftovers from the legacy time. Replace them with our own windows
header can achieve the same effect: we have defined all the necessary
macros to unblock the latest features. And place the header at the
top most place to include the macros as early as possible.

Change-Id: I37d9ac40ca9748208c7b2e89f374eda362dbefd6
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-10-24 13:22:24 +08:00
Tor Arne Vestbø
d84ddf5905 Apple: Use 'en' instead of 'English' as development region
This is consistent with what $(DEVELOPMENT_LANGUAGE) reports, as well as
the Apple Locales Programming Guide which states that "Locale names such
as “English”, “French”, and “Japanese” are deprecated in OS X and are
supported solely for backward compatibility."

Pick-to: 6.4
Change-Id: I99779d678ef9d4ea90249572f2f977e9b4df6c62
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-23 17:36:46 +02:00
Shawn Rutledge
c3e2a624fb QApplication: send QHoverEvents with correct scenePosition()
The QHoverEvent ctor takes two points: pos and globalPos; pos is then
passed as both the scene and global pos to the QSinglePointEvent ctor,
which calls QMutableEventPoint::setScenePosition() on the persistent
QEventPoint instance and then detaches befeore setting ephemeral state.
Therefore, we must construct QHoverEvent with scene position first, not
local position, so that the right value is persisted; it's better to set
local position after the detach(), whereas it's too late to fix the
persistent point then.

Pick-to: 6.4
Fixes: QTBUG-106918
Change-Id: I45726a9ec05bba2fe0cde6f5fb87c269105caca6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-23 09:28:45 +02:00
Peter Varga
55449a6528 Fix bool comparison in tst_qopenglwidget.cpp
This commit amends 1ea73bc29b

Pick-to: 6.2 6.3 6.4
Change-Id: I02000f86ff030ad369ccef1d4488ad22558eb974
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-10-23 00:14:15 +02:00
Peter Varga
600752aa97 Set alphaBufferSize to -1 when disabling translucency in QtWidgets
-1 is the default value for QSurfaceFormat::alphaBufferSize. Changing it
to 0 may result an unexpected pixel format change by ARB OpenGL
extension.

Pick-to: 6.4
Fixes: QTBUG-107629
Change-Id: Ia6a1b90fba6c43b6872b406f4fd946d937135cf8
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-10-21 19:11:51 +02:00
Mikolaj Boc
2c8cf8eb42 Fix the workaround in ~QWasmOpenGLContext
The workaround stopped working because JSEvents is now not a global
object. Update the workaround by exporting the JSEvents object from
emscripten runtime and replacing the function that removes the
event handlers to a dummy function that does nothing temporarily, only
to revert it when the context is destroyed.

Fixes: QTBUG-107197
Pick-to: 6.4
Change-Id: Icceae884c85e04fdafcca6cf3c563094d3f6f0dc
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-10-21 18:02:34 +02:00
Maxime Roussin-Bélanger
3f8e3c3335 dbus: use same type of matching quotes
There is no reason to use different style of quotes when printing
messages.

Change-Id: I7d513ec04c803702974054569d28f26947942fbf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-21 12:02:34 -04:00
Assam Boudjelthia
89f89cedc0 Android: fix Android assets handler not listing dirs with only sub dirs
Amends edd983071e.

Remove redundant calls to AAssetDir_getNextFileName() in
AndroidAbstractFileEngine::setFileName(). It's enough to check
if AAssetManager_open() returns null and AAssetManager_openDir() is
valid for the provided asset file name.

As part of this fix, add some unit tests to cover/ensure assets
listing/iterating works as expected.

Fixes: QTBUG-107627
Pick-to: 6.4 6.2 5.15
Change-Id: I37ae9cb64fbbc60699bb748895f77fd6a34fae1f
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-10-21 16:54:29 +03:00
Liang Qi
63cfab628a tests: skip tst_QGraphicsProxyWidget::bypassGraphicsProxyWidget() on Wayland
QWindow::requestActivate() is not supported.

This function crashed very often in ci/coin when system is busy.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I82523080db40bddce9c9dc000433117d8ef74847
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-21 13:58:19 +02:00
Liang Qi
d8c078c2b6 tests: skip tst_QGraphicsProxyWidget::scrollUpdate() on Wayland
QWindow::requestActivate() is not supported.

This function failed in test vm in coin manually very often.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I013651b0e5e7618c29742effd85a091ca95a7414
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-21 13:58:19 +02:00
Luca Di Sera
e2fef733be Replace usages of Q_CLANG_QDOC with Q_QDOC
To allow the user to customize the C++ code that QDoc sees, so as to be
able to work-around some limitations on QDoc itself, QDoc defines two
symbols: Q_QDOC and Q_CLANG_QDOC, both of which are "true" during an
entire execution of QDoc.

At a certain point in time, QDoc allowed the user the choice between a
custom C++ parser and a Clang based one.

The Q_QDOC symbol would always be defined while the Q_CLANG_QDOC symbol
would be defined only when the Clang based parser was chosen.

In more recent times, QDoc always uses a Clang based parser, such that
both Q_CLANG_QDOC and Q_QDOC are always defined, making them equivalent.

To avoid using different symbols, and the possible confusion and
fragmentation that derives from it, all usages of Q_CLANG_QDOC are now
replaced by the equivalent usages of Q_QDOC.

Change-Id: I5810abb9ad1016a4c5bbea99acd03381b8514b3f
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-10-21 09:48:36 +02:00
Yuhang Zhao
738e05a55a QWinRegistryKey: fix assert when querying default value
I wrongly assumed we can't query a value with an empty name ""
during the previous refactor commit, however, in Windows registry,
an empty name for a value means the default value of a key, we can
read and write it through the "Default" name.
Remove the wrong assert to fix the crash when we are trying to query
a default value of a key.

Add a new test case to test this kind of scenarios.

Amends commit 40523b68c1

Fixes: QTBUG-107794
Change-Id: Idacbcb86df4435a8c1ca1c19121599390ae8f3d3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-10-21 11:51:31 +08:00
Thiago Macieira
77eef32917 QLibrary: fix loading multiple versions of a library
The libraryMap only stored the file path, so we couldn't load two
versions of the same library as we'd find the other version already
loaded. Change the map to index by file name and version (using a NUL as
separator, since that can't appear in file names).

[ChangeLog][QtCore][QLibrary] Fixed a bug that caused QLibrary to be
unable to load two different versions of a library of a given name at the
same time. Note that this is often inadviseable and loading the second
library may cause a crash.

Pick-to: 6.4
Change-Id: I12a088d1ae424825abd3fffd171ce3bb0590978d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-20 15:38:47 -07:00
Assam Boudjelthia
3731e04668 Android: skip tessellation(Vulkan)
Fails on CI's Android 12 emulator.

Amends c681c7c23f.

Change-Id: Icb0c39a9d0b7952aea76b7b0c45fbfc7f2b0556f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-10-20 20:52:47 +00:00
Mikolaj Boc
fffea48ea5 Fix typo in QWasmWindowStack's name
'Wasm' in it is duplicated.

Change-Id: Ie00e02fb7ae4d9e13f490ce2d46a4eabf3f5710c
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-10-20 16:36:23 +02:00
Mårten Nordheim
9efb27e40c tst_QTcpServer: Unblacklist addressReusable
According to the grafana dashboard it has not failed in the
past week.

Reverts ad736e9150

Pick-to: 6.4 6.2
Change-Id: I3eac3c7fd667cfe2cf951b2808dddbfed8eae087
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-20 07:47:36 +00:00
Fabian Kosmale
7502e57ca8 Apply Q_FLAG to flag type instead of enum type
Change-Id: I05cebef521a532654ae8fa306eed9c8db5a0db69
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-19 13:54:07 +02:00
Thiago Macieira
823b7c7bce QLibrary: fix load() after a failed load()
Regression introduced by commit 8d4eb292b2
in 6.0, when QTaggedPointer was introduced. We set the tag even when the
loading failed and failed to reset it because d = {} retains the tag.

Pick-to: 6.2 6.4
Fixes: QTBUG-103387
Change-Id: Ie4bb662dcb274440ab8bfffd170a07aa9c9ecfca
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-18 17:10:42 -07:00
Thiago Macieira
636dbe6045 tst_QLibrary: add a cleanup() method to unload left-overs
QLibrary intentionally does not unload on destruction, so failing tests
may leave libraries already loaded and cause further tests to fail
because of that. So add a cleanup() method to unload everything we may
have loaded.

Note that QLibrary::unload() sets its state to NotLoaded after one
successful call, so we must recreate the object in case it had been
load()ed multiple times.

Pick-to: 6.2 6.4
Change-Id: I12a088d1ae424825abd3fffd171d133c678f910a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-19 00:10:42 +00:00
Thiago Macieira
d9280bb63b tst_QSet: fix flakiness after we removed the fixed, non-zero seed
The "qhash" test relied on the fact that those four elements would
produce a different order with a zero and a non-zero seed. But since
commit b057e32dc4 removed the setting of a
deterministic non-zero seed, this test had a 1 in 4! chance of failing.
Since 4! = 24, 128 retries should be more than enough to ensure we do
find at least hash seed that provokes a different order.

Fixes: QTBUG-107725
Change-Id: I3c79b7e08fa346988dfefffd171ee61b79ca5489
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-18 14:15:51 +00:00
Mårten Nordheim
30077d462d tst_QSql*/sqlite: Don't use random output in the datatags
It makes it impossible to rerun it, bad for both CI and local test runs.

As a drive-by name the database file sqlite.db instead of foo.db

Pick-to: 6.2 6.4
Fixes: QTBUG-100245
Change-Id: I2e4ee01189ccbad2a6add5db7771d35fd7248da8
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
2022-10-18 16:15:50 +02:00
Edward Welbourne
01b1155ac6 Anticipate various warnings in tst_QVariant
Various places were knowingly provoking warnings without telling QTest
to check for and suppress those warnings. Some others did check for
this warning, so let's consistently suppress the noise.

Change-Id: I71b9829680c7a513f4d8fbb3c57442875a6c2dc4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-18 14:13:28 +02:00
Edward Welbourne
b9b516f42e Ignore the warning for all types in tst_QCborValue's mapFromArray*()
For some reason the QTest::ignoreMessage() was conditioned on the type
being tested being Array; however, the warning is in fact produced for
all types. So anticipate it for all and make the test log less noisy.

Change-Id: I78681624252ff8a71f080204f8b031609ddac468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-18 14:13:28 +02:00
Edward Welbourne
d1bf556e24 tst_QChar::fromUcs4(): deduplicate a test-case
There were two copies of the 0x1D157 row and we can't remember why.
So change one of them to the Chakma digit 3 (a spiral) and annote all
three test-cses with what meaning Unicode assigns to them.

Change-Id: I95837588bd5944f7f2c39c8438d9076e844e4dd0
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-18 14:13:28 +02:00
Edward Welbourne
95230ffd81 tst_QLocalSocket::listen(): distinguish two data tags
Two test-cases had the same name; distinguish them by the part of
their data in which they differ - one closes, the other doesn't.

Change-Id: I37051baf194bf8df742688739ad01e3335e64dc7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-18 14:13:28 +02:00
Edward Welbourne
e7913006f1 tst_QDoubleValidator::setRangeOverloads(): rename a data row
Two rows shared the same name. They claimed the value used was out of
range, but actually that was only true for one of them. The other was
in range, but the test reduced the number of digits allowed after the
decimal point, thereby making it invalid, so rename that one to
reflect this.

Change-Id: I0936ea25ec799c0069cd148b9f9bae5d35906093
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-18 14:13:28 +02:00
Edward Welbourne
09e86cfbef tst_QFont::serialize(): distinguish two letterspacing data tags
Include the spacings used, to avoid a naming collision.

Change-Id: Iaf78f7142f6780dcf4c7a0b973db9f625af06767
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
b65a7d80be tst_QPainter::blendARGBonRGB(): rename some data rows
Avoid duplication by distinguishing similar test-cases.

Change-Id: I1a100d6c9729f0ea356f177535d15c3d36e2da9e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
bed8663a0b tst_QPainterPath::testNaNandInfinites(): anticipate the warnings
The test used to trigger a lot of QWARN messages; these are clearly
intended, so tell QTest to expect them, so that we get an error here
if those warnings ever don't show up.

Incidentally tidy up a comment and convert a != verify to a
QCOMPARE_NE(), since it's now available to do that job.

Change-Id: I83e225c37abe8446dac06ebe4e75258cb87b71b0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
4af55438d0 tst_QPainterPath::testArcMoveTo(): include index in some data tags
In the process, clean up the building of the data tags: use a
range-for loop, albeit we do need an index to show in tags; show it
and the angle in the tags using addRow()'s easier formatting. Change
the low angle tests to show the sign of the angle (which is how they
differ)rather than just labeling them 1 and 2.

Change-Id: Ib5aaa3e22d771c530c9343ba368b0fdfceb264ce
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-10-18 14:13:27 +02:00
Edward Welbourne
119801f70d tst_QPainterPath::contains_QRectF(): rename some data rows
The last three duplicated earlier ones; and their names didn't take
into account the circle that had been added to the path since those
tests. So revise their names to reflect that.

Change-Id: I32d74f21947b4ba0c04eee53daf8efde6b4a6409
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-10-18 14:13:27 +02:00
Edward Welbourne
d52abad85d tst_QImage::reinterpretAsFormat(): deduplicate a data tag
Two rows shared a data tag. Prefixed one of them with the color of the
half-transparent image it involves (the other's is fully transparent).

Change-Id: I1bd174008ed29bcf2f460e683fdf6d1f12ba19d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
e6fb0e0779 tst_QImage::mirrored(): deduplicate some data row names
Change-Id: Ia10c72c450eed12d29c9608c6a6270dd4dc4ef7c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
c13df5b6ea tst_QImageReader::preserveTexts(): deduplicate data tags
The same data tags were used with two distinct filenames in their
data. Include the basename of each filename in the data tag, to avoid
duplication.

Change-Id: I216fecbd413fab409227ad6f93f8ac3fcc74b059
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
af0c910912 tst_QKeySequence::parseString_data(): drop duplicated rows
The "a" and "A" rows appeared under Valid, then again under Only Keys.
The two copies were identical, in each case, so drop the latter.

Change-Id: Ib3d84710e772171bb4a5e0aefd20022810fb41cd
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-10-18 14:13:27 +02:00
Edward Welbourne
ab27c1e2d5 tst_QDBusTypes::isValidFixedType: don't duplicate fixed types
tst_QDBusType::isValidFixedType_data() called addFixedTypes() and then
addBasicTypes(); but the latter calls addFixedTypes(), too; so those
rows got duplicated. Only add the fixed types once.

Change-Id: If0d6f44ec7defb12117dad251878850ca75beb48
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-18 14:13:27 +02:00
Edward Welbourne
c74cf23124 tst_QRect::containsPointF_data(): remove duplicate data row
The row 27 that was positioned before row 01, as if it were meant to
be numbered row 00, was identical to the row 27 that appeared after
row 26. Since row 26 was the other case dealing with the null
QRectF(), I kept the one after it instead of renumbering row 00 and
deleting row 27.

Change-Id: I3585839184233f1f1629280ac9e5b25110c155c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-18 14:13:27 +02:00
Edward Welbourne
c10132888e tst_QCryptographicHash: avoid duplicate data tags
Use key(i) rather than valueToKey(value) as the Sha3_* alias Kekkak_*
or RealSha3_*. This way, we still test all members of the enum,
without duplicating row keys (albeit the aliases duplicate values).

Change-Id: I6acba5ffdf5b68294031d609a76b37ca8fad9d94
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-18 14:13:26 +02:00
Edward Welbourne
0448d57c07 tst_QBitArray: remove duplicate data rows
Both countBits() and datastream() had two copies of an all-zeros test
with 35 zeros. Removed the second, in each case.

Change-Id: I5dec4765236ae870c30828dae0f04b8902a100f0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-18 14:13:26 +02:00
Yuhang Zhao
ade68c9949 MSVC: Disable buggy conformance check
/Zc:lambda seems buggy. Although in my experiments it works well
for 99% Qt repos, it seems some tests will trigger the bug and it
also blocks some new commits. So disable it for now, it's not stable
enough.

Now that this check is disabled, the workaround for tst_qstringapisymmetry
is also not needed anymore, so remove the workaround as well.

Partially reverts commit 8cb832090a

Change-Id: Icf0ecbbaa6262522470e5f5dea05705985ab18f1
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-18 19:31:25 +08:00
Axel Spoerl
b1054d45e9 Fix flakiness in tst_QDoubleSpinBox / editingFinished
setFocus() was called on a double spinbox without calling show()
first. That causes flakiness on XCB when checking focus afterwards.
The test can still fail, when focus is acquired by e.g. a system
popup.

This patch adds a show() call before setFocus() to stabilize normal
behavior. In case the double spin box is shown, but cannot acquire
focus, the test is skipped.

Fixes: QTBUG-70088
Change-Id: If02e88800a31b09a1da63dcc074eb8bb1b0df391
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
2022-10-18 11:31:25 +00:00
Marc Mutz
2fd990b386 Port qCompress() to zstream/deflate()
The zlib convenience API we've been using so far has two problems:

- On Windows-64, where sizeof(long) == 4, the use of ulong for sizes
  meant that we could not compress data compressable on other 64-bit
  platforms (Unix). While zstream also uses ulong, being a stream API,
  it allows feeding data in chunks. The total_in and total_out members
  are only required for gzip compression and are otherwise just
  informational. They're unsigned, so their overflow does not cause
  UB. In summary, using zstream + deflate() allows us to compress more
  than 4GiB of data even on Windows-64.

- On all platforms, we always allocated the output buffer in such a
  way as to accommodate the pathological case of random, incompressible
  data, so the output buffer was larger than the input. Using zstream
  + deflate(), we can start with a smaller buffer, then let zlib pick
  up where it left off when it ran out of output buffer space, saving
  memory in the common case that compression meaningfully reduces the
  size. To avoid the first few rounds of reallocations, we continue to
  use zlib's compressBound() for input less than 256KiB.

This completely fixes the compression side of QTBUG-106542 and
QTBUG-104972.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-104972
Fixes: QTBUG-106542
Change-Id: Ia7e6c38403906b35462480fd611b482f05a5c59c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-10-17 23:33:41 +02:00
Marc Mutz
f5205bd6a4 tst_Q{BitArray,ContiguousCache}: check not only count(), but size(), too
Add at least a few, so size() isn't completely untested.

Pick-to: 6.4 6.2 5.15
Change-Id: I500d28f7efb30ab578808d8fefb6ea57949edc2e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-10-17 19:33:34 +02:00
Edward Welbourne
0d915623ec tst_QAlgorithms: fix misleading indent in data table
A violation of coding style (requiring braces on multi-line bodies
of conditionals) was accompanied by a mis-indented else block.
Fix a long line while I'm about it.

Change-Id: Ibe9cf15eadbe9ef58138d7876e5e2c5a14a92fd4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
ce950bcbf7 Clean up tst_QAlgorithms::count{Trail,Lead}ing_data_impl()
Pull out the arbitrary factor of three as a named constant and
document its arbitrariness once.

Pull out the mask and bit used in each function's loop to the outer
layer of the loop, since they don't depend on the inner loop variable
(or the random value generated in that loop).

Use QTest::addRow() instead of constructing a string to pass to
newRow().

Change-Id: Ifacbcb390e00828fd47f51b0c73d0ad5f6bc8bdb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
2ffc36c24a tst_QTime: fix two duplicated test data tags
Names for data rows should be distinct.

Change-Id: I2ee1c4f362222d448278a90fc0a1cc9731e30976
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
565a827170 tst_QDateTime: eliminate some duplicate test-cases
Change-Id: I588494f2a79340599cafc48b3f4f4a79e6ca0a19
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
f6e9279ead tst_QAtomicInt:fetchAndAdd(): remove two duplicate data rows
Change-Id: I6568399945f421a18ddb5c52c68f82474de936c5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-17 15:53:32 +02:00
Edward Welbourne
8bb0d2308e tst_QStringApiSymmetry: use startpos to deduplicate indexing data tags
The tests for indexOf() and lastIndexOf() had duplicate data row tags,
due to only using the needle and haystack, although some tests
differed only in start position. Include start position where needed.

Change-Id: I197d415265ab1a805f2d36fb88aec92ea8646f7a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
5b70546c17 tst_QStringApiSymmetry: avoid repetition in trimmed_data()
Enclosing one string in each substring of another does not need to
repeat the empty substring of the latter. Extracting the empty
substring from different positions doesn't get different results.
In the process, tidy up the code a bit.

Change-Id: Ic66febbdadeaac0c466f4f1174d831a991d31e20
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-17 15:53:32 +02:00
Edward Welbourne
781bd075a6 tst_QStringApiSymmetry: eliminate one duplicate of a mid_data() row
There were two copies of the same line in mid_data(), leading to
duplicated data row tags.

Change-Id: Ia21e855ff781b13fe18c932cff48cb0aabd12750
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 15:53:32 +02:00
Marc Mutz
3d6f5e95f0 Update Catch2 to v2.13.10
Two patches applied to upstream release.

Pick-to: 6.4 6.2
Fixes: QTBUG-103321
Task-number: QTBUG-99122
Change-Id: Ief451a21e5f61851cb03a9ca94ffe0f864e4b1f8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-17 14:07:43 +02:00
Marc Mutz
bda3628402 Port qUncompress() to zstream/inflate()
The zlib convenience API we've been using so far has two problems:

- On Windows-64, where sizeof(long) == 4, the use of ulong for sizes
  meant that we could not uncompress data compressed on other 64-bit
  platforms (Unix). While zstream also uses ulong, being a stream API,
  it allows feeding data in chunks. The total_in and total_out members
  are only required for gzip compression and are otherwise just
  informational. They're unsigned, so their overflow does not cause
  UB. In summary, using zstream + inflate() allows us to decompress
  more than 4GiB of data even on Windows-64.

- On all platforms, if the size hint in the header was too short, we'd
  double the output buffer size and try again, from scratch. Using
  zstream + inflate(), we still need to reallocate, but we can then
  let zlib pick up where it left off when it ran out of output buffer
  space. In all but the most pathological cases, copying the
  already-decoded data instead of re-decoding it again should be
  faster, esp. if QArrayData uses realloc() instead of malloc() +
  free() to grow the buffer.

We also now directly allocate at least as much output buffer as we
have input, to cut the first few rounds of reallocations when the
expectedSize was created, as qCompress still does, using modulo
arithmetic mod 4GiB instead of saturation arithmethic.

Factor the growing of the output buffer into a wrapper function,
flate(), which can be reused when porting qCompress().

This completely fixes the uncompression side of QTBUG-106542 and
QTBUG-104972.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104972
Task-number: QTBUG-106542
Change-Id: I97f55ea322c24db1ac48b31c16855bc91708e7e2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-16 23:01:36 +02:00
Shawn Rutledge
0f94430a0f testlib: make it possible to test double-clicks with discrete events
The timestamp will no longer be incremented by 500ms after a mouse
release if the delay has been explicitly specified.

The default delay is 1 ms since f5010c49a3
but the running timestamp was unconditionally post-incremented by 500ms
after every mouse release, to prevent double-clicks, which were always
deemed as unintended (because we have a mouseDClick function for that).
Now, we do that 500ms increment only if the user has not provided a
delay value in the function argument at all. We have often found it
useful in our own tests to generate double-clicks "the hard way", by
sending indivdual events, so as to be able to check state in some target
object at each step, as shown in the new snippet.

[ChangeLog][QtTest] QTest::mouseRelease() and mouseClick() can now be
used to test double-clicks, by specifying a realistic timestamp delay.

Fixes: QTBUG-102441
Change-Id: I8e8d242061f79efb4c6e02638645e03661a9cd92
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-16 08:36:03 +02:00
Christian Ehrlicher
5caf808750 SQL/tests: fix tst_qsqlquery
Fix two tests which got broken due to the latest changes without
notifying because those tests are not run automatically.

Change-Id: Ibe9d9601f0a2ad4ce8f06ca21e7503e77fa55781
Reviewed-by: Fredrik Ålund <fredrik.alund@mimer.com>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-16 06:05:34 +02:00
Marc Mutz
fc76767692 Long live Q_UNREACHABLE_RETURN()!
This is a combination of Q_UNREACHABLE() with a return statement.

ATM, the return statement is unconditionally included. If we notice
that some compilers warn about return after __builtin_unreachable(),
then we can map Q_UNREACHABLE_RETURN(...) to Q_UNREACHABLE() without
having to touch all the code that uses explicit Q_UNREACHABLE() +
return.

The fact that Boost has BOOST_UNREACHABLE_RETURN() indicates that
there are compilers that complain about a lack of return after
Q_UNREACHABLE (we know that MSVC, ICC, and GHS are among them), as
well as compilers that complained about a return being present
(Coverity). Take this opportunity to properly adapt to Coverity, by
leaving out the return statement on this compiler.

Apply the macro around the code base, using a clang-tidy transformer
rule:

    const std::string unr = "unr", val = "val", ret = "ret";
    auto makeUnreachableReturn = cat("Q_UNREACHABLE_RETURN(",
                                    ifBound(val, cat(node(val)), cat("")),
                                    ")");
    auto ignoringSwitchCases = [](auto stmt) {
        return anyOf(stmt, switchCase(subStmt(stmt)));
    };

    makeRule(
       stmt(ignoringSwitchCases(stmt(isExpandedFromMacro("Q_UNREACHABLE")).bind(unr)),
            nextStmt(returnStmt(optionally(hasReturnValue(expr().bind(val)))).bind(ret))),
       {changeTo(node(unr), cat(makeUnreachableReturn,
                                ";")),  // TODO: why is the ; lost w/o this?
        changeTo(node(ret), cat(""))},
       cat("use ", makeUnreachableReturn))
    );

where nextStmt() is copied from some upstream clang-tidy check's
private implementation and subStmt() is a private matcher that gives
access to SwitchCase's SubStmt.

A.k.a. qt-use-unreachable-return.

There were some false positives, suppressed them with NOLINTNEXTLINE.

They're not really false positiives, it's just that Clang sees the
world in one way and if conditonal compilation (#if) differs for other
compilers, Clang doesn't know better. This is an artifact of matching
two consecutive statements.

I haven't figured out how to remove the empty line left by the
deletion of the return statement, if it, indeed, was on a separate
line, so post-processed the patch to remove all the lines matching
^\+ *$ from the diff:

  git commit -am meep
  git reset --hard HEAD^
  git diff HEAD..HEAD@{1} | sed '/^\+ *$/d' | recountdiff - | patch -p1

[ChangeLog][QtCore][QtAssert] Added Q_UNREACHABLE_RETURN() macro.

Change-Id: I9782939f16091c964f25b7826e1c0dbd13a71305
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-15 22:11:47 +02:00
Yuhang Zhao
8cb832090a MSVC: Enable all possible conformance checks
For the full list, please refer to [1].

Needed to change the qstringapisymmetry unit test:
In theory we don't need the array to be static and it did compile
without any problems so far, indeed. However, with this patch applied,
MSVC complains that the lambda function below can't access the array.
I don't understand why, because we use [&] in the lambda and it should
capture all the variables in theory, but in reality it failed to
capture this variable in the end. And making the variable static
solves this issue. Maybe it's a MSVC bug.

Already tested locally. Most Qt repos build without any issues,
only very few repos are not tested, as my local environment
can't build them.

[1] https://docs.microsoft.com/en-us/cpp/build/reference/zc-conformance?view=msvc-170

Change-Id: I658427aa171ee1ae26610d0c68640b2f50789f15
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-10-15 13:34:20 +00:00
Joerg Bornemann
5430fb2243 CMake: Set RPATH of deployed plugins on Linux
When deploying into some directory structure where CMAKE_INSTALL_LIBDIR
is different from Qt's lib dir, we need to set the RPATH of installed
plugins such that Qt libraries are found.

We do this using CMake's undocumented file(RPATH_SET) command and pray
that this command is safe to use across current and future CMake
versions.  For CMake versions < 3.21, we use patchelf, which must be
installed on the host system.

The adjustment of rpaths can be turned on explicitly by setting
QT_DEPLOY_FORCE_ADJUST_RPATHS to ON.

The usage of patchelf can be forced by setting QT_DEPLOY_USE_PATCHELF to
ON regardless of the CMake version.

Change-Id: I62ced496b4c12bf6d46735d2af7ff35130148acb
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-15 13:00:04 +02:00
Joerg Bornemann
5ca714318c Don't set QT_PLUGIN_PATH in the deployment test's run environment
Otherwise we don't properly test whether the deployed executable can run
without adjusting the environment.

We temporarily adjust the test_widgets_app_deployment test and set
CMAKE_INSTALL_LIBDIR to make the test pass.  It would now fail on Linux
distros where CMAKE_INSTALL_LIBDIR defaults to "lib64" but Qt is built
with lib dir "lib".  The next commit removes this hack.

Change-Id: I63c79ef1ee23ffaeed881337fde6e9d889ecc0fe
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-10-15 12:59:59 +02:00
Thiago Macieira
c849c48d19 Autotest/Unix: request zero-sized core dumps for crashing code
Unix systems have got crash loggers in the past 15-20 years, notably
macOS and Linux (abrtd, systemd-coredumpd, etc.). By setting the core
dump limit to zero, those tools should be mostly inhibited from running
and thus not interfere with the parent process' timeouts. Even for
systems without core dump loggers, disabling the writing of a core dump
to the filesystem should also help.

Pick-to: 6.4
Change-Id: I12a088d1ae424825abd3fffd171d112d0671effe
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-14 08:18:53 -07:00
Liang Qi
673f89d62c tests: skip tst_QWidget::touchEventSynthesizedMouseEvent() on Wayland
Task-number: QTBUG-107157
Pick-to: 6.4 6.2
Change-Id: I88df3215aceb7a619b4c1fbc2f457400a1bc7025
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
bdd2b68696 tests: skip tst_selftests on Wayland and XWayland
QWindow::requestActivate() is not supported.

We have one tst_selftests binary, and will test it with both xcb and
wayland qpa plugin. A runtime check and skip will have different
restult files, which is not implemented in testlib yet.

Task-number: QTBUG-107578
Pick-to: 6.4 6.2
Change-Id: Idc8cb24c6f42a9f0f4dc9493e3fd1a5803ba7ce0
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
f2aa04722a tests: skip tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107158
Pick-to: 6.4 6.2
Change-Id: I047337d736ff10693d98075e2636028225162765
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
f990c256eb tests: skip tst_QCompleter::showPopupInGraphicsView() on Wayland
Task-number: QTBUG-107186
Pick-to: 6.4 6.2
Change-Id: I1f67c0b7c70dec210989073660db6b03afb98fff
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
ca3c72b27a tests: skip tst_QWidget_window::mouseMoveWithPopup() on Wayland
Task-number: QTBUG-107154
Pick-to: 6.4 6.2
Change-Id: I94149e8ffdb834b44c605cfd9bdea7e9f458dc90
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
a16fd6bbe2 tests: skip tst_QWidget::setWindowGeometry() on Wayland
Task-number: QTBUG-107157
Pick-to: 6.4 6.2
Change-Id: I65a21898d6a5d40a4e7e9eeecf1e2398e45d97fe
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
7f27189d90 tests: skip tst_QGridLayout::setMinAndMaxSize() on Wayland
Task-number: QTBUG-107184
Pick-to: 6.4 6.2
Change-Id: Iddc280acd18e230d1ae778ccb6d7d17a8ff3d76c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:53 +02:00
Liang Qi
3846b27dd8 tests: skip tst_QWidget_window::resetFocusObjectOnDestruction() on Wayland
QWindow::requestActivate() is not supported.

Fixes: QTBUG-107155
Pick-to: 6.4 6.2
Change-Id: I3a3ce04695ce5039229ce51d80948c62456f5944
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:52 +02:00
Liang Qi
ca8554d338 tests: tst_QWidget::renderChildFillsBackground() passes on Wayland
This amends 1453f048f5.

Task-number: QTBUG-107157
Pick-to: 6.4
Change-Id: I606dd2013e11a4f7639fea59d75091191fd30d87
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:52 +02:00
Liang Qi
89b54bb4ec tests: skip a few tests in tst_QWidget on Wayland
QWindow::requestActivate() is not supported.

* tst_QWidget::dumpObjectTree()
* tst_QWidget::enterLeaveOnWindowShowHide()
* tst_QWidget::imEnabledNotImplemented()
* tst_QWidget::activateWhileModalHidden()

Task-number: QTBUG-107157
Pick-to: 6.4 6.2
Change-Id: Ic8e0eeff05cfc4e6dc16fc570caf80a1dcc57800
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:52 +02:00
Liang Qi
584aa8ad41 tests: skip tst_QWidget::renderInvisible() on Wayland
Task-number: QTBUG-107157
Pick-to: 6.4 6.2
Change-Id: I405a5dfc915b754e30389208cc0bdb01f17ed166
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-14 17:18:52 +02:00
Volker Hilsheimer
9eca8d62fa Fix memory leak and clean up splitter test
Allocate the QSplitter on the stack so that it and its child widgets are
cleaned up when the test function finishes.

As a drive-by, replace QString usage with QByteArray to avoid unneeded
conversion from and to latin1, and modernize list construction and for loop.

Pick-to: 6.4 6.2
Change-Id: I2e29961edbab1ec88be356fca6bc100f08894e82
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-14 16:34:47 +02:00
Volker Hilsheimer
cdadd1bdb3 Allow programmatic closing of windows that are modally blocked
In Qt 6, after changes such as 121fddcf5a,
we go through the QPA layer to close widget windows properly. Closing
and hiding of windows is now done in when we receive and handle the
window system's CloseEvent.

Such an event to a modally blocked window should be blocked, so that
users can't close a modally blocked window. However, if the event is the
result of a call to QWindow::close, then it should not be blocked.
Luckily, we know that the event is the result of such a call, so let
such events through. This restores compatibility with Qt 5, where it was
possible to first open a new dialog, and then close the previous dialog.

Add a test case.

Fixes: QTBUG-107188
Pick-to: 6.4 6.2
Change-Id: Id812c1fc36aa0e1a10dfb8d3a16a11d387289b05
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-10-12 01:53:42 +02:00
Marc Mutz
aa37e67ef7 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.

Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 23:17:18 +02:00
Thiago Macieira
a94731c2ad tst_QTcpServer: use a random port number in addressReusable
Just in case the same test is being run in parallel. We do that by
creating a listening TCP server in the test process. This test is
supposed to test the address reusability, so a clean close on a server
that never accepted a connection should not cause reusability issues.

Change-Id: I12a088d1ae424825abd3fffd171ccfb9fc5c09ee
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 09:36:11 -07:00
Thiago Macieira
742584b0f2 tst_QTcpServer: Output useful more useful info for addressReusable
To try to figure out why QProcess::waitForReadyRead is returning false
so quickly. Though we know it's going to be "Address in use".

FAIL  : tst_QTcpServer::addressReusable(WithoutProxy) 'process.waitForReadyRead(5000)' returned FALSE. (Failed to listen: The bound address is already in use
Netid State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
tcp   LISTEN 0      50         127.0.0.1:49199      0.0.0.0:*    users:(("crashingServer",pid=40529,fd=4))
)

Pick-to: 6.4 6.2
Change-Id: Ic43a460bfc7c7eb6379405b7a1a064e502b6fef3
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 09:36:11 -07:00
Ievgenii Meshcheriakov
c4e550703c Update UCD to Revision 30
This corresponds to Unicode version 15.0.0.

Added the following scripts:

    * Kawi
    * Nag Mundari

Full support of these scripts requires harfbuzz version 5.2.0,
this version adds support for Unicode 15.0:

    https://github.com/harfbuzz/harfbuzz/releases/tag/5.2.0

Fixes: QTBUG-106810
Change-Id: Ib06c526e49b0f01ef9f21123bcf875c6b19f2601
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-10-11 14:10:59 +00:00
Edward Welbourne
35ff456407 tst_QString::compare(): rename a test tag to be unique
There were two data8 rows; and no data9, so that was easy to fix.

Change-Id: I8191de142e1a3be57bf1ad97e63d5780f2859fea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:24:51 +02:00
Edward Welbourne
3af2747c46 tst_QString::number_base(): distinguish negative binary test-cases
Two test cases were called "base  2, negative"; one of them use -1 as
value, so s/negative/minus 1/ for it.

Change-Id: Ia5da3952d93976262cc8423d4e75ec19dab9a088
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:24:39 +02:00
Edward Welbourne
167da771f6 tst_QRE::wildcard(): use more informative data row tags
Using simply the pattern didn't work so well when some patters are
used repeatedly, on different haystacks. So include the haystack
in the tag name. Remove one straight up duplicate row.

Change-Id: Ib46364581f23c493e83d75e6d04ab09e4329a3a5
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
2022-10-11 11:24:11 +02:00
Edward Welbourne
042702d961 tst_QBAApiSymmetry::toInt_data(): deduplicate a data-row name
One "empty" test was base ten, the other left the code to work out the
base. Change the latter's name to reflect that difference.

Change-Id: I4918eb0d293420df315d86e532787950b8f05be8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:24:01 +02:00
Edward Welbourne
cc204f96c9 tst_QCborValue: remove duplicate data row from tests
The addCommonCborData() helper had two identical rows named simple255.
It only needs one.

Change-Id: Ie934c31f373069788c3ef774fde8956b54814e67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:50 +02:00
Edward Welbourne
2192d6a62e tst_QPlugin::scanInvalidPlugin(): de-duplicate a data-tag
Change-Id: Ibc25041b5e003cf21d781012f279e9bdd75a2ee9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:40 +02:00
Edward Welbourne
97470a7838 tst_QUuid::fromString(): tweak a test to avoid data-tag collision
Two of the uuidA test cases had an open-brace for the string and no
close; one of them ended with a space (which, apparently, is valid).
Since the data-tag was constructed by formatting the string in a
fixed-width field, padding with spaces, these two cases coincided.

Fortunately the only uuidB test-case had closing as well as opening
braces, so we can just switch the test for "trailing space is not an
error" to use it, instead.

Change-Id: I7068d40145c6b6b3b72777b029282850b1d1ea81
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mate Barany <mate.barany@qt.io>
2022-10-11 11:23:15 +02:00
Edward Welbourne
439066ea84 tst_QResourceEngine::checkStructure(): fix name of some data rows
The first "test1 text" test-case related to a file called test1.txt;
but the second related to a file called test2.txt; I suspect a
copy-and-paste with incomplete post-edit. In any case, change the
latter's data tag to reflect the difference.

Change-Id: I8354a3d1bd18715d6717dfd0962aa70faefbee90
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:23:04 +02:00
Edward Welbourne
f89d3484b2 tst_QUrl::fromUserInput(): distinguish to data rows by name tag
Change-Id: Ia3d232466ae618c26b95a6c33b094b197a2e4ec8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:53 +02:00
Edward Welbourne
6e4a5211a2 tst_QUrl: distinguish two ipvfuture test-case data tags
Change-Id: I20e318b4c17c35aae5f5440b2fd9c6e0af7c4a70
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:41 +02:00
Edward Welbourne
5455ea7ccd tst_QUrlQuery: remove duplicate of reconstructQuery data row
Change-Id: I7903eca0887c0cbccef9fcadac6e95009703e1c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:31 +02:00
Edward Welbourne
ef8905aa2b tst_QFile: distinguish invalid from valid in mapResource data-tags
The test was using the same tags twice each, giving no clue to the
difference between the two test-cases for each.

Change-Id: I645b01c0c4008a766e505047cb05cc22640ee129
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-10-11 11:22:22 +02:00
Edward Welbourne
50561716f0 Distinguish the repeats of QSystemSemaphor's processes tests
It's not clear why this test repeats each test-case five times, but
give the duplicates distinct names, at least.

Change-Id: I4a098d90c3fe6f61842745c1d5f62047fe13a9b5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-11 11:22:14 +02:00
Edward Welbourne
1f07199a48 Remove duplicate tst_QVariant canConvert:Int data row
There were simply two copies of the same row-adding code.

Change-Id: I12240dedf2649c314ad32984f4de9d6b9bf280d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:22:04 +02:00
Edward Welbourne
691de7f696 Rename some tst_QTextStream::manipulators() data rows
Two rows named "hex" were a collision we should avoid.
The two "showpos" rows could be better distinguished.

Change-Id: I43727041eb00e6883ce8b34b346de5e2a63f1a34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:21:57 +02:00
Edward Welbourne
16732e368a Reflow tst_QTextStream::manipulators_data()
Now I can read it and work out how to rename the duplicated data tag.

Change-Id: I78f2b3f38f955fa6e6a88cb87cfca6e4f755a177
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-10-11 11:21:47 +02:00
Edward Welbourne
11997578ac Provide optTitle for a NumberDoubleTestData testcase that needs it
The test-case for 0.0001 with precision 0 has the same expected text
as that for 0.0 with the same precision; which lead to QBA's test of
it getting a duplicated data tag. Add an optTitle for the one that
isn't precise to deduplicate.

Change-Id: I03600e2af43f6d11b53e05e8027924c92ed4db89
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-11 11:21:38 +02:00
Edward Welbourne
3f43ddbd10 Rename tst_QBA::toFromHex()'s longer no-leading-zero data-row
No two data-rows should have the same name.

Change-Id: I0e222498ca5bb973f703b7e6bd314fc38bb4db4d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:21:30 +02:00
Edward Welbourne
5c4dcd0697 Rename tst_QBA::movablity() to fix the typo
There's an i between b and l, as well as after l.

Change-Id: I9252935687e25f1f11aacb11286edf666ff9af8a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-10-11 11:21:15 +02:00
Edward Welbourne
e61dc8a83b Don't duplicate a column name in tst_QByteArray::movablity_data()
It first added a column, then some rows, then called
prependExtended_data(), which expects to be called first in a data
function and starts by adding the same column. So put that first and
drop the duplicate addition of the column.

Change-Id: Ia5cf86f821608e78f0e4872db2b3167ef81cc59e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-10-11 11:21:06 +02:00
Edward Welbourne
f71daf857c Fix tst_QQuaternion's duplicate test tags
Having the same test tag for two rows of a data table makes the report
less useful. We also intend to forbid doing that.

Change-Id: I67ec32514b6550f4f97610a2140f1383d0d85b23
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-10-11 11:20:58 +02:00
Alexandru Croitor
a6b430337c CMake: Only build ssl tests if the feature was enabled
Pick-to: 6.4
Task-number: QTBUG-107538
Change-Id: If2d473fbf8240b356d226be7bc4058506149a0e6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-10-11 11:13:36 +02:00
Volker Hilsheimer
2ef130a41d JNI: add generic support for array-types
The typeSignature for a type T[] is always "[" + typeSignature<t>, so we
can just implicitly support arrays of any known type. To prevent support
for multi-dimensional arrays, make sure that the underlying type is not
also an array.

By adding a QJniTypes::isArrayType in addition (that is true for any
type with a signature starting with '['), methods like
QJniObject::callMethod could then return a special QJniArray type that
provides array-specific functionality.

As a drive-by, and since all lines need to be touched to add braces,
replace std::is_same<>::value with std::is_same_v.

Change-Id: Iccadf03cfceb8544381a8f635bb54baeddf46c99
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-10-10 20:19:30 +02:00
Mårten Nordheim
ad736e9150 tst_QTcpServer: blacklist addressReusable on macOS
For some reason it has become extremely flaky.
Blacklist to unblock most patches.

Pick-to: 6.4 6.2
Task-number: QTBUG-107500
Change-Id: I11c3ff5e018981be46c20282fa171bce687596b2
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-10 19:22:32 +02:00
Mårten Nordheim
4f17a64f35 tst_QTcpServer: convert QSKIP to blacklist
So we can gather statistics on whether it is still failing

Pick-to: 6.4 6.2
Change-Id: I1f4080f4d96f31ce2b689cda175af3a35563e232
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-10 19:22:32 +02:00
Marc Mutz
dd562b3672 Replace qExchange with std::exchange
None of these users require C++20 constexpr or C++23 noexcept, the
only remaining difference between std::exchange and qExchange.

This leaves a single qExchange() user, in QScopedValueRollback, that
requires the constexpr version, only available from C++20, and thus
remains unported.

Task-number: QTBUG-99313
Change-Id: Iea46f6ed61d6bd8a5b2fd9d9ec4d70c980b443a2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-07 18:11:36 +02:00
Liang Qi
8b143f0aed tests: skip two tests in tst_QDockWidget on Wayland
This amends 9ff40b59da .

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ie66205c5402d4346ffb61619ccb6a955623f5984
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:24 +02:00
Liang Qi
e37baad7fc tests: skip tst_QAction::disableShortcutInMenuAction() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Iacdcf4ad4f6da4a5a996f26d3b97fb507a4b116b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:22 +02:00
Liang Qi
7d38320c4b tests: skip two tests in tst_QAbstractItemView on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I9080fbb0ae0a604ad4a7ffa55ba3243d1cf96be8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:21 +02:00
Liang Qi
1dcd4d7171 tests: skip tst_QGraphicsView::embeddedViewsWithFocus() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ie9583e55d298fe392d8ab09e9a10d8fce5ce3fee
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:18 +02:00
Liang Qi
a247da320c tests: fix window activation usage in tst_QGraphicsWidget
- Skip tests that depend on programmatic window activation on platforms
  where this is not supported, such as Wayland.
- Change tests that don't rely on the window being activated to use
  qWaitForWindowExposed() instead.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Ieb4280343a725a2cbdc46a8ac5c657beeb2e7e57
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:16 +02:00
Liang Qi
19dabbbc73 tests: skip two tests in tst_QGraphicsProxyWidget on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I41c0c24c73ea5add821109172470d37a9b6211a8
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:15 +02:00
Liang Qi
65d9b48a70 tests: skip tst_QDialog::showAsTool() on Wayland
QWindow::requestActivate() is not supported.

Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: Id8f9cc1d6a29b4d608a080f5b40a5369d7bd8da9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:13 +02:00
Liang Qi
f8898cae83 Revert "tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland"
This reverts commit e49d2daf19.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100918
Pick-to: 6.4 6.2
Change-Id: I1415afdeaf1bff26dba3b3100b2aafcda00bcdd9
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:12 +02:00
Liang Qi
dd608329b2 tests: skip tst_QApplication::activateDeactivateEvent() on Wayland
Task-number: QTBUG-107153
Pick-to: 6.4 6.2
Change-Id: I69bd4a0d4217b5e4c2cbee8b25c5bd69509e3329
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-07 13:20:10 +02:00
Liang Qi
5ddb015038 Revert "tests: XFAIL tst_QGuiApplication::genericPluginsAndWindowSystemEvents()"
This reverts commit ae1197fc56.

This doesn't fail on Wayland, perhaps a false alarm.

Fixes: QTBUG-100891
Pick-to: 6.4 6.2
Change-Id: I3e1d2488b090f186c64d63cb6c9f97dfaafc8fff
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-10-07 13:20:08 +02:00
Ievgenii Meshcheriakov
df6ba4bc16 tst_qurluts46: Support \u escapes in the test data
These escapes were documented but not used until the version 15.0.0
of Unicode.

Task-number: QTBUG-106810
Change-Id: If48dcd80acf32989e3f47676ca3d41848a325c0e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-10-06 14:26:25 +02:00
Axel Spoerl
b439f06941 Remove focusProxyAndInputMethods from tst_QWidget
focusProxyAndInputMethods tests focus acquisition and inheritance with
a toplevel widget, acting as a focus proxy for a child.
X11 window managers are set to be bypassed, programmatic focus is set
with QApplicationPrivate::setActiveWindow().

The test is flaky on Linux/XCB, and therefore blacklisted on most
Linuxes.

This patch removes focusProxyAndInputMethods, considering that
- focus proxying is tested in tst_QWidget::focusProxy()
- window activation and focus inheritance are tested in
tst_QWindow::isActive()

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I510fd935399d9ad0b6cd76f1bd5db0811e0702f6
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-10-06 10:49:16 +02:00
Vladimir Belyavsky
4945fd93f1 QTextLayout: fix maximumWidth() for a text containing spaces
When laying out a text and calculating maxWidth, we must _always_ take
into account the accumulated width of spaces (lbh.spaceData.textWidth)
regardless of wrapMode, other text content, spaces position, etc.

Fixes: QTBUG-106947
Change-Id: I2ac9af92ed7dd07c1e040bfcf83949a358d1c9c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-10-06 08:43:11 +00:00
Marc Mutz
df9d882d41 Port from container.count()/length() to size()
This is semantic patch using ClangTidyTransformator:

  auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'.

<classes> are:

    // sequential:
    "QByteArray",
    "QList",
    "QQueue",
    "QStack",
    "QString",
    "QVarLengthArray",
    "QVector",
    // associative:
    "QHash",
    "QMultiHash",
    "QMap",
    "QMultiMap",
    "QSet",
    // Qt has no QMultiSet

Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-10-04 07:40:08 +02:00
Volker Hilsheimer
109e088c7c Make sure that palette cache keys are unique
After 1d961491d8, palettes are different
if they either have different brush data, or a different private. Two
privates can share data, but still must generate different cache keys.
The cacheKey has so far been composted of the serial number of the Data
struct, and a detach number that is incremented when we detach the
private.

This failed for two reasons:

- the implicit copy constructor of the Data class copied the serial
number, when it should have incremented it. Fix that by member-
initializing the serial number rather than doing it only in the default
constructor. The member initialization is also executed for the copy
constructor.

- the detach_no logic as it was implemented does not guarantee that two
copies of the same palette that share data, but have different resolve
masks (and thus different privates) have different detach_no values.
Use a static serial counter for that number as well.

Amend the test case to verfiy that cache keys, and the elements of the
cache keys, change when they are expected to.

Fixes: QTBUG-106984
Pick-to: 6.2 6.4
Change-Id: I84d7055ce8bfe0d42f1f8e9766f3f1ad610f4ec8
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-10-03 23:39:23 +02:00
Timur Pocheptsov
ee85f65b8e tst_qsslcertificate: remove ifery which breaks the test
In the presence of QT_CONFIG(opensslv30).

Fixes: QTBUG-107027
Change-Id: I481db3cdf3bbb1aa7127cc5498f0c0217df8c35b
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-30 09:35:38 +02:00
Eskil Abrahamsen Blomfeldt
1fe7144a07 Introduce QGlyphRun::stringIndexes()
This introduces a way to trace each entry in the glyph index
array to a specific index in the original text passed to
QTextLayout, as well as a convenience function to access
the original string from the QGlyphRun.

The index information is stored in the logClusters array internally
in Qt, but it contains the inverse information: For each
character in the output string, it contains an index into the
glyph array. In order to get the string indexes for each glyph,
which makes a lot more sense in the context of the QGlyphRun
API, we need to do a little search to construct the data.

To avoid adding unnecessary allocations, we make the new APIs
opt-in. If you do not specify anything, you will only get the
glyph indexes and glyph positions as before. However, you
can now specify exactly which parts of the layout to extract
using an optional flags parameter.

This also adds a manual test which can be very handy to
visualize QTextLayouts and how they are split into QGlyphRuns.

Fixes: QTBUG-103932
Change-Id: Ie4288fff338b9482aba0aba29fc7e1e59fa60900
Reviewed-by: Lars Knoll <lars@knoll.priv.no>
2022-09-29 18:06:40 +02:00
Giuseppe D'Angelo
42b66bd809 QTaggedPointer: disable operator= with an empty initializer list
Given a QTaggedPointer, users may write

  taggedPtr = {};

to mean "reset it". This is error-prone: due to overload resolution,
this actually ends up calling QTaggedPointer<T>::operator=(T *),
which changes the pointer but *not* the tag, and not the implicitly
declared QTaggedPointer<T>:operator=(const QTaggedPointer<T> &)
which would reset both pointer and tag.

Given the idiomatic usage of {} is indeed to perform a full reset (cf.
std::exchange(obj, {}), std::take, etc.), work around this by disabling
the operator= overload for pointers in case an initializer list is
passed. In other words, make `={}` fall back to the implicitly
declared overload.

Note, this breaks some usages, such as

  taggedPtr = {rawPtr};

but at least we get a compile error for these, and they don't look
common at all.

[ChangeLog][QtCore][QTaggedPointer] The operator assignment
taking a raw pointer has been reimplemented in order to avoid
subtle issues when assigning `{}` to a QTaggedPointer. This will
cause code that assigns a braced-init-list to a QTaggedPointer object
to stop compiling (for instance, `tagPtr = {ptr}` is now ill-formed).

Change-Id: I5e572a9b0f119ddb2df17f1797934933dff2ba7b
Task-number: QTBUG-106070
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 16:18:55 +02:00
Edward Welbourne
18439a449f Support serializing time-zone fields in date-times more flexibly
[ChangeLog][QtCore][QDateTime] The 't' format character in a
toString() template can now be repeated to get alternatives to the
(unparseable) zone abbreviation. Thus 'tt' now gets the zone offset
without colon, [+-]hhmm; 'ttt' gets the same with colon, [+-]hh:mm,
and 'tttt' gets the zone name. Previously, each 't' was replaced by
another copy of the abbreviation.

Task-number: QTBUG-95966
Change-Id: Iccccd11f06fa732ed27c0e5d4e40a3d4b5f79f8d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:56 +02:00
Edward Welbourne
0bc92c01e3 Support parsing time-zone specifiers more selectively
[ChangeLog][QtCore][QDateTime] The 't' format used in fromString() can
now be repeated to restrict parsing to particular forms. Thus 'tt' now
matches the [+-]hhmm offset format (no colon), 'ttt' the [+-]hh:mm
offset format (with colon), and 'tttt' matches an actual zone
name. When used singly, 't' still matches anything the parser knows
how to interpret as a zone specifier.

[ChangeLog][QtCore][QLocale] The 't' format in toDateTime() now has
repeated forms, as for QDateTime::fromString().

Task-number: QTBUG-95966
Change-Id: I73753145cb66a56bc25a5c2dd5cb051ba982fa2c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-29 14:42:55 +02:00
Eirik Aavitsland
72a3da3d4d Style sheets: add placeholder text color property for edit widgets
The placeholder text was given its own QPalette color role in Qt 5.12,
but there has been no way to specify it from a Qt style sheet.

Fixes: QTBUG-93009
Change-Id: If58ca844c19c65b7eee14c6d5730a4ba27640c33
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-29 08:20:56 +02:00
Thiago Macieira
1e625033be tst_QSharedMemory: remove mention of gravlaks.troll.no
It was our old, HP-UX machine on Itanium (ran on big-endian mode). We
don't support HP-UX any more; HP will still support the 11i v3 release
until 2025, but I doubt anyone wants to run any new software there. One
hopes that HP has long since fixed the issue, but I doubt it since the
last release is from 2007. Gravlaks probably ran HP-UX 11i v3.

There are a couple other left-overs of ".troll.no" in the repository,
the majority of which are URL manipulation in tst_qurl.cpp and in
tst_qnetworkcookie.cpp, then the certificates for fluke.troll.no (valid
until 2035) and aspiriniks.troll.no (expired in 2009, but we don't need
it for validity).

Change-Id: I810d70e579eb4e2c8e45fffd1719122747d7b85a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-28 15:56:45 -07:00
Mårten Nordheim
7fea2d34fb Update tst_bench_qhash hash functions to use size_t
Pre-requisite for a fix for qHash. The Qt50String inherits from QString
and becomes ambiguous once it no longer goes through a catch-all
template function because qHash(QString, size_t) has a better match for
the second argument.

Pick-to: 6.2 6.4
Change-Id: I23c7afb1b3aa167d40dc4838e82b7763de015f6b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-27 23:30:30 +02:00
Arno Rehn
7a7051b58f QMetaType: Support custom unary converters with optional<To> return type
To indicate success of a conversion, the public API has previously only
supported registering member functions of the form To (From::*)(bool *).
When adding custom converters for types that cannot be modified, this is
usually not a possibility.
As an alternative, this patch adds support for std::optional in the
UnaryFunction overload of QMetaType::registerConverter. If the returned
optional has no value, the conversion is considered failed.

Task-number: QTBUG-92902
Change-Id: Ibac52d2cb9b5a2457081b4bebb0def1f03e3c55d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-09-27 20:59:21 +02:00
Eirik Aavitsland
df0b70eece StyleSheetStyle: Fix color of placeholder texts in text edits
Prior to 5.12, the placeholder text color was hardcoded to be the same
as the text color, but with an alpha of 128, i.e. semi-transparent. In
5.12, it instead got its own ColorRole in QPalette. So behavior
changed (In some cases in 5.12 and later, consistently from Qt 6):
placeholder texts no longer got a "light" (semi-transparent) version
of the css-styled color, but just the default gray/semi-transparent
black. That problem was reported as QTBUG-89815. However, the fix for
that bug did not apply the semi-transparency, but only used the same
color as the text. That caused a confusing visual expression, as
actual and placeholder text would look the same. This commit fixes
that.

The problem was made worse since there is no way to specify the
placeholder text color from css, i.e. to style it independently. A
follow up commit will aim to add that.

Fixes: QTBUG-92199
Task-number: QTBUG-93009
Pick-to: 6.4 6.2 5.15
Change-Id: I9e6698d34eba91cbf65c4da07aa5ac6d9f96a9ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-27 20:22:02 +02:00
Alexey Edelev
b89d63515b Replace the syncqt.pl script with syncqt tool
syncqt.pl adds an extra dependency on perl when building Qt. Modern C++
provides the convenient cross-platform way to access a filesystem and
to use regular expressions, so we may replace the perl script with C++
application. The syncqt executable is built at configure time and
installed as QtCore tool. It's running at configure time to deliver the
required header files for IDE to build a consistent code model and at
the build time to keep tracking changes in header files and generate
the missing aliases without reconfiguring. 'syncqt' only parses header
files from a CMake build tree, so the resulting Qt installation only
contains interfacing headers that belong to the platform that Qt is
built for. 'sync.profile' files are not used as the 'source of truth'
for sync qt procedure anymore, all the necessary information is taken
from either CMake files at configure time or from the module header
files while parsing them.

syncqt.pl is still in place since it's required as fallback solution
for a smooth transition to the new syncqt implementation for all qt
repositories.

This patchset only enables the C++ based syncqt for 'qtbase'
repository.

From the performance perspective C++ version works faster then perl
script, also the configure time is reduced significally on subsequent
reconfigurations - up x2 times faster when re-configuring repository,
but it also takes time to compile the tool itself the first time.
Numbers for qtbase:
           syncqt.pl  syncqt.cpp
 initial:  0m16,035s  0m20,413s
 reconfig: 0m6,819s   0m3,725s

The syncing procedure can be run separately for each module using
<ModuleName>_sync_headers targets. The 'sync_headers' target can be
used to sync all the modules at once.

Task-number: QTBUG-87480
Task-number: QTBUG-103196
Change-Id: I8c938bcaf88a8713b39bbfd66d9e7ef12b2c3523
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-27 13:12:11 +02:00
Eirik Aavitsland
458ec4cb54 Fix setScaledClipRect autotest for reading SVG format
Since setScaledClipRect will actually render only the necessary parts,
there may be insignificant differences in rounding/anitaliasing
compared to rendering the whole image first and then clipping.

Hence this autotest case would always fail. But that would not happen
in CI, since it tests qtbase without the qtsvg module, and then the
SVG tests are skipped. (For some reason, one ran into this in wayland
testing and made an exception for that, but obviously this failure has
nothing to do with wayland).

Work around the issue by converting the rendered images to 4 bpc
format, so the differences in the least significant bits get truncated
away.

Fixes: QTBUG-100917
Task-number: QTBUG-81044
Pick-to: 6.4
Change-Id: I1c14e98af22d0ae22a751960b69e692c7a38399b
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-27 13:12:11 +02:00
Ville Voutilainen
e08f05ac6e QDebug: Support standard strings and string views directly
[ChangeLog][QtCore][QDebug] QDebug now supports printing
std::strings and std::string_views (and their wide, u16, and
u32 variants) directly.

Task-number: QTBUG-96878
Change-Id: I7baf4fe688bfff50580b1cee9417af13949374cc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-27 14:12:11 +03:00
Fabian Kosmale
5222df2be7 moc: Add basic support for nested inline namespaces
This improves moc's support for nested inline namespaces, so that code
containing them will not break compilation.
For simplicity, we allow nested inline namespaces even in C++17 mode
(the actual C++ compiler will reject the code anyway, and probably with
a better error message than moc could output).
moc still has no real awareness how inline namespaces work, but that is
a preexisting issue.

Pick-to: 6.4 6.2
Fixes: QTBUG-106920
Change-Id: I7b415a99133575f101bc81d01d4670a5f752917f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-26 21:14:39 +02:00
Eskil Abrahamsen Blomfeldt
ce4c26c8d1 Revert "QTextLayout: fix maximumWidth() for a text containing line separator"
This reverts commit 013c346a8d. It was
determined to cause a regression in Qt Quick: QTBUG-106899.

In order to unblock integrations, we need to revert the change. It
can be re-committed later when the problem has been analyzed and
addressed.

Pick-to: 6.2 6.4
Fixes: QTBUG-106899
Task-number: QTBUG-89557
Task-number: QTBUG-104986
Change-Id: I04054587f68ab39fdb038b02fc69ebfa3dc7d197
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-23 20:08:56 +02:00
Mikolaj Boc
b1b61636b3 Introduce centralized means of checking for asyncify
The new function has an advantage of not requring EM_JS.

Change-Id: Ib9ad0e6b59cfe2e6864697a14b5cfdb39f62af2d
Reviewed-by: David Skoland <david.skoland@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-23 10:14:28 +02:00
Øystein Heskestad
d8387fc538 Reduce foldCasing of the needle in Boyer-Moore QString searches
Before searching, foldCase the first up to 256 characters, and use this
buffer to compare against the haystack. If the needle is larger than the
buffer, compare the rest of the needle against the rest of the haystack
for every potential match. The buffer is placed on the stack and must be
refolded for each search, but this change does not break the API.

This is faster than the old implementation, except if the needle is long
and it is found near the beginning of the haystack, or if the needle is
long and it is not found in a short haystack where few comparisons are
done and hence few case foldings were needed in the old implementation.

Benchmarking using tst_bench_qstringtokenizer tokenize_qstring_qstring
shows an improvement for the the total testcase and usually for each
individual test.

Fixes: QTBUG-100239
Change-Id: Ie61342eb5c19f32de3c1ba0a51dbb0db503bdf3a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-22 18:05:44 +02:00
Mårten Nordheim
c633f4644c tst_QHash: Fix outdated rehash test
Inserting the same key repeatedly with QMultiHash will not
test rehashing behavior because in Qt6 those entries all
end up in a linked list.

Pick-to: 6.4
Change-Id: I78c45eed0f35a13af6d6da75d7189a6933750f13
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
f553e4b4c3 tst_QDom: replace a final u"..."_qs (deprecated) with u"..."_s
It seems all the others have had this treatment, but one got missed or
added while the others were being fixed.

Change-Id: If47e2c6bf939b7a55f2c38b029c1df3a901e8bfc
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-09-22 17:34:51 +02:00
Mårten Nordheim
1fa0e86995 QNetworkReply: honor legacy behavior of setting Accept-Encoding
And don't decompress the data

Pick-to: 6.4
Fixes: QTBUG-106689
Change-Id: I93a96be8178e24ff0b0bb8647276828161445cf5
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-22 15:34:51 +00:00
Edward Welbourne
0462dba766 Skip early return from test loops during cleanup()
The QTRY_* macros and QTestEventLoop exit early if the test has
resolved; however, in the cleanup phase of a test, even if the test
has failed, these loops should continue as normal.

[ChangeLog][QtTest] During the cleanup() phase of a test, the QTRY_*
macros and QTestEventLoop now ignore the test resolution, in contrast
to when they are used from the test itself, which (since 6.3.0) exits
the loops early if the test has failed.

Pick-to: 6.4 6.3
Fixes: QTBUG-104441
Change-Id: I2673161967cbbc57815155af698a9338ab98a686
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
abab3c5dad Fix error in TAP test logger's regex to recognize QVERIFY() output
The regex used a greedy .+ to match an actual dot and a space,
preceding an open parenthesis, with the result that if the message
contained any parentheses that .+ swallowed everything up to the last
of them. Correct the regex so that recently-added tests' error
messages show up correctly.

Change-Id: I6e52c9b2a6e7959335fcddbb4266f65b589eba68
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
16f5132b21 Add test-case for TAP logging glitch
The recently added test for QTestEventLoop produced a message which
the TAP test-logger mis-parses. Since that message shall soon go away
(when I fix the bug the new test exists to verify), modify one of
cmptest's QVERIFY2() messages to trip up the same bug, so we can spot
any regressions on this in future (after the imminent fix to this TAP
issue).

Change-Id: Ibbe9931c01c75df529c9571e2bbdbd34010dd9ec
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-09-22 17:34:51 +02:00
Edward Welbourne
73a2320278 Fix signed/unsigned comparison warning in shader test
Trivial, noticed while looking for deprecation warnings.

Change-Id: Ie2c450d457e25b998fb686c4c22333781364073c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-09-22 17:34:51 +02:00
Axel Spoerl
10a143ccd7 Prevent dock widget from resizing upon unplugging from main window
QDockWidgetLayoutState::itemRect() has been used to calculate a dock
widget's size when unplugging from the main window. This method is meant
to calculate the size of the rubber band, showing the dock widget's
dock area.

The rubber band is by QDockAreaLayout::sep wider (top or bottom dock)
or higher (left or right dock) than the respective dock widget. This is
to make sure the rubber band is never fully covered by the dock widget.

By wrongly using itemRect() also for the dock widget's size after
unplugging, the dock widget grows in size each time it is unplugged.

This patch passes an invalid QRect to QDockWidgetPrivate::unplug(), in
order to prevent resizing.

tst_QDockWidget::unplugAndResize() is extended to check size
consistency after unplugging (corrected for frame margins).

Fixes: QTBUG-106531
Pick-to: 6.4 6.2
Change-Id: I1cf9f695691b0e165a5cb2881781602426e5d587
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-21 18:41:43 +00:00
Fabian Kosmale
a8ccd9cd84 moc: Do not fail to compile meta-methods containing non-const ref types
Amends 2d0c31e7d9. We were using
MetaTypeDecay in qTryMetaTypeInterfaceForType; but that is not used by
moc when complete types are enforced. Change qt_metaTypeArray to also
use qTryMetaTypeInterfaceForType, so that the code path for "force
complete types"[0] and the normal one do not diverge.

[0] Most easily enabled by using one of the QML type registration
macros.

Fixes: QTBUG-106672
Pick-to: 6.4 6.4.0
Change-Id: I9bf14873d1d0c4127a676643f7e8eb77f6e42dc8
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-21 18:41:43 +00:00
Sona Kurazyan
24dedaeaa1 QFuture: fix handling of cancelled continuation chain
To support cancellation of continuations attached via the parent future,
for each future returned by a continuation we store a pointer to its
parent (i.e. future the continuation is attached to). Later, before
executing a continuation, we go through chain of parents and check if
any of them is cancelled. However, if one of the parents is destroyed
while the chain is executing, the next continuations' parent pointers
will become invalid. So storing the parent pointers isn't safe.

This commit changes the logic of handling the cancelled continuation
chain in the following way:

- Instead of storing a parent pointer in the continuation future's data,
  we do the opposite: we store a pointer to continuation's future in the
  parent.
- When a future is cancelled, we mark all continuation futures in the
  chain with a flag indicating that the chain is cancelled.
- To guarantee that the pointers to continuation future's data don't
  become invalid, we clean the continuation (that stores a copy of its
  future's data and keeps it alive) only when the associated promise
  is destructed, instead of cleaning it after the continuation is run.

Fixes: QTBUG-105182
Fixes: QTBUG-106083
Pick-to: 6.2 6.3 6.4
Change-Id: I48afa98152672c0fc737112be4ca3b1b42f6ed30
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-21 01:18:31 +02:00
Edward Welbourne
89d58147ea Fix use of 0 as null pointer in tst_QDateTimeEdit
Change-Id: Ie529150801e3bbfc7c3203e49f712239cb3e82bd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:47:34 +02:00
Johannes Kauffmann
184743cc79 tst_qtnoeventloop: add missing override
Change-Id: I24ad2f4d069ce1c7a894f8466927acb6dfd266d3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:09:31 +02:00
Johannes Kauffmann
2ce2992f5e tst_qprocess: remove unused loop counter
Change-Id: I1eece5a676cfa02fff27be01f25b07ddd82c40d6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-20 19:09:31 +02:00
Tor Arne Vestbø
8e577b6d10 windowflags: Add control to toggle Qt::NoDropShadowWindowHint
Change-Id: I53b496c7b27a73cfb6052af3cd8643a971609523
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-20 16:34:57 +02:00
Tor Arne Vestbø
6fc751aedf windowflags: Report QWindow compound window states
Pick-to: 6.4
Change-Id: I44b923df6851d0f51ac39bcbb4a569cb2fde775d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-20 16:34:57 +02:00
Vladimir Belyavsky
013c346a8d QTextLayout: fix maximumWidth() for a text containing line separator
When laying out, we need to increase layout's maximum width _only_
if the previous line was not explicitly wrapped by a line or paragraph
separator, or if the current line's width is greater than the
previously accumulated layout's maximum width.

Fixes: QTBUG-89557
Fixes: QTBUG-104986
Pick-to: 6.2 6.4
Change-Id: Ib7cc4b9dda8f20166dcbd5cfd3b56424bb33d14a
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-09-20 06:52:21 +00:00
Liang Qi
571e7a41f5 tests: improve tst_gestures on GNOME
There are some issues when testing QGraphicsView on GNOME(xorg)
overlapping with the default top bar. This change only move
the view a bit.

Notes:

* There is no CentOS in CI any more.
* panelPropagation() and panelStacksBehindParent() failed in CI
and local vm on Ubuntu 20.04, but only in CI on Ubuntu 22.04.

For example, we can turn the top bar off:

In Extension Manager, install Just Perfection, and disable Panel
in Visibility in it, all tests will pass too.

Task-number: QTBUG-84258
Task-number: QTBUG-103054
Pick-to: 6.4 6.2
Change-Id: I05c262540c85af00182cd142760c4a29554b04c9
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-09-19 14:39:28 +00:00
Allan Sandfeld Jensen
0e90bdbaa4 Fix flaky FP32x4 test
The composition implementation may act unexpectedly on Inf or NaN input
values. This change avoid those values, without changing the current
implementation.

Pick-to: 6.4
Fixes: QTBUG-101236
Change-Id: I8e4ee67f53093b7f81e014b28d8a028ba2ddcc47
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-09-16 21:02:31 +02:00
Thiago Macieira
864fbd6582 tst_QFile::setPermissions/Unix: test both chmod() and fchmod()
On Unix, we have the fchmod(2) system call that changes the permissions
of an open file descriptor. This commit adds a test for that, by not
closing the QFile before setPermissions().

Pick-to: 6.4
Change-Id: If5d5ef6220874ae8858efffd171255b9f20ed501
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:50 -07:00
Thiago Macieira
0193b4d219 tst_QFile::setPermissions: add QScopeGuard to remove temporary file
Pick-to: 6.4
Change-Id: If5d5ef6220874ae8858efffd17125580b5943cc2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:50 -07:00
Thiago Macieira
4b997d1851 QFileDevice: clear cached permissions on setPermission()
In theory, if we succeed, the permissions should be what we set, but
let's not make that assumption. And if we failed, it might be because
the file disappeared or something else, so re-stat()ing the file is a
good idea.

Pick-to: 6.4
Fixes: QTBUG-7211
Change-Id: If5d5ef6220874ae8858efffd171255506b7bbee0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-16 08:37:49 -07:00
Mårten Nordheim
68f641095c QNetworkReplyFileImpl: Don't emit 'finished' in the ctor
Pick-to: 5.15 6.2 6.4
Fixes: QTBUG-105618
Change-Id: I3bd36fbd5818d54088098e750643c3e2de30496e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-16 17:02:06 +02:00
Konrad Kujawa
ec2af0a9df Remove preprocessor conditionals for chrono include
__has_include(<chrono>) is always true, because C++11 chrono include
is required since 6.0.

Pick-to: 6.4 6.3 6.2
Change-Id: I50cb92571bf4f1f86e2f3f2b5f486dd3c3f30f4a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-16 08:09:05 +02:00
Mårten Nordheim
7447d73327 tst_QLocale: use fenv everywhere
And remove the platform-specific code.
fenv is available since c++11.

Change-Id: Ia5540be93b54117d4b5e9c7579100039c151dcc5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-15 23:41:51 +02:00
Joerg Bornemann
c9c04291f5 CMake: Add Linux support to qt_deploy_runtime_dependencies
Before this change, qt_deploy_runtime_dependencies supported Windows and
macOS only.  We add a generic deployment method implemented in
cmake-language with file(GET_RUNTIME_DEPENDENCIES).  This deployment
method is now enabled for shared builds on Linux.

The file(GRD) command requires that the EXECUTABLE argument points to
the executable in the build directory.

Only libraries in Qt's installation directory are considered for
deployment.  This includes Qt's own libraries and also things like
libicu*.so we're shipping with the installer.

Unlike macdeployqt and windeployqt, the generic
qt_deploy_runtime_dependencies does not yet support deploying
translations.  We will catch up on this in a later commit.

Change-Id: Iea23abcdba774d4c1885c8d2c243eb3e48fb7fae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-15 12:55:23 +02:00
Liang Qi
6329fed0a8 tests: blacklist tst_QSocks5SocketEngine::passwordAuth() on all Ubuntu
Task-number: QTBUG-106020
Pick-to: 6.4 6.3 6.2
Change-Id: I98de5b890d23ff6721e3e5f2644a3cf73a532e6c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-15 12:55:23 +02:00
Allan Sandfeld Jensen
dc2927be4d Disable bad tests relying on wrong behavior
These tested results are all wrong and caused by internal overflows.

Note the behavior can not be fixed either as it involves moving an
already maximized QRect, which can not be done without overflow.

Change-Id: If35db68102889012c56eb149fe49bc48954d3422
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 12:07:02 +02:00
Mårten Nordheim
b31d902913 Http: Don't clear (de)compressed data on error
Some errors, such as 404, may still present useful data. As opposed to
errors such as 'RemoteDisconnected'. So, just keep the data around until
the reply is deleted.

Pick-to: 6.4
Fixes: QTBUG-106573
Change-Id: I6c86b5a55a45f837ea9b42559d88cd3e0ac2fa5c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-14 19:53:49 +02:00
Tor Arne Vestbø
2e58e242b4 Don't rely on synthetic mouse events in updateFocusChainWhenChildDie test
Synthetic mouse events are not reliable, as the platform might restrict
synthetic mouse moves. In addition, the WM might automatically activate
the window when the other window is hidden, which makes the EXPECT_FAIL
flakey.

Since the test was not written to test window activation, let's just
explicitly activate the window.

Fixes: QTBUG-23699
Pick-to: 6.4
Change-Id: I0ac1d3bc0658dfbd600a1f5d960839860be6dd2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-14 19:07:14 +02:00
Edward Welbourne
6d10ecc699 Tidy up tst_QTimeZone
Its debug member can be set where it's declared, making the
constructor redundant.

Change-Id: Ic1195108766a6a86c3392a5bcf7f197ea31e8068
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-14 17:46:39 +02:00
Yuhang Zhao
40523b68c1 QWinRegistryKey: refactor
Refactor QWinRegistryKey to make it more modern and more
usable from outside.

Adjust the test for QWinRegistryKey to test the new functions,
merged with the original test.

Will port raw registry accessing code in QtBase to use this
class in follow-up commits. This change is the first step.

The long term goal is to port QSettings registry code to
this class instead of using raw Win32 APIs, however, there's
much more registry code in QSettings and migrate them to this
class needs a large refactor, so jsut leave it for now. Will
fix it in some future commit.

Change-Id: Iada2adb41b4d58e1b658ff6870a4b31ace479d43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-14 09:31:41 +08:00
Tor Arne Vestbø
63754bd7ae Blacklist tst_QGraphicsWidget::updateFocusChainWhenChildDie() on macOS 13 in CI
For some reason when running this test on macOS 13 in the CI the window
is activated, as on other platforms, but this is not reproducible
locally, so we can't just remove the QEXPECT_FAIL.

Task-number: QTBUG-104210
Task-number: QTBUG-23699
Change-Id: Ib1cacb36d90d2be357756c82af2427f2b3ab9999
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-13 18:19:38 +02:00
Mikolaj Boc
701852e17b Add window-modal show option to dialogs manual test
This provides an easy way to test window modality using a ready
available test.

Change-Id: Ia23736c61fd56dda8f72ae19f5f102163951271b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-13 18:13:00 +02:00
Mårten Nordheim
9e12ea37ea tst_QNetworkreply: fix a path to test-data
For some reason it fails on Ubuntu 22.04, but it's anyway
not following the trend the rest of the file uses, so just
assume it's the code at fault and fix it.

Thanks to Liang Qi for debugging this!

Pick-to: 6.4
Fixes: QTBUG-106016
Change-Id: I9d0563a081827eaa037d61643f0ea46301e11493
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-09-13 16:00:44 +00:00
Edward Welbourne
411b17150e Make time parsing accept zz as equivalent to z
Expand a test to cover millsecond format variants more thoroughly,
including a test for the new usage of zz. This applies to parsing the
complement to commit 0a36a7c1db173089c25ea09029505a589a1c59e5's change
to serialization. Fixed minor glitch in the serialization's doc, too.

[ChangeLog][QtCore][QDateTime] When parsing a datetime, the 'zz'
format specifier is now equivalent to 'z', as for serialization.

Change-Id: I1c5700064738d9c92d5e8ce10bff8050131e190f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-13 17:10:04 +02:00
Edward Welbourne
5832087859 Include global data tags in teamcity's test function names
Use the standard mechanism instead of a hand-rolled way of identifying
function/data-tag combinations. Adds missing data relevant to
identifying test cases, some of which previously had apparently the
same name, with no hint at why the test-case was seemingly run
repeatedly.

Change-Id: I6225c6d1990069c94a1f1c8dbb179993b96076e7
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-13 14:51:00 +02:00
Linus Jahn
cd37a773ca QCryptographicHash: Add getter for algorithm()
This can be helpful when you calculate multiple hashes, store them in a
vector and you want to know which result belongs to which algorithm.

[ChangeLog][QtCore][QCryptographicHash] Added getter algorithm().

Change-Id: Ifcf78536f215619a6e2e3035a95598327d0ed733
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-12 20:47:24 +02:00
Linus Jahn
358248b495 Make QCryptographicHash move constructible
This adds a move constructor, a move assignment operator and a swap
function to QCryptographicHash. This can (to name one example) be useful
when you want to store multiple hashes in a vector.

[ChangeLog][QtCore][QCryptographicHash] Added move constructor, move
assignment operator and swap() function.

Change-Id: Id54594fa69104ec25ad78581f962a021e85531c2
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-09-12 18:47:23 +00:00
Mikolaj Boc
91d7dcea11 Fix QWasmWindowStack::topWindow when the stack is empty
The method should by contract return nullptr when the stack is empty,
but it crashes in this case.

Also, unit-test the case.

Pick-to: 6.4
Change-Id: If64b71e761efd9a5cd5af407cd68cba7f8dbc8e2
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-12 20:09:03 +02:00
Mårten Nordheim
5387b88aa9 QNetworkReply: Fix missing final emission of readyRead
If we receive compressed data we will decompress it as it comes in,
in some cases the final byte we receive doesn't actually contribute
to the final output. If this byte is handled by itself then, when
combined with QNetworkReply's signal compression, we ended up not
emitting the readyRead signal for any of the data we received while
compressing the signals.

So, instead of relying on checking difference in bytes downloaded
for each batch of data received we keep track of how much data
we had received the last time we emitted readyRead.

Pick-to: 6.3 6.4 6.4.0
Fixes: QTBUG-106354
Change-Id: I4777be29b46bf0de968667e9de9d975c735ac6e6
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-12 13:06:50 +02:00
Mårten Nordheim
c288733541 Make tst_qnetworkreply depend on the 'echo' helper
Because it's convenient to have it build automatically.

Pick-to: 6.2 6.3 6.4
Change-Id: Iecd5bd1f9fe518f683b8ee9eb6529e48ce76fb33
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-12 01:20:19 +02:00
Mikolaj Boc
1d401e34ac Compile guard tests in corelib/kernel that need threading support
Some tests in corelib/kernel need threading support, but they are not
guarded against compilation if Qt is built without threading.
Such tests have been disabled in this case.

Change-Id: I2f5dc9582f2a59b6af2a9e56638b045dca06193d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-09-11 19:36:49 +02:00
Timur Pocheptsov
17e8f322eb tst_QSslSocket::serverCipherPreferencies - fix for OpenSSL v3
Test was not really good to start with - it was assuming the presence of
particular ciphersuites. Furthermore, it was ignoring the fact that
TLS 1.2 and TLS 1.3 set ciphersuites differently in OpenSSL.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I6c8ba20154cdeb9275878462ab945729d6c82ecc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-08 17:07:49 +02:00
Edward Welbourne
6a14ad4993 Perform uiLanguages() likely-adjusted processing purely on IDs
The collection of translations available to us need not have anything
to do with whether CLDR has matching data, so preserve the system UI
language list's entries as they are, rather than forcing them through
the QLocale constructor's exercise of likely sub-tag rules.

Instead, simply parse the given locale tags to QLocaleId instances and
use these in the likely-subtag processing to determine what other
entries to add to the list in addition to those supplied by the
operating system. Since going via QLocale did usually supply a
territory, that was included in the BCP 47 name, it's now possible for
the given entry to lack the language_territory name, so be sure to add
that if missing.

This incidentally reduces heap traffic and saves a fair deal of hidden
likely-subtag processing in calls to the constructor and bcp47Name().

Expand testing of QLocale::uiLanguages(), both plain and system.  In
the process, cross-link the two closely-related tests, move a comment
on one's _data() to the other's, where it really belongs, and add
reporting of the actual lists on failure. Enable MySystemLocale to
remember the requested locale's ID, before likely sub-tag processing,
so that we can make query() report results for language, script and
territory as requested, to ensure the fake system locale really does
match what was requested. The new german-britain test failed without
it, because there is no de-GB locale in CLDR.

Task-number: QTBUG-99531
Change-Id: Ide041577772c442a4413e3b9a590e11140c48f49
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-07 15:29:39 +02:00
Edward Welbourne
ebe9aca900 Simplify system locale management
Have QSystemLocale manage a stack, so that tests can install an
over-ride for the actual system-specific one reliably and restore the
system-specific one when finished. Leave the QSystemLocaleSingleton
out of the stack, all the same. In the process, mark the QDoc comments
for QSystemLocale all as \internal, since this is not public API.

Change-Id: I8faed49780215e42f32be10cf936c32bb46105bf
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-07 15:29:39 +02:00
Edward Welbourne
753bfdf6a1 Work round macOS's omission of en_DE from its own uiLanguages()
When the system locale is en_DE, macOS seems to think we should use
en_GB as the right translation. While that probably is a sensible
choice in the absence of an en_DE translation, we should definitely
use the en_DE translation if available, especially if en_GB isn't
available (which lead to a fall-back to de_DE, given later entries in
macOS's list). So prepend the system locale's own pcp47Name() if it
(isn't the C locale and) is missing from what we would otherwise have
used for uiLanguages(), after likely sub-tag perturbations.

Add a test simulating (some approximation to) what macOS was doing
that would have caught this case; and add a scope-guard reporter to
the test to report what shows up when lists don't match.

Fixes: QTBUG-104930
Pick-to: 6.4 6.4.0 6.3 6.2 5.15
Change-Id: I116234708067e1717d9157aebc84da76e04a9f38
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-09-07 13:29:39 +00:00
Mårten Nordheim
070446d5eb tst_qlocale: only restore the fp control masks we change
Certain masks are not supported outside 32-bit x86, and will assert on
x64.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106000
Change-Id: Ic9f58e5a19c1db3309edeb5ec529e7a78c929665
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-07 13:15:27 +00:00
Alexey Edelev
33a12988e2 Guard windows-specific includes with Q_OS_WIN
Change-Id: I0a7c605c55c815c7220024f302f511e302005ab9
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-07 14:39:25 +02:00
Mårten Nordheim
c76f7cbbcb QTextStream: Fix logical error in setEncoding
We only want to enable writing BOM if we have _not_ started
writing.

Fixes: QTBUG-106279
Pick-to: 6.2 6.3.2 6.4 6.4.0
Change-Id: Ibcbc101b931615fddb2507f01307bf9619772d7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-07 01:09:31 +02:00
Ivan Solovev
3dff397284 tst_qmatrixnxn: port away from deprecated APIs
Replace the deprecated operator*() calls with various
overloads of QMatrix4x4::map()

Add a separate test for deprecated API and guard it with
QT_DEPRECATED_SINCE checks.

Task-number: QTBUG-104858
Change-Id: Ief2e03198696382dc626f01b209614fe320e70b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-06 13:59:57 +02:00
Mate Barany
aa99bf532d qdbusxml2cpp: modify the behavior of -m/--moc option
qdbusxml2cpp has a -m/--moc option. Change and modify the behavior
such that
-p foo -m includes moc_foo.cpp in the generated .cpp
-p :foo.cpp includes moc_foo.cpp in the generated .cpp
-p foo.h:foo.cpp includes moc_foo.cpp in the generated .cpp

Change the Qt6DbusMacros.cmake file accordingly.

[ChangeLog][qdbusxml2cpp] The -m/--moc option now generates
idiomatic moc file names (moc_base.cpp for headers, base.moc
for implementation files)(was: always base.moc). Build systems
using workarounds for the non-idiomatic naming of moc files
used by qdbusxml2cpp in the past can now drop these workarounds
for Qt versions >= 6.5.

Fixes: QTBUG-103313
Change-Id: I754b1b276f130cb8645166470e1b457a676590f7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-09-06 11:44:22 +02:00
Mårten Nordheim
b4a5f0c57c tst_QSsSocket: fix verifyClientCertificate with OpenSSL 3
OpenSSL 3 by default disables TLS < 1.2 in the conf files. We're not
going to work against that, so we bump the version of TLS used.
Keep the client-side TLS 1.0 Or Later just to keep testing that this
part works.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ia6cb10495875de232d69a886832ae74c5f5ac15f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-05 18:29:12 +02:00
Tang Haixiang
8aae49019d QTextDocumentLayout: Account for topMargin when hit-testing
When TopMargin is set in TextBlock and the mouse click position is
between Margin (the mouse is not on the textrect), the cursor will
usually jump to the end. So topMargin should be considered when
hitTest() calculates coordinates.

Fixes: QTBUG-91774
Pick-to: 6.4 6.3 6.2
Change-Id: I231377263855b9cd7152684203fc4ed2e9299bb9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tang Haixiang <tanghaixiang@uniontech.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2022-09-05 16:29:11 +00:00
Eskil Abrahamsen Blomfeldt
20d23f7003 Fix tst_QWindow::requestUpdate on Wayland
On Wayland there is a special case when decorations are enabled,
where we post an initial update request to ensure widgets are
redrawn after the buffer is recreated (see
af7b60ade5c4be81cbc58eb18307c017d5594071 in qtwayland). To
make sure the test behaves the same on Wayland as on other
platforms, we disable client-side decorations when running
these tests.

The flag is primarily required for the requestUpdate() test
at the moment, but it is only queried once per application
run, so it has to be set before any tests are run.

Pick-to: 6.4
Fixes: QTBUG-100889
Change-Id: Ica6d744083ecae4a3722b6d04b956e7615f0dfe5
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2022-09-05 18:29:11 +02:00
Volker Hilsheimer
bf3500a631 Fix cmake warnings from using deprecated PUBLIC_LIBRARIES
Pick-to: 6.4
Change-Id: I8d4f0d9e98edc4e06dda9f58e62197572b4cbdbc
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-05 18:29:10 +02:00
Volker Hilsheimer
3b91bab465 Fix compiler warning: don't copy in ranged-for loop
Change-Id: If21f4e34324f33300009a427fb81e23ab49d4ad0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-09-03 19:10:42 +02:00
Timur Pocheptsov
a7657d3c5f tst_QSslSocket::oldErrorsOnSocketReuse - make it work with OpenSSL v3
The initial problem was in server not starting encryption, because
its certificate was rejected by OpenSSL (v3) saying 'weak md'.
After the certificate was replaced, we got another problem - due
to the fixed TLS v.1 protocol for both client and server - handshake
is interrupted early with 'tls v1 alert' and error message
saying about not found signature algorithms. Don't fix the protocol
version, use proper QSsl::SecureProtocols (default).

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I0f22f5304f4405933ad511195bc61c640518e7d8
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-03 13:01:06 +02:00
Mårten Nordheim
28693abb64 tst_QSslSocket: regenerate certificate used for setLocalCertificateChain
The certificate was using SHA-1 for signing its certificate, which is
considered 'not good enough' by some TLS libraries.
Regenerate it with SHA-512 and a larger RSA key.

Also include the files needed to generate it.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106018
Task-number: QTBUG-95123
Change-Id: I535e047d540e663c8cec334695196044173949fc
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-09-02 22:39:22 +02:00
Mikolaj Boc
8e307a6cf9 Don't batch qmetaobject_compat
Batching the tests leads to one of the tests tst_qmetaobject and
tst_qmetaobject_compat not being registered in the batch. Attempts to
batch those together fail as batch test name is defined per-source,
which, in this rare case, is the same across the two targets.

Change-Id: I356931feabc004c39ba0b6863b5f64e06d739a58
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-09-02 19:22:32 +00:00
Timur Pocheptsov
d2544b3bb2 tst_QSslSocket::protocolServerSide - make it work with OpenSSL v3
OpenSSL v3 by default sets SECLEVEL = 2 unless overridden in conf files.
SECLEVEL >= 1 means TLS <= 1.1 is disabled. Remove cases that were
previously expected to work. Arguably, we should not test deprecated
protocols at all, but the cases expecting a failure still work
and logically correct.

Task-number: QTBUG-95123
Task-number: QTBUG-106018
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Ifa59fa902b433338dbed7abf086cfdef9470384c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-02 21:02:27 +02:00
Shawn Rutledge
ef9b51ce99 Use testlib for multiPointRawEventTranslationOnTouchScreen events
It was an old test written in a very low-level way, which perhaps is ok
to be independent of testlib in a few tests; OTOH, it was blacklisted
on a couple of platforms. Perhaps doing touch events the standard way
could be more stable.

While we're at it:
- verify that the touch events are accepted, and thus verify the new
  bool return value from commit()
- implement paintEvent() to help understand the layout, and touchpoint
  locations
- remove repeated QCOMPARE lines
- skip the test if window positioning fails
- try to un-blacklist it, on the assumption that window positioning
  failure was the reason

Task-number: QTBUG-87025
Task-number: QTBUG-104656
Pick-to: 6.4
Change-Id: Ie22eb24abf95cd849990a56212be87d06ce8e574
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Doris Verria <doris.verria@qt.io>
2022-09-02 19:07:21 +02:00
Thiago Macieira
0380dd5051 QMetaObject: pass the QMetaTypes in variadic invoke/newInstance
[ChangeLog][QtCore][Meta Object] QMetaMethod::invoke(),
QMetaObject::invokeMethod(), and QMetaObject::newInstance() are no
longer limited to 10 arguments.

[ChangeLog][QtCore][Meta Object] The use of the Q_ARG macro is no longer
necessary when using QMetaMethod::invoke(), QMetaObject::invokeMethod(),
and QMetaObject::newInstance(). Types may now be passed
directly. Similarly, Q_RETURN_ARG can be replaced by the free function
qReturnArg().

[ChangeLog][Potentially Source-Incompatible Changes]
QMetaMethod::invoke(), QMetaObject::invokeMethod(), and
QMetaObject::newInstance() no longer support passing forward-declared
types in the argument list (it was possible to pass them by
const-ref). From Qt 6.5 onwards, all types in the argument list must be
fully defined.

[ChangeLog][Potentially Source-Incompatible Changes] Attempting to use
the internal types QArgument, QReturnArgument, QGenericArgument, or
QGenericReturnArgument directly with QMetaMethod::invoke(),
QMetaObject::invokeMethod() or QMetaObject::newInstance() may fail to
compile. Those are internal types that were never meant to be used
directly and will be removed in Qt 7. If really necessary, ensure all
arguments passed to those functions are directly using those classes and
not mixed with Q_ARG and Q_RETURN_ARG. Implementations of bindings to
other languages should contact the Qt development mailing list to
discuss options.

Change-Id: I36b24183fbd041179f2ffffd1701e3e8e47e0fba
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-01 21:29:04 -03:00
Eirik Aavitsland
54aa7e75b8 QVariant: fix conversions of Q_ENUM that are QFlags<> to string
The doc of QMetaEnum::valueToKey() says to use ::valueToKeys() instead
for flag types.

Pick-to: 6.4
Change-Id: I48e5ba47324137f2ce2710f1d876e93e7c562e9f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-09-01 20:48:49 +02:00
Timur Pocheptsov
8e21844683 tst_QSslKey - make OpenSSL v3 detection fully runtime
Otherwise, checks are useles in non-developer build.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-106036
Change-Id: I41b6d8f250021ff9fa4981f9df9244c269ed2999
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-09-01 20:10:03 +02:00
Laszlo Agocs
c681c7c23f rhi: metal: Add support for tessellation
Change-Id: Ie8d226a6a959aa5e78284ea72505fd26aec1e671
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-09-01 19:44:19 +02:00
Marc Mutz
812a0d3125 QAnyStringView: construct from any T implicitly convertible to QString/QByteArray
This includes QDBusReply, QProperty, and QStringBuilder expressions.

The new constructor subsumes the QStringBuilder case without requiring
jumping though hoops to delay the definition of the ctor the way we
had to for the explicit QStringBuilder constructor, so remove the
explicit QStringBuilder one again.

[ChangeLog][QtCore][QAnyStringView] Can now be constructed from
anything that implicitly converts to either QString or QByteArray.

Fixes: QTBUG-105389
Change-Id: I0e584dd3e20d591381609a3329ef47cec7356ecc
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-09-01 15:51:48 +02:00
Sona Kurazyan
50b05e3e2a Move qVersion() from qglobal.h to qlibraryinfo.h
Since qVersion() might be called also from C code, disable the parts of
qlibraryinfo.h that are relevant only for C++ code if __cplusplus is not
defined.

[ChangeLog][Potentially Source-Incompatible Changes] qVersion() is
moved from qglobal.h to qlibraryinfo.h, '#include <QtCore/QLibraryInfo>'
needs to be added where it's used.

Task-number: QTBUG-99313
Change-Id: I3363ef3fa4073114e5151cb3a2a1e8282ad42a4d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-09-01 13:26:30 +02:00
Sona Kurazyan
b077c419ea Move QMacAutoReleasePool from qglobal.h to qcore_mac_p.h
And include qcore_mac_p.h where needed.

Task-number: QTBUG-99313
Change-Id: Idb1b005f1b5938e8cf329ae06ffaf0d249874db2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-09-01 13:26:30 +02:00
Thiago Macieira
f123212880 RCC: fix zlib compression when --no-zstd was specified
Since we had code to default to zstd as the default algorithm instead of
"Best", we ended up not compressing anything.

[ChangeLog][rcc] Fixed a bug that caused rcc not to compress files with
any compression algorithm if the --no-zstd option was present.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-106012
Change-Id: Ic6547f8247454b47baa8fffd170fddae429f82d2
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
2022-08-31 16:55:00 -03:00
Timur Pocheptsov
0f2397f03d QSslCertificate::toText(): add a file to compare against
With OpenSSL 3.0.5 we see X509_print giving us the text representation
not matching any of previous ones - mostly a question of spaces
and formatting. Let's add a proper version to compare against and
remove useless 0.9.8, 1.0.0, 1.0.1, - we don't support them anymore
and thus QSslCertificate::toText() will never give a match.

Pick-to: 6.4 6.3 6.2 5.15
Task-number: QTBUG-106017
Change-Id: Ida11321c23e74c7313acc682237ab78408cf2803
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-31 21:55:00 +02:00
Timur Pocheptsov
0206eb137f tst_QSslCertificate::pkcs12 - skip the test if OpenSSL version >= 3
leaf.p12 is using RC2 for encryption and it's disabled by default
in openssl v3.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-106017
Change-Id: I4edd0d29506d1e50b2b618b6a00cceeb4b156204
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-31 21:55:00 +02:00
Alexandru Croitor
cd4a3a1dc7 CMake: Fix tst_qlibrary to work on macOS with debug builds
The test expects the helper libraries to contain the .dylib suffix
rather than .so.

Replace glob copying of the libraries (which depends on the underlying
shell) with manual copy calls.
This also ensures the libraries don't contain a _debug postfix in the
file name even in a debug build, which would break the tests.

Amends f8c1909320
Amends 1dff26dd95

Change-Id: I20361c33c4a1b9dd4b5273fcdb8cc79c9f266327
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-31 14:12:00 +02:00
Timur Pocheptsov
267d923ed9 tst_QDtls::verifyClientCertficiate - update certs for OpenSSL v3
Because this version does not seem to like MD5 which old cert was using.

Fixes: QTBUG-106019
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Id354d1e32acb0528685b2788ee9c7326c43397bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-31 13:29:11 +02:00
Thiago Macieira
fe92b08065 QMetaObject: add a new, variadic invoke/invokeMethod/newInstance
[ChangeLog][QtCore][Meta Objects] The QMetaObject::invokeMethod() taking
a method name by string, QMetaObject::newInstance(), and
QMetaMethod::invoke() now support more than 10 arguments.

[ChangeLog][QtCore][Meta Objects] The use of the Q_ARG and Q_RETURN_ARG
macros is now optional with QMetaObject::invokeMethod(),
QMetaObject::newInstance(), and QMetaMethod::invoke(): the type name
will be obtained from the C++ type (the same as QMetaType). The function
qReturnArg() can be used in place of the Q_RETURN_ARG macro. The macros
are still useful in rare conditions where the type was typedef'ed from
its original name.

Change-Id: I36b24183fbd041179f2ffffd17022a2b48c7639b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-30 22:29:07 -03:00
Heikki Halmet
191419e980 Blacklist: tst_QGraphicsAnchorLayout::layoutDirection for Ubuntu 22.04
Task-number: QTBUG-87728
Pick-to: 6.4 6.3 6.2
Change-Id: Ic78a17146c265ffe6baf6f08a0f9c29750bd0d58
Reviewed-by: Liang Qi <liang.qi@qt.io>
2022-08-31 00:39:25 +03:00
Michael Weghorn
8b947bae72 a11y: Don't reassign unique ID to other object right away
For the case that a newly created and registered accessible
interface gets removed again from the cache before another one
gets registered, the next registered interface was
previously assigned the same "unique ID" again, which e.g. breaks
assistive technology when using caching
with AT-SPI, since that relies on the assumption
that the ID is actually unique for each object.
(But here, the new object was using the same object path
as the old one, so data from the old object would be
used for the new one.)

To prevent that from happening, increment the
counter for the next ID to try at the end of
QAccessibleCache::acquireId, so the next time
the method gets called, it doesn't try again
whether the same ID as used previously is
available again.

For consistency, also rename the variable used
for the counter from lastUsedId to nextId.

This also adds a corresponding test case.

Fixes: QTBUG-105962
Pick-to: 6.4
Change-Id: Iddf4f3b35c57895bcfbb623a5377edf8344ab6c2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-30 22:53:09 +02:00
Ivan Solovev
56ec6a392a tst_qguiapplication: guard the usage of deprecated signals
The paletteChanged() and fontChanged() signals were deprecated
in Qt 6.0, but the test was still using them unconditionally.

This patch guards the usage of the deprecated signals with
the usual QT_DEPRECATED_SINCE(6, 0) check, so that the test
can be built and run with QT_DISABLE_DEPRECATED_UP_TO >= 0x060000

This commit amends 68ea9c0227

Task-number: QTBUG-104858
Change-Id: Idb2da6d91afcdb664f325f23ec625947c9a7fac0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-08-30 22:46:35 +02:00
Ivan Solovev
2e69ef6af9 Rest of QtBase tests: port away from deprecated methods
Small changes to fix builds with
QT_DISABLE_DEPRECATED_UP_TO >= 0x060500

Task-number: QTBUG-104858
Change-Id: Ia531a3cee97f13827e36b3d63f28eed879fe9a40
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:35 +02:00
Ivan Solovev
95542b386a tst_qobject: port away from deprecated methods
The patch includes the following replacements:
* QMetaType::type("name") -> QMetaType::fromType<Type>().id()
* QMetaProperty::type() -> QMetaProperty::typeId()
* QVariant::Type -> QMetaType::Type
* qRegisterMetaType<T>("name") -> qResigeterMetaType<T>()
* The static QMetaType::{load,save} methods are replaced with
  non-static versions
* Replace QCOMPARE(property.type(), QVariant::UserType) with
  QCOMPARE_GT(property.typeId(), QMetaType::User), because the
  deprecated type() method was treating each custom type
  (id >= QVariant::UserType) as QVariant::UserType, while the
  typeId() method simply returns the actual id.

As a drive-by: remove unneeded QMetaType registration tests
as we have tst_QMetaType to check it.

Task-number: QTBUG-104858
Change-Id: Ia08e002efdf07ff83366a5193164dba96a956f9a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:35 +02:00
Ivan Solovev
ad12d779cc tst_qvariant: port away from deprecated methods
The most common changes are:
* guard the tests for deprecated APIs with QT_DEPRECATED_SINCE
* QVariant(QVariant::Type) ctor -> QVariant(QMetaType) ctor
* QVariant::type() -> QVariant::typeId()
* QVariant::canConvert(int) -> QVariant::canConvert(QMetaType)
* QVariant::convert(int) -> QVariant::convert(QMetaType)
* QVariant::Type -> QMetaType::Type

Task-number: QTBUG-104858
Change-Id: I00584acb24d29b461faa1115f8f8d36a0b443883
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:34 +02:00
Ivan Solovev
91eec59b87 tst_qmetatype: port away from deprecated calls
The most common changes are:
* Replace QMetaType::type("name") with QMetaType::fromName("name").id()
  or QMetaType::fromType<Type>().id()
* QMetaType::typeName(int) -> QMetaType(int).name()
* QMetaType::typeFlags(int) -> QMetaType(int).flags()
* QMetaType::metaObjectForType(int) -> QMetaType(int).metaObject()
* The static QMetaType::{load,save} methods are replaced with
  non-static versions
* The static QMetaType::{create,destroy,construct, destruct} methods
  are guarded by QT_DEPRECATED_SINCE calls. The tests are also
  extended with non-static calls where they were missing. Fixed
  potential memory-leaks in these tests.

Add separate unit-tests for deprecated APIs and guard them with
QT_DEPRECATED_SINCE

As a drive-by: use nullptr instead of 0 in some places

Task-number: QTBUG-104858
Change-Id: I4b0cdd29bc197c186b835002372240aae3098c33
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-30 22:46:34 +02:00
Mikolaj Boc
337a853cb5 Adapt tests/auto/wasm for batching
Use consistent defines across both tests in the directory

Change-Id: Idd84603135c8c164d09ae41d5faa7ca3a5fc7c3c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-30 22:27:07 +02:00
Thiago Macieira
db64694b4c tst_qlibrary.cpp: remove extraneous _data function
The test function itself is MIA.

Change-Id: Ie4bb662dcb274440ab8bfffd170a06fde5c1cd51
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-30 15:56:46 -03:00
Thiago Macieira
98e21f0979 QVariant: fix conversions of string keys to Q_ENUM that are QFlags<>
Since Qt 6.0, QMetaType stores the name obtained from the C++ compiler,
which means we know a type like Qt::Alignment by its proper, full name
of QFlags<Qt::AlignmentFlag>. However, the meta object records only the
bare name of the enumeration, not the full flags.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105932
Fixes: QTBUG-96185
Change-Id: Ic6547f8247454b47baa8fffd170eab977e306377
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-30 18:56:46 +00:00
Timur Pocheptsov
9540a4eb90 QHttp2Configuration: in QNAM, use old, higher values in flow control
Initially, stream receive window's size was quite significant.
At some point when dealing with a server that did not want
our windows' sizes and was closing the connection (they only
accept 64K) we reduced this size, which ended in a regression
with download speed significantly throttled. We return the old
values (or even more, presuming we have 10 multiplexed streams
and not 100). And also making QNAM consistent with its documentation
(it was not updated).

[ChangeLog][QtNetwork] Stream receive window that HTTP/2 protocol in QNAM is using
increased to 214748364 octets (from the previous 64K) not to throttle download
speed. Clients, working with servers, not accepting such parameters,
must set HTTP/2 configuration on their requests accordingly.

Fixes: QTBUG-105043
Pick-to: 6.4 6.3 6.2
Change-Id: I252b6b5eefe92a7304dad15c67928d5a57d9597f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-30 20:20:38 +02:00
Tor Arne Vestbø
1bc7e9e77b Add QComHelper class for dealing with COM on Windows
Unifies our approach to calling CoInitializeEx and CoUninitialize,
removing a lot of boilerplate in the process, and also fixes a few
bugs where we would incorrectly balance our calls to CoInitializeEx
and CoUninitialize.

The optimistic approach of qfilesystemengine_win.cpp of calling
CoCreateInstance without initializing the COM library explicitly
has been removed, as calling CoInitializeEx should be a noop in
the situation where it's already been loaded.

Change-Id: I9e2ec101678c2ebb9946504b5e8034e58f1bb56a
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-08-29 15:39:34 +02:00
Thiago Macieira
f039147165 tst_QMap: avoid tripping MSVC debug-mode iterator assertions
It does a check to ensure you aren't comparing outside the container.

Fixes: QTBUG-106001
Pick-to: 6.2 6.3 6.4
Change-Id: Ic6547f8247454b47baa8fffd170eef346b7f4f24
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-08-28 11:04:14 -03:00
Tor Arne Vestbø
2436e259ce Deprecate QApplication::setActiveWindow() and mark as internal
The function is used the internal window activation machinery and
should not be called by user code.

Many tests still use this function, and should be ported over to
QWidget::activateWindow(). For now they are using the private
helper in QApplicationPrivate, so that we can progress with the
public API deprecation.

Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-27 20:22:29 +02:00
Michael Weghorn
0c0eadc484 a11y: Prevent one case of losing a11y interface when setting event child
9a369a25dd added a
QAccessibleEvent ctor that takes a QAccessibleInterface*
instead of a QObject*.

Retrieving the QAccessibleInterface* later is done using the
interface's unique ID stored in the m_uniqueId member.

However, the fact that m_uniqueId is a member
of the union alongside with m_child means that setting
a child via QAccessibleEvent::setChild also overwrites
the stored unique ID, which breaks retrieving the accessible
interface later.

Fix this for the case where the QAccessibleInterface has
an associated QObject by assigning m_object in the ctor as well.
This means that a QAccessibleEvent created using either of the two
constructors (the one taking the QObject* and the one taking
the QAccessibleInterface* associated with the object) now behaves
the same.

Fixing the case where there is no associated QObject would require
further changes (e.g. adding a member for the QAccessibleInterface*
or making the m_uniqueId member a separate member instead of having
it in a union with m_child). However, I see no way to do so without
breaking the ABI, so that is left unchanged.

This also adds a corresponding test case.

Fixes: QTBUG-105988
Pick-to: 6.4
Change-Id: I71a548af0277a5034e9e207f066fa3e25c5393f3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-27 03:38:16 +00:00
Ivan Solovev
88974b0a3e tst_qscopedpointer: port away from deprecated APIs
The QScopedPointer::take() call in comparison() test was used to
avoid a double-deletion error, because the test is creating two
QScopedPointer instances referencing the same memory.

Avoid the take() call by providing a custom DummyDeleter and
managing the memory by the extarnal std::unique_ptr.

As the test now has no test-cases for QScopedPointer::take()
calls, create a new test for this deprecated API, and guard
it with QT_DEPRECATED_SINCE checks.

Task-number: QTBUG-104858
Change-Id: Iecc28d44d76c9ce5835e6b1a1df7db30e2a9ca25
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-27 02:07:54 +02:00
Ivan Solovev
378e2e1064 tst_qmap: port away from deprecated APIs
The most common changes are:
* removing the explicit tests for deprecated APIs
* QMultiMap::insertMulti() -> QMultiMap::insert()
* QMultiMap::insert(QMultiMap) -> QMultiMap::unite(QMultiMap)

Add separate tests for the deprecated APIs, and guard them
with QT_DEPRECATED_SINCE() checks.

Task-number: QTBUG-104858
Change-Id: Ifb79212d07f20028d93d75f2b32ec3785cc93b22
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-27 02:07:54 +02:00
Ivan Solovev
aafd2c3fba tst_qstring: port away from deprecated APIs
* QVariant::Type -> QMetaType::Type.
* Guard the test for deprecated fromUtf16(const ushort *) overload with
  QT_DEPRECATED_SINCE check.
* Use fromUtf16(const char16_t *) overload in other places.

As a drive-by: fix formatting in the affected lines.

Task-number: QTBUG-104858
Change-Id: I9fa3a935bca36e97f934f673e2fc07b451c72872
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-27 02:07:54 +02:00
Axel Spoerl
b48364d49b Replace logging category lcQpaDockWidgets in dock widget auto test
Logging category lcQpaDockWidgets was used in both dock widget test
and implementation. This dual use caused static builds to fail.

This patch replaces lcQpaDockWidgets with a test specific logging
category in tst_QDockWidget.

Pick-to: 6.4 6.3 6.2
Change-Id: I02cdfdaee9c1c1840126d803139b3d271aeac236
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-26 22:27:50 +02:00
Thiago Macieira
7deb49d886 QMetaObject: fix the consistency check for forward-declared builtins
For those, moc does know their type ID, and yet they may be still
forward-declared in the C++ side, so the meta object may have recorded a
null pointer in the metatype array.

Fixes: QTBUG-105832
Change-Id: Ic6547f8247454b47baa8fffd170dae07c0813dc7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-26 19:50:48 +02:00
Marc Mutz
24675d1a94 tst_QDir_10000: add sorted_byName benchmark
Pick-to: 6.4 6.3 6.2
Change-Id: Ic30a6353c356f6613f2ef3720b99ebb3b0a7968e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-26 17:50:47 +00:00
Axel Spoerl
0c54ac20eb Add QDockWidget save & restore auto test
Implement auto test for (de)serialization of dock widget properties.
Test settings compatibility by importing a hard coded byte array.
Test serialization format and sequence by comparing expected and real
serialization output.
Test dock widget closing behavior (QTBUG-103474) to ensure that
no closing inconsistency is caused by serialization incompatibility.
Extensively document/comment the test to ensure failures can be easily
interpreted in the future.

Task-number: QTBUG-103474
Change-Id: I3c1589c2c291b2ed56334d09b85536d4c7388f92
Pick-to: 6.4 6.3 6.2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-26 17:08:04 +00:00
Ivan Solovev
b057e32dc4 Port tests away from using q{Set}GlobalQHashSeed
These functions are marked as deprecated in future Qt releases.

Task-number: QTBUG-104858
Change-Id: I25d2932455d8c9e3e2d722b1c48fc2cfa2d1e679
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-26 14:15:24 +02:00
Ivan Solovev
804172f23c tst_qdtls: guard usage of the deprecated enum values
Guard the test that checks the deprecated protocol versions

Task-number: QTBUG-104858
Change-Id: I1b76e08d8fc985abf758bf86198fe3d33e5497d4
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-26 14:15:24 +02:00