Commit Graph

14245 Commits

Author SHA1 Message Date
Mikolaj Boc
11f12521bc Resolve window focusing problems on WASM
- Moved the modal window resolution to
QWasmWindow::requestActivateWindow so that multiple async activation
events are not issued in unpredictable patterns.
- Request activation on added windows and on stack top in case of
window removal

Pick-to: 6.4
Change-Id: I6f02cf1b7e83abb7961caf311ffc83e91c8bf810
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-24 17:50:25 +02:00
Axel Spoerl
854cb55987 Make QHeaderView restore state from different stream versions
If restoring a QHeaderView state from a data stream with version Qt_5_0,
check alignment and resize mode properites for out-of-bound values.

If out of bounds, try QDataStream version Qt_6_0, which is used by KDE
apps compiled with 5.15.2 or 6.2.3.

QFileDialog stores settings in the same settings file across different
Qt versions, using different QDataStream versions. That makes
QFileDialog vulnerable to the issue (QTBUG-104962). A respective auto
test is added with this patch.

Fixes: QTBUG-104962
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104425
Change-Id: I666207fca7ab837ad27a247e504a40757ee8afab
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-24 14:08:18 +00:00
Michael Weghorn
1f35be2f38 tests: Fix tst_qprinterinfo for CUPS printer instances
CUPS has a feature called printer instances that allows saving
different sets of default options for a single print queue,
s. section "Creating Saved Options" at [1].

A printer instance can be set up using e.g.

    lpoptions -p printer/instance -o name=value

The printer instance is then listed with the print
queue name and the instance name separated by a slash
in the 'lpstat -e' output.
Qt also supports CUPS printer instances and displays
them using the same as printer names.

However, tst_QPrinterInfo::getPrintersFromSystem was
previously truncating the printer name at the slash,
so the comparison of printer names on a system that
has CUPS printer instances set up would fail e.g. as follows:

    ********* Start testing of tst_QPrinterInfo *********
    Config: Using QtTest library 6.5.0, Qt 6.5.0 (x86_64-little_endian-lp64 shared (dynamic) debug build; by GCC 12.1.0), debian unknown
    PASS   : tst_QPrinterInfo::initTestCase()
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() Test believes Default Printer                              =  "PDF"
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() QPrinterInfo::defaultPrinter() believes Default Printer    =  "PDF"
    QDEBUG : tst_QPrinterInfo::testForDefaultPrinter() QPrinterInfo::availablePrinters() believes Default Printer =  "PDF"
    PASS   : tst_QPrinterInfo::testForDefaultPrinter()
    QDEBUG : tst_QPrinterInfo::testForPrinters() Test believes Available Printers                              =  QList("Canon_MX390_series", "PDF", "PDF", "PDF-5cm-margins", "dummy", "dummy-ricoh-c3000", "tofile-hp-officejet-8600", "tofile-ricoh-aficio", "tofile-ricoh-mufu", "tofile-samsung-m2875", "tofile-test-tdf106963", "tofile-xerox-phaser-6510")
    QDEBUG : tst_QPrinterInfo::testForPrinters() QPrinterInfo::availablePrinters() believes Available Printers =  QList("Canon_MX390_series", "PDF", "PDF-5cm-margins", "PDF/myinstance", "dummy", "dummy-ricoh-c3000", "tofile-hp-officejet-8600", "tofile-ricoh-aficio", "tofile-ricoh-mufu", "tofile-samsung-m2875", "tofile-test-tdf106963", "tofile-xerox-phaser-6510")
    FAIL!  : tst_QPrinterInfo::testForPrinters() Compared values are not the same
       Actual   (qtPrinters.at(i))  : "PDF-5cm-margins"
       Expected (testPrinters.at(i)): "PDF"
       Loc: [/home/michi/development/git/qt5/qtbase/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp(232)]

Fix this by adding the slash character to the regex.

[1] https://www.cups.org/doc/options.html

Change-Id: Id0dc27a8b4c592847ed364cebf277e988039cad4
Reviewed-by: Albert Astals Cid <aacid@kde.org>
2022-08-24 14:20:14 +02:00
Lucie Gérard
32df595275 Change the license of all CMakeLists.txt and *.cmake files to BSD
Task-number: QTBUG-105718
Change-Id: I5d3ef70a31235868b9be6cb479b7621bf2a8ba39
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-23 23:58:42 +02:00
Axel Spoerl
7c61eb101d Revert Q_DECLARE_EXPORTED_LOGGING_CATEGORY in tst_qdockwidget
Q_DECLARE_EXPORTED_LOGGING_CATEGORY is available from 6.5 only, hence
cherrypicking this solution fails.

Change-Id: Ib3351a8846bb5cf6047cd2d13c9f7cd242df9c93
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-23 20:49:47 +02:00
Tor Arne Vestbø
1ecfc4101c tst_qgraphicswidget: Avoid redeclaration of Size from MacTypes.h
If an included header brings in MacTypes.h it will cause issues,
so rename the enum to be on the safe side.

Pick-to: 6.4 6.3 6.2
Change-Id: I29ec795be74a65d4f2267d8121a514bf192cf969
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-21 14:40:38 +02:00
Volker Hilsheimer
3be99799a6 Don't access QObjectPrivate::declarativeData unguarded
The QObjectPrivate::declarativeData member is stored in a union with
currentChildBeingDeleted. The QObject destructor always sets the
currentChildBeingDeleted member of the union. It also sets the
isDeletingChildren bool, which is the only way to find out which union
member we can safely access.

While the QObject destructor is deleting children and isDeletingChildren
is set, we must not access the declarativeData member of the union.

Add a test case that initializes the function pointers for the
declarative handlers and constructs a situation where an object
emits a signal while it is destroying children.

Fixes: QTBUG-105286
Pick-to: 6.4 6.3 6.3.2 6.2 5.15
Change-Id: Iea5ba2f7843b6926a8d157be166e6044d98d6c02
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-20 03:55:12 +02:00
Mårten Nordheim
50f8a9578d QSslServer: Re-enable read notifications when a client times out
Otherwise new clients will not be handled when they try to connect

Amends 29a1fe72a0

Pick-to: 6.4
Change-Id: Ifff052d1bf27682df2782faa285a257c9b41d86f
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-19 23:53:11 +02:00
Ivan Solovev
3226c82740 Rename QT_DISABLE_DEPRECATED_BEFORE -> QT_DISABLE_DEPRECATED_UP_TO
The new name describes the behavior in a better way.

[ChangeLog][Build System] The QT_DISABLE_DEPRECATED_BEFORE macro is
renamed to QT_DISABLE_DEPRECATED_UP_TO. The old name is deprecated, but
is still recognized if it is defined during configuration and the new
name is not defined.

Task-number: QTBUG-104944
Change-Id: Ifc34323e0bbd9e3dc2f86c3e80d4d0940ebccbb8
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-19 23:52:05 +02:00
Tatiana Borisova
6a3509baa2 Put code related to timezone functionality under QT_CONFIG(timezone)
Pick-to: 6.4 6.3
Change-Id: I0d1573dbb4ae4f9740fc19546950ae4316aa4c0c
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-18 18:05:09 +00:00
Assam Boudjelthia
78c8561658 Android: skip tst_qvulkan vulkan11() and vulkanWindowGrab()
This fails on Android 12 in CI.

Task-number: QTBUG-105739
Pick-to: 6.4 6.3 6.2
Change-Id: Ibf3deb6b84564f12b5172f2522875fe70f8ce87b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 10:52:14 +00:00
Assam Boudjelthia
0fb59d68f7 Android: skip tst_qopengl::fboRenderingRGB30()
This fails on Android 12 in CI.

Task-number: QTBUG-105738
Pick-to: 6.4 6.3 6.2
Change-Id: I94fcefae3d88087cd96f4043b015f9469ed629a9
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 10:52:10 +00:00
Assam Boudjelthia
d1e97ada4e Android: skip tst_QPluginLoader::loadSectionTableStrippedElf()
... on Android 7+ because Android linker doens't accept missing or
bad section headers.

* https://android.googlesource.com/platform/bionic/+/refs/heads/oreo-r2-
release/android-changes-for-ndk-developers.md#missing-section-headers-
enforced-for-api-level-24

Pick-to: 6.4 6.3 6.2
Task-number: QTQAINFRA-4748
Change-Id: I37fcf7995bbfe7d258b92f7425baf4722b0ad4ab
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 13:52:06 +03:00
Assam Boudjelthia
cf4f147c23 Android: tst_QByteArray::base64_2GiB() times out or gets terminated
Android kills this test case which tries to use too much memory,
or it times out.

Pick-to: 6.4 6.3 6.2
Task-number: QTQAINFRA-4748
Change-Id: Ifce92533d50f4c463ee10fe80e7654ad16172a35
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 13:52:02 +03:00
Assam Boudjelthia
7c917a6dbf Android: skip crahsing tst_QFile's unixPipe() and socketPair()
... on Android 12.

Task-number: QTBUG-105736
Pick-to: 6.4 6.3 6.2
Change-Id: I1a67ef34e2f3918d96bdcfdcde48c1c14fe01c2e
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 13:51:58 +03:00
Assam Boudjelthia
2c6e71e562 Android: fix Android filedialog and completer tests
* https://developer.android.com/training/data-storage/use-cases#opt-out-
in-production-app

Pick-to: 6.4 6.3 6.2
Task-number: QTQAINFRA-4748
Change-Id: If6abb48b730b9b33807f5f6648e1360defc090a6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-08-18 10:51:54 +00:00
JiDe Zhang
a6b55b3c46 Allow specify distance to plane for QTransform
The default camera to plane distance is 1024, when rotating a big image
along the x or y axis, some areas of the screen may move above the
camera, causing the rotation to fail. A new rotation interface has been
added to allow users to specify the distance from the camera to the
plane themselves when rotating the QImage. Also, this support has been
added to QMatrix4x4::projectedRotate.

[ChangeLog][QtGui][QTransform] Added overloads to rotate() and
rotateRadians() that allow specifying of the distance to the rotation
plane.

Fixes: QTBUG-105088
Change-Id: I81f629916ddd9b6ab84e0282191e4284a88a85f5
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-08-18 10:40:42 +08:00
Volker Hilsheimer
371214dea7 Remove network dependency for tests with UNC paths
Windows VMs are provisioned with shared folders that are available as

\\${COMPUTERNAME}\testshare(writable)

so we don't need to access a remote SMB server over network anymore just
to test whether our string-parsing code handles UNC paths correctly.

Add a QTest::uncServerName() helper function to the shared filesystem.h
header and use that instead of QtNetworkSettings::winServerName. The
latter is now only used in tst_NetworkSelfTest::smbServer().

Pick-to: 6.4
Change-Id: Id0da66369ad0f4a980d612de2a31a391f1192253
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-17 23:48:00 +02:00
Mårten Nordheim
1ee75e4740 QSslServer: Make sure maxPendingConnections applies to all sockets
Not just the ones we added to the pending sockets list

Pick-to: 6.4
Change-Id: I0a0016fe39df7ca2fc3f0c4e4111195bc6d90198
Reviewed-by: Konrad Kujawa <konrad.kujawa@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-17 21:55:19 +02:00
Mårten Nordheim
29a1fe72a0 QSslServer: Implement handshake timeouts
If a client doesn't send any data then we would leave the socket open
for as long as it needed, wasting resources. Add timeouts to limit the
amount of time this can happen for.

Since there is a limit on number of sockets that the server will have
queued, having idle sockets stick around forever is a vector for ddos.

Pick-to: 6.4
Change-Id: Ida6251c92c625eeadf2065861b840b14255654b8
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-17 21:55:19 +02:00
Mårten Nordheim
1b68e0b717 QSslServer: Check that first byte is ClientHello
SecureTransport ignores any content that comes in until it is large
enough to be a handshake. So a plaintext client may be left hanging
while it is waiting for a response.

Pick-to: 6.4
Change-Id: I501ae61d89d516765c7ba5f0d916d9246fde5d4d
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-17 19:55:18 +00:00
Alexandru Croitor
9e3e167223 CMake: Add simple widgets qmake iOS build test
Build a simple widgets qmake project when targeting iOS in the CI.
This ensure we don't introduce basic regressions in the .pri / .prl
file generation.

Make sure to target the ios simulator, so we don't require any
code signing or provisioning profiles.

Pick-to: 6.4
Fixes: QTBUG-96058
Change-Id: I1a5564e838a5ce3cac89a37a5a4ddee74d3400f3
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-17 21:21:57 +02:00
Sona Kurazyan
e684c25b85 QDomDocument: deprecate old setContent() overloads in favor of new ones
And use the new overloads in examples and tests.

[ChangeLog][QtXml][QDomDocument] Deprecated the old setContent()
overloads in favor of the new ones that take ParseOptions and
ParseError.

Task-number: QTBUG-104507
Change-Id: I61b37eba2fe3002c03bddc90f6877676d539f7ec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-17 17:02:27 +02:00
Morten Sørvig
4d6decf628 wasm: always build asyncify tests for eventloop_auto
Add a runtime test for asyncify availability; skip tests
if asyncify is not available. Add new build target which
builds with asyncify enabled.

Change-Id: Idaeff0a24aa01525927b012af2a0ba135c7839c3
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-17 04:52:46 +02:00
Morten Sørvig
ad0cb1f32d wasm: add "skip" support to qtwasmtestlib
We're not looking to skip faulty tests, but there are cases
where we would like to indicate that a test function exists
but can't run because some precondition is not met.

Pick-to: 6.4
Change-Id: Ifaaafcfa7a55beaaf56d8b25fabbe3dc2566350f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2022-08-17 04:52:46 +02:00
Morten Sørvig
f347682fd5 wasm: include asyncify support unconditionally
Emscripten's option for enabling asyncify (-sASYNCIFY) is a link-time
option, which means there is no requirement to have a separate asyncify
build, at least for static builds.

Replace the current QT_HAVE_EMSCRIPTEN_ASYNCIFY compile-time option
with a run-time option which checks if the asyncify API is available.

Keep support for configuring with "-device-option QT_EMSCRIPTEN_ASYNCIFY=1"
for backwards compatibility and for the use case where want asyncify
support to be on by default for a given Qt build.

Enable asyncify for the asyncify_exec example.

Pick-to: 6.4
Change-Id: I301fd7e2d3c0367532c886f4e34b23e1093646ad
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-17 04:52:46 +02:00
Alexandru Croitor
cf3535fdf2 CMake: Add manual test for various iOS asset handling
Includes:
- setting a custom Info.plist
- Bundling non-image assets
- Bundling image assets using asset catalogs
- Bundling app icons
- Bundling a launch screen

Projects added for both qmake and CMake.
The executable uses testlib to check that non-image assets,
icons and asset catalogs were successfully bundled upon deployment
to a device.

Task-number: QTBUG-104519
Change-Id: Iaab6112e31e1098dcd2548e18b58bed5b64e6f83
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-17 01:05:45 +02:00
Dimitrios Apostolou
753c352af0 Unblacklist tests that are no longer flaky
Couldn't reproduce flakiness on OpenSUSE KDE/X11 and can't see any
history of flakiness in the last 3 months in our testresults database.

Task-number: QTBUG-62967
Task-number: QTBUG-63262
Change-Id: Id50291798eda922283e04b45205ae9105e9fdab2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-17 01:05:45 +02:00
Dimitrios Apostolou
7524a36a26 Stabilize test by not activating window
Window activation is not working reliably on X11 when combined with
X11BypassWindowManagerHint, see QXcbWindow::requestActivateWindow().

The test itself counts repaints, so qWaitForWindowExposed() shouldn't be
needed.

This way we don't need to QSKIP() the test if window activation fails.

Fixes: QTBUG-98921
Change-Id: I849b7261c757fb7cbcde73f11bbe1a74a862cb9c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-17 01:05:45 +02:00
Dimitrios Apostolou
74f3bc263a Update BLACKLIST for tst_qgraphicsview
Removed entries that do not reproduce on OpenSUSE and that are no
longer flaky in our CI according to our testresults statistics database.

Adjusted entry for resizeAnchor testcase which has been seen flaky in
RHEL-8.4 and cursor2 which is very flaky on macOS.

Task-number: QTBUG-105249
Task-number: QTBUG-105247
Change-Id: I3e258f81d6bbf540a4b3dec763fdfd4bdc511847
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-17 01:05:45 +02:00
Dimitrios Apostolou
228ee98025 Unblacklist tests that are no longer flaky
Can't reproduce in OpenSUSE, and no flakiness has been seen in the past
6 months in our testresults statistics database.

Task-number: QTBUG-63260
Change-Id: I465aa4b9f82726e9685f64b0dc235d3235c4bd9c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-17 01:05:44 +02:00
Dimitrios Apostolou
dff9fa2ee1 Fix testcase that fails when run individually
Executing the tst_qgraphicsitem::sorting() testcase individually always
fails on my KDE/X11 desktop. The window never seems to have focus and
the call to qWaitForWindowActive() returns error after a few seconds.

It seems qApp->setActiveWindow(&view) never succeeds in giving focus to
the window containing the widget.

Fixes: QTBUG-105221
Task-number: QTBUG-74760
Change-Id: I148dab09d0fb592376b3902e4ed10799f9a52274
Done-with: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-08-17 01:05:44 +02:00
Thiago Macieira
e163c49435 qdbusxml2cpp: remove the old "In"-for-signal compatibility code
This led to an infinite recursion in case the annotation was completely
missing. Instead of trying to fix that, I'm simply implementing the
"### Qt6" request from c62f717226 .

[ChangeLog][qdbusxml2cpp] Removed the old compatibility code that
accepted "In" annotations for signal argument names, introduced in Qt
5.8.

Pick-to: 6.4
Fixes: QTBUG-104722
Change-Id: Ie4bb662dcb274440ab8bfffd1709bfc3daf0846d
Reviewed-by: David Faure <david.faure@kdab.com>
2022-08-16 16:05:25 -07:00
Mikolaj Boc
1007964f2d Maintain the window z-order properly in wasm compositor
The old stack structure used to keep track of windows has been improved
to conform to the actual windowing assumptions: there shall be one root
window, which is always at the bottom. The first created window
immediately becomes the root window. Should the root window be removed,
all windows are non-root, i.e. any of them can become the top-level window

Fixes: QTBUG-105094
Pick-to: 6.4
Change-Id: Ic553244fa9f5bc3ee590b702935e66cfc62d5f8f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-16 16:08:38 +00:00
Laszlo Agocs
2de14b81a9 rhi: tst_qrhi: Check for OpenGL cap on the platform
Running tst_qrhi -platform eglfs will pass on RPi4 / Mesa 22.
This does not test Vulkan of course since the platform plugin cannot
create a Vulkan instance.

Running tst_qrhi -platform vkkhrdisplay will enable Vulkan but will
still try OpenGL since the autotest does not query the platform
integration about OpenGL support. Make this nicer by skipping most of
the GL test if the platform integration we have cannot handle OpenGL
stuff anyway.

For some tests the data-driven approach has to be removed since doing
QFETCH without any rows will crash. These two OpenGL-specific tests
now check OpenGL support directly and QSKIP if needed.

While we are at it, fix up the Vulkan instance API version as well.

Pick-to: 6.4
Change-Id: I2891c04540bc2dfd0ccf475629bd23542bff15f5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-16 16:00:15 +02:00
Edward Welbourne
0ed8987078 Update QTimeZone benchmark's list of tested zones
It purports to be a list of those named in QDateTime's tests, but was
a bit out of date. In the process, sort them into somewhat coherent
order (to make it easier to verify whether one is missing next time I
check) and reformat.

Pick-to: 6.4 6.3 6.2
Change-Id: I16e7ded6f8b00e226513bd06d6174a79f7a0c675
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-16 15:02:22 +02:00
Marc Mutz
b5d5385201 tst_qbytearray: remove qCompress_data for QT_NO_COMPRESS
The _data function is useless without its test function (and it's not
used in other _data functions).

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I7aa6006ed1a9d89008577b750af4ea717dae237f
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-08-15 23:02:32 +02:00
Eskil Abrahamsen Blomfeldt
360f1547f7 Fix QFontDatabase::hasFamily() for ambiguous families
If a font family has several instances from different foundries,
we disambiguate this by adding the foundry name in brackets behind
the family. But QFontDatabase::hasFamily() would only check for
families().contains(familyName). So if the database contains e.g.
Foo [Bar] and Foo [Baz] then a check for hasFamily("Foo") would
fail.

So we need to actually check for the family name instead. In
doing this, we also skip the extra step of building the list
and then searching it, but just go directly to the source.

This removes the BLACKLISTing of Ubuntu and also introduces a
QSKIP on Unix-based platforms without fontconfig, since there
is no way to know which default fonts are acceptable on those
platforms.

Pick-to: 6.4
Fixes: QTBUG-86967
Change-Id: Id8ad80a1671daf1c14fbad8bb8f4c51ee1c59709
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-15 18:23:43 +02:00
Laszlo Agocs
5eacc974c7 rhi: d3d11: Enable tessellation and geometry with some caveats
The caveat being having to manually create HLSL versions of the hull,
domain, and geometry shaders in parallel with the Vulkan GLSL ones,
while keeping the interfaces intact (stage inputs and outputs, cbuffer
layouts, binding points/registers). This is not always trivial but
typically doable in not very complicated case after inspecting the
SPIRV-Cross-generated vertex/fragment code in the .qsb files. Once
written, the HLSL files can be injected into a .qsb file with qsb -r.
or the corresponding CMake syntax. Conceptually this is no different
from how samplerExternalOES support is implemented for Multimedia.
(there the problem is that the shaders cannot be compiled to SPIR-V
to begin with, here it is that we cannot translate from SPIR-V, but
in the end the workaround for both problems is effectively the same)

The manual tests demonstrate this, both the tessellation and geometry
apps work now with D3D out of the box.

On the bright side, the implementation here in the the D3D backend of
QRhi does not need to know about how the shaders got there in the
QShader. So none of the implementation is dependent on this manual
process. If some day qsb would start translating to these kind of
shaders as well, it would all still work as-is.

Change-Id: I32d9ab94e00174e4bd5b59ac814dfedef9f93ad1
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-15 10:51:17 +02:00
Edward Welbourne
45cbb1e31e Fix DeferredFlag implementation for QTestEventLoop
As discovered in the expanded testing of QTRY_COMPARE() using the same
class, the timer needs a context object and a slot to call.
This amends commit 35ad157d88

Pick-to: 6.4 6.3
Task-number: QTBUG-104441
Change-Id: I41fc23de84ce8c7d6608db0005276a2071974494
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
54bcefb25c Test QTRY_COMPARE() and expand testing of QTRY_VERIFY*()
In the process, simplify the latter while adding some actual
time-variation for the QTRY_* loop to navigate round - based on the
extendedcompare test's ClassWithDeferredSetter. Testing remains
primitive, but is at least a bit more thorough.

Pick-to: 6.4
Change-Id: I40be8fb485f3f18f0a4f4bc62ad36cccac691979
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-12 20:32:30 +02:00
Edward Welbourne
f5840692b0 Remove the stale expected_crashes_[345].txt
These contain output only ever sent to stderr, which tst_selftests no
longer looks at; it merely verifies stderr is empty for all tests
except those expected to produce stderr output, and ignores the stderr
output for these last.

Change-Id: I50fee445d84c2d125e6db5303fc389e87746455e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-12 20:32:30 +02:00
Thiago Macieira
6234182d82 QMetaType: don't use global relocations to the lambdas and structures
The way the Qt 6.0 QMetaTypeInterface was designed, using a static
inline variable in a template, would normally require the linker and
dynamic linker to merge all copies and choose a single copy as the
official one. But because of hidden visibility and of Windows DLLs,
QMetaType already copes with multiple copies NOT getting merged. So we
may as well ask the linkers not to bother and use simpler, local
relocations to find those symbols.

They are all supposed to still be equivalent and it's an ODR violation
if they're not.

The Apple ld64 linker complains if you use this type of global
relocation:

 ld: warning: direct access in function
  [...]
   to global weak symbol
   'QtPrivate::QMetaTypeInterfaceWrapper<int>::metaType'

Fixes: QTBUG-93471
Pick-to: 6.3 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f98a10aa719434
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-12 11:32:29 -07:00
Thiago Macieira
985e24dd5f QMetaType: add a test to confirm that types are equal across libraries
Because of the template shenanigans. This is just to make sure.

Pick-to: 6.4
Change-Id: Id0fb9ab0089845ee8843fffd16f989e7d555894f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-12 11:32:29 -07:00
Mikolaj Boc
f8e460b915 Use the local file APIs to save/load files on WASM
QFileDialog::saveFileContent, QFileDialog::getOpenFileContent are now
using local file APIs to access files on any browser that passes a
feature check.
The feature is thoroughly tested using sinon and a new mock library.

Task-number: QTBUG-99611
Change-Id: I3dd27a9d21eb143c71ea7db0563f70ac7db3a3ac
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-08-12 20:32:29 +02:00
Dimitrios Apostolou
d68da61564 Wait for window focus instead of expose event
This fixes the flakiness seen in OpenSUSE KDE/X11 desktop.

Fixes: QTBUG-70590
Task-number: QTBUG-105177
Change-Id: I7c2431e58b2a60ea04e26d4e70c0f2867d544ff2
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2022-08-11 19:09:09 +02:00
Dimitrios Apostolou
5b2b30a9c7 Try to stabilize window activation on macOS
Use activateWindow() that is documented as the right way to raise a window.

Task-number: COIN-892
Change-Id: Ic9aadee0d3a526fd8e46e5b1099b5b0861700207
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-10 21:44:40 +02:00
Dimitrios Apostolou
c1e8c99464 Test is stable on OpenSUSE, un-blacklist it
Task-number: QTBUG-74760
Change-Id: I78ca3779407d1076a11d0a948b61f4438d1ab4cc
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-10 21:44:40 +02:00
Dimitrios Apostolou
1aff079db5 Test is no longer flaky, unblacklist it
I can't reproduce the test failing after hundreds of iterations on
OpenSUSE, and the test hasn't flaked at all in our CI in the last 6
months according to our dashboards.

Fixes: QTBUG-70612
Change-Id: I2397f3db5caf97f674de7d75fd99bd14c14166a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-10 21:44:39 +02:00
Dimitrios Apostolou
6ee0c79352 Test is not flaky any longer
I can't reproduce the issue after hundreds of iterations on OpenSUSE,
and the test hasn't flaked at all in the last 3 months according to our
dashboards.

Task-number: QTBUG-66371
Change-Id: I9c4daf851e09fbcb47a6ab39418e7b213ccd9dfe
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-08-10 21:44:39 +02:00
Sami Shalayel
cec3b3b4f9 Remove assertion from ownMethodIndex that breaks tests
ownMethodIndex works for all kind of methods, also for constructors.
Therefore, remove the assertion there (that checks for non constructors)
and add a test in qtbase so it does not happen again.

The test broken by the assertion is in qtdeclarative:
tst_QJSEngine::newQMetaObject().

Also rename QMetaMethodPrivate::ownConstructorIndex() to
ownConstructorMethodIndex() as the previous naming implied that
ownMethodIndex() could not be used for constructors.

amends b73ab954df

Task-number: QTBUG-105360
Change-Id: I0244993ed79bee055645b5443f5d02e1c089a6c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-10 00:48:31 +02:00
Thiago Macieira
395c9ac731 Tests: remove #define COMMA
Those were workarounds to passing a comma to a macro, but there are ways
around it. The simplest is to just use variadic macros; another, which
has been applied to Q_DECLARE_METATYPE for a long time, is to define an
alias to the thing you're trying to use.

Change-Id: Ie4bb662dcb274440ab8bfffd17097fbf0c53eabc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-09 12:13:26 -07:00
Joerg Bornemann
9ce5709fb1 CMake: Support big resources in qt_add_resources
[ChangeLog][CMake] The target-based variant of qt6_add_resource gained
the option BIG_RESOURCES. This can be used instead of
qt6_add_big_resources, which is not target-based.

Fixes: QTBUG-100268
Change-Id: Ib3fa783cbfbfd10f59c2f952bc88508a91f25e26
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-08-09 15:21:52 +02:00
Eskil Abrahamsen Blomfeldt
f49d35084c Wayland: Remove XFAIL after underlying bug was fixed
The intialSize bug has been fixed in Qt Wayland Client, and thus
this test will now start XPASSing.

Pick-to: 6.4
Task-number: QTBUG-66818
Change-Id: I4b9cb8bd9306a67f04295eb23f09574dad0e97f7
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
2022-08-09 12:57:13 +02:00
Edward Welbourne
35ad157d88 Add some testing of QTestEventLoop
Fairly minimal for now, just enough to verify a bug and serve as the
sign of success when it's fixed. Tests fail in ways they shouldn't,
for now; see expected_eventloop.* for details, notably "Earlier test
failed to clean up" messages.

Pick-to: 6.4 6.3
Task-number: QTBUG-104441
Change-Id: I59be4aa5f21fed23b19a0593a8c2f6c9956507df
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2022-08-08 20:49:03 +02:00
Janne Juntunen
dfaefa6c5e tst_qimage: skip exifReadComments when the feature is not active
We need to skip the exifReadComments test case if reading text from
image has been configured off, like in webOS's Yocto recipe for QtBase.

Fixes: QTBUG-105393
Pick-to: 6.4
Change-Id: If45872ca7ed26620fa38bc6b47132363d661acdc
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-08-08 20:38:40 +03:00
Edward Welbourne
a79de46ac5 Don't skip QDoubleConverter's digit-count check for non-whole bound
Using convertDoubleTo() to get a whole number, from which to determine
the number of digits we're allowed before the fractional part, fails
if the double isn't a whole number, which lead to the skip being
checked. Use qFloor() of the double (as this should have as many
digits as the double had before its decimal point, which is what we
care about; qCeil() might round up to a power of ten).

This amends commit ff6d2cb0d5

Fixes: QTBUG-105341
Pick-to: 6.4 6.3 6.2
Change-Id: I4e0105d4602682c59e9830ec9a37556c96db884e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-08 19:38:40 +02:00
Morten Sørvig
964765f686 wasm: add event loop auto test
Add basic tests for timers and event processing, for
different use cases such as on the main thread, on
a secondary thread, and with asyncify.

Pick-to: 6.4
Change-Id: Ie0f82b5de97f639867b1e65dbb0ab8b11db86f85
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-08-08 18:14:28 +02:00
Allan Sandfeld Jensen
fa4db87706 Remove blacklist of tryAcquireWithTimeout on Windows
Hasn't failed on Windows in months

Change-Id: Id14eaead667dfba93807592a7e0cb4da7f91f16f
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-08-07 16:05:03 +02:00
Marc Mutz
5ff7163796 qputenv: port to QByteArrayView
The vast majority of in-tree users pass simple and short C string
literals as the value. By porting to QByteArrayView, we document that
we'll accept non-NUL-terminated data, and do the NUL-termination
internally, using SSO'ed std::string, saving memory allocations in the
common case of short strings.

I didn't bother to check which direction std::string takes for
nullptrs these days (there was a change accepted in that area for
C++20 or 23), so play it safe and protect against them.

Follow-up to

Task-number: QTBUG-105302
Change-Id: I2369acc62f1d5cbc26135396cfe0602d8c75300c
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-06 14:21:46 +00:00
Liang Qi
5b62970b94 tests: add a textfield in qt-client-widget
To test drag and drop.

Change-Id: I609c7edebea3af7763ec53fdbb7257a4b89371b9
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
cef9cbdd52 tests: make xembed/qt-client-raster better
Pick-to: 6.4 6.3 6.2 5.15
Change-Id: Id45bcfb92eb24c4455cf50497e28312eb87e0f9a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
a0ec35d5f2 tests: make xembed/qt-client-widget better
See also QX11EmbedWidget::QX11EmbedWidget() in src/gui/kernel/qx11embed_x11.cpp in qt4.

https: //github.com/qt/qt/blob/4.8/src/gui/kernel/qx11embed_x11.cpp#L475-L477

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I47504a2d8f3e33c367f092d01ee5d7e1b16b5106
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Liang Qi
aef55501bc tests: replace gtk-embedder.py with a gtk3 app
All linux CI machines have gtk3 installed. And Python GTK things
are too complicate to setup.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I3c0d967f61aebea508784df79569b9d0064f66e2
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-06 01:24:41 +02:00
Axel Spoerl
8e9fdfec0a Declare logging category exported in tst_QDockWidget
The logging category lcQpaDockWidgets was explicitly declared in
tst_QDockWidget. That failed to complile on static builds.

This patch replaces the explicit declaration with
Q_DECLARE_EXPORTED_LOGGING_CATEGORY(lcQpaDockWidgets, Q_WIDGETS_EXPORT)

Pick-to: 6.4 6.3 6.2
Change-Id: I1cad0e672313be84297eeddf992f6cafe9a35977
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-08-05 23:37:17 +02:00
Marc Mutz
15422d191f qputenv: defend against non-NUL-terminated QByteArray values
The old code assumed that a QByteArray's data() is always
NUL-terminated. Due to the conflation of owners and non-owners in
QByteArray (but also in case we ever get efficient substringing), this
is not always the case, e.g. QByteArray::fromRawData() does not ensure
NUL-termination.

From QString::utf16(), we learn that the condition to check for is
QArrayData::isMutable(). After working around the fact that
QByteArray::data_ptr() doesn't exist for const QBAs and that empty
QBAs always refer to QByteArray::empty_, which is !isMutable(), we can
detect this situation and re-allocate without introducing new API.

This is the fix for Qt ≤ 6.4. For Qt 6.5, we'll port the function to
QByteArrayView.

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-105302
Change-Id: I3416535ab09d601e0e87b2767f2c024ba1217e64
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-05 19:42:05 +02:00
Alexandru Croitor
6423a657c7 CMake: Fix mockplugins test not to fail in a non-prefix build
Explicitly running the install step would fail in a non-prefix build.
Do it conditionally on the no_prefix feature.

Pick-to: 6.4
Change-Id: I78cd63f51c499a0df451b08290c6dfc84e52666c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-05 18:10:00 +02:00
Marc Mutz
a17d6f869b tst_QFocusFrame: fix -Wparantheses
Says Clang 10:

tst_qfocusframe.cpp:73:28: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]
tst_qfocusframe.cpp:73:28: note: place parentheses around the assignment to silence this warning
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                (
tst_qfocusframe.cpp:73:28: note: use '==' to turn this assignment into an equality comparison
    QTRY_VERIFY(focusFrame = window.findChild<QFocusFrame *>());
                           ^
                           ==

Amends f1812aad89.

Pick-to: 6.4 6.3 6.2 5.15
Change-Id: I3920ab0da725b76fb6c19bbc7cde7920f351af4a
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-08-04 23:33:36 +02:00
Øystein Heskestad
15368fb31b Add Latin 1 case-insensitive Boyer-Moore searcher
The std::boyer_moore_searcher is buggy for older verions of Microsoft's
STL, and missing in AppleClang's libc++ with an inefficient fall back.

Fixes: QTBUG-100236
Change-Id: Ic3cc916946546d2ef78456cd15e1425d957b989d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-08-04 23:12:39 +02:00
Sona Kurazyan
26a73e1b31 QDomDocument: Add a way to enable spacing-only text nodes
Added a parse option that can be passed to setContent(), to specify that
spacing-only text nodes must be preserved.

[ChangeLog][QtXml][QDomDocument] Spacing-only text nodes can now
be preserved by passing the ParseOption::PreserveSpacingOnlyNodes option
to setContent().

Fixes: QTBUG-104130
Fixes: QTBUG-89690
Task-number: QTBUG-90003
Change-Id: Id43730ce5b79a856c4b434d1f1d4dd7c49c25f31
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 22:17:05 +02:00
Edward Welbourne
607c5a90c5 Fix initialization of QDateEdit and QTimeEdit
Since 6.3 these use Qt::UTC as time-spec but I neglected to take that
into account in QDateTimeEditPrivate::init()'s construction of a
QDateTime from the QDate or QTime. This amends
commit c00ee2f310.

Fixes: QTBUG-105322
Pick-to: 6.3 6.4
Change-Id: I11dec9808a54cf7da401b1734a9a2812f5fd2e63
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00
Edward Welbourne
a46a426b43 Fix handling of invalid input to Q(Date|Time)Edit constructors
Change to match how QDateTimeEdit()'s overloads taking a QDate or
QTime work, substituting a default value in place of an invalid one.
This fixes one surprising anomaly in a recently-extended test, so that
it now only fails the way I expected.

Task-number: QTBUG-105322
Change-Id: Ied4da6160b7efe70990f956798fb826b5b36d8bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00
Edward Welbourne
d1d43b231f Expand QDateTime edit constructor tests to cover Q(Date|Time)Edit
The constructor_qdate() and constructor_qtime() tests only tested
QDateTimeEdit with a QDate or QTime. Extend them to also test
QDateEdit and QTimeEdit constructors, respectively. This revealed one
surprise; the QDateEdit constructor doesn't replace an invalid QDate
with the usual start-date, as the QDateTimeEdit does. It also serves
to reproduce a bug reported in Qt 6.3, see Task-number. These are
all marked XFail for now.

Task-number: QTBUG-105322
Change-Id: Ifafb40a9b78d9314b74ca9a1710d362b9a3cb18d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00
Edward Welbourne
4579ec04a4 Simplify the data tables for some QDateTimeEdit constructor tests
It makes no sense to pass, as parameters, values that can't vary
between test data rows, so eliminate m{in,ax}imum{Dat,Tim}e
columns. There were no parameters used to control how those would be
set, so they were always going to be the type's defaults.

The displayDateTime was only needed for the invalid test, in which its
value is known and fixed; for the normal test it was necessarily
implied by the parameter used to initialize the QDateTimeEdit. While
the QDate and QTime tests do have to supplement that construction
information, the other part is again known and fixed. We can check the
data-tag against "invalid" to determine which known and fixed data to
use, saving the need for a data table column.

Change-Id: I3754ba1a6a127a4a872a7f4a3e7edad9a5ff0ec0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-04 20:39:52 +02:00
Fabian Kosmale
84ab6c1aa1 moc: handle attributes in class declarations
We already had code to handle attributes on funtcions, but we didn't
handle them correctly for classes so far.
Fix this by simply skipping over the attribute.

Fixes: QTBUG-105310
Pick-to: 5.15 6.2 6.3 6.4
Change-Id: Ic4149f940e74820de4f2fa9540d9dc5b4e626a3a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-03 20:14:42 +02:00
Sona Kurazyan
8cc389068b Improve QDomDocument::setContent() API
Added new setContent() overloads, that:

 - take parameter of new ParseOptions enum type for specifying the parse
   options that can be used for enabling namepsace processing and, in
   future, whitespace-only text nodes, etc.

 - use ParseResult for returning the information about error message,
   line and coulmn number, instead of three parameters for each.

 - use QAnyStringView for a QString input data.

To avoid ambiguities when calling setContent() with one argument,
removed the default argument for errorString from all the overloads.

[ChangeLog][QtXml][QDomDocument] Added new setContent() overloads that
allow specifying different parse options through ParseOptions flags.
These overloads use a new ParseResult struct for returning the
information about an error, and QAnyStringView for passing string input.

[ChangeLog][QtXml][QDomDocument][Potentially Source-Incompatible Changes]
setContent() overloads that take only one argument now return
ParseResult instead of a bool. ParseResult explicitly converts to bool,
so the expressions calling setContent() with one argument will continue
compiling, if they are contextually convertible to bool. If an implicit
convertion is required (e.g. bool b = doc.setConetnt(data)), the result
needs to be explicitly converted to bool first
(e.g. bool b = bool(doc.setConetnt(data)).

Task-number: QTBUG-104507
Change-Id: If6a78f8c9b1458f0e3ae719bfd3703a0b965449c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-03 20:14:42 +02:00
Edward Welbourne
a9b46b79dd Rearrange the skipping of a test to give a better message
When tst_QDateTime::fromStringStringFormat_localTimeZone_data() skips
due to feature timezone being undefined, it should report that as the
issue, rather than claiming the system doesn't support the particular
zones used in the test.

Change-Id: I9837ac95c6d92317fbec7fcca184f7b7e6f81441
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-03 18:38:53 +02:00
Edward Welbourne
0a36a7c1db Make 'zz' format an alias for 'z' in time format strings
Also document the (seldom helpful) handling of over-long repeats of a
format. Add test to QDateTime and amend QLocale test.

[ChangeLog][QtCore][QDateTime] Doubling the 'z' format in a date-time
or time format string now produces the same output as a single 'z'.
Previously, this would have produced two copies of the milliseconds
field (eliding any trailing zeros in each). Contrast with 'zzz', which
produces the full milliseconds field, including any trailing zeros.

Change-Id: I4c60462b062fee4079370096d745c191c1939506
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-08-03 18:38:53 +02:00
Yuhang Zhao
8a0e0f8cc1 QtBase: Windows: Replace some deprecated API usages
Microsoft recommends to use CoInitializeEx()
and SetWindowLongPtr()/GetWindowLongPtr() in new code.

Use COINIT_DISABLE_OLE1DDE to avoid overhead of
initializing and using obsolete technology.

Pick-to: 6.4
Change-Id: I9d16943e864d4487dd4f46fd9325579c298c52b9
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2022-08-03 23:24:21 +08:00
Lucie Gérard
fb1b20eab3 Add license headers to cmake files
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.

Existing copyright statements remain intact

Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-03 17:14:55 +02:00
Alexey Edelev
5fc8a377ce Build minimal subset of tests for Android multi-ABI Qt builds
Add an option to limit the number of tests for building and testing
Android multi-ABI configurations in CI. Currently only Core tests
supposed to run.

Change-Id: Ibb8a41d60d108259ef2675ec54bde2482f87c8b2
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-08-02 21:18:50 +02:00
Thiago Macieira
a4e0f070ae QMetaObject: fix calling overloaded functions & constructors
The rewrites in a1c34d8bd0,
0f76e55bc4 and in commit
b73ab954df didn't do this right, though no
problem ended up happening. In particular, the constructor one failed to
check if there were even more parameters.

Change-Id: I6f936da6f6e84d649f70fffd1706f827ba635584
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:30 -07:00
Thiago Macieira
59065a8530 QMetaType: fix void* parameters
Commit 3695b35dfc accounted for pointer to
other incomplete types, but pointer-to-void was missed. This caused an
inconsistency in the stored metatype for void*, which is a built-in type
(QMetaType::VoidStar) but no pointer was recorded.

The test in tst_moc hadn't been enabled because the functions in
questions weren't extracted by moc. That is fixed in this commit.

Change-Id: I6f936da6f6e84d649f70fffd1706f613517a75fb
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-08-01 14:52:22 -07:00
Laszlo Agocs
5b334729d3 rhi: gl: Avoid magic adjustments to the context/window format
...by removing the entire adjustedFormat() helper.

Qt Quick has never used this, which indicates it is not that
useful. Same goes for Qt Multimedia or Qt 3D. Ensuring depth and
stencil is requested is already solved by using
QSurfaceFormat::setDefaultFormat() or by adjusting the formats
everywhere as appropriate.

The helper function's usages are in the manual tests that use it as a
shortcut, and in the GL backend itself. Remove it and leave it up the
client to set the depth or stencil buffer size, typically in the
global default surface format. (which in fact many of the mentioned
manual tests already did, so some of calls to
window->setFormat(adjustedFormat()) were completely unnecessary)

By not having the built-in magic that tries to always force depth and
stencil, we avoid problems that arise then the helper cannot be easily
invoked (thinking of widgets and backingstores), and so one ends up
with unexpected stencil (or depth) in the context (where the GL
backend auto-adjusts), but not in the window (which is not under
QRhi's control).

It was in practice possible to trigger EGL_BAD_MATCH failures with the
new rhi-based widget composition on EGL-based systems. For example, if
an application with a QOpenGLWidget did not set both depth and stencil
(but only one, or none), it ended up failing due to the context -
surface EGLConfig mismatches. On other platforms this matters less due
to less strict config/pixelformat management.

Pick-to: 6.4
Change-Id: I28ae2de163de63ee91bee3ceae08b58e106e1380
Fixes: QTBUG-104951
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-08-01 12:40:45 +02:00
Fabian Kosmale
f1b1773d0a QProperty: Notify observers even when dependency is gone
Problem description:
--------------------
Assume we have two properties, P1 and P2. Assume further that we assign
a binding to P2, so that it depends on P1. Let the binding additionally
capture some (non-QProperty) boolean, and only create the dependency to
P1 if the boolean is true.

The state afterwards is
P1:[p1vaue|firstObserver]
                      |
                      |
                      v
                ---[p2binding]
	       /
P2:[p2value|binding]

If the boolean is set to false, and P1 changes its value, we still
correctly re-evaluate the binding and update P2's value. However, during
binding evaluation we will notice that there is no further dependency
from P2 on P1, and remove its observer.

The state afterwards is
P1:[p1vaue|firstObserver=nullptr]

                ---[p2binding]
	       /
P2:[p2value|binding]

Then, during the notify phase, we traverse the observer's again,
starting from P1's firstObserver. Given that it is nullptr now, we never
reach P2's binding, and thus won't send a notification from it.

Fix:
----

We store a list of all visited binding-observers (in a QVarLengthArray,
to avoid allocations as long as possible). After the binding evaluation
phase, we then use that list to send notifications from every binding
that we visited. As we already have a list of all bindings, we no longer
need to recurse on binding-observes during the notification process;
instead, we only need to deal with static callbacks and ChangeHandlers.

The pre-existing notification logic is still kept for the grouped update
case, where we already have a list of all delayed properties, and should
therefore not encounter the same issue. Unifying its codepath with the
existing logic is left as an exercise for a later patch.

Fixes: QTBUG-105204
Task-number: QTBUG-104982
Pick-to: 6.4 6.3 6.2
Change-Id: I2951f7d9597f4da0b8560a64dfb834f7ad86e757
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-08-01 12:08:26 +02:00
Thiago Macieira
f1457b7b47 tst_QMetaType: fix warning that buffer may be unused
We pass a pointer to uninitialized memory to QMetaType::create().
There's no harm because we're using the invalid QMetaType, but GCC is
actually right to complain for any other type.

qtestcase.h:54:25: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized]
qmetatype.h:454:11: note: by argument 2 of type ‘const void*’ to ‘void* QMetaType::create(const void*) const’ declared here

Pick-to: 6.3 6.4
Change-Id: I3859764fed084846bcb0fffd1703eb7967acf0d7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-31 08:00:11 -07:00
Giuseppe D'Angelo
e540d4a864 QRegularExpression: introduce (global)matchView
QRegularExpression::match (and globalMatch) is currently overloaded
for QString and QStringView. This creates a subtle API asymmetry:

  QRegularExpression re;

  auto m1 = re.match(getQString());       // OK
  auto m2 = re.match(getStdU16String());  // Dangling

This goes against our decision that every time that there's a possible
lifetime issue at play, it should be "evident". Solving the lifetime
issue here is possible, but tricky -- since QRegularExpression
is out-of-line, one needs a type-erased container for the input
string (basically, std::any) to keep it alive and so on.

Instead I went for the simpler solution: deprecate match(QStringView)
and introduce matchView(QStringView) (same for globalMatch). This
makes it clear that the call is matching over a view and therefore
users are supposed to keep the source object alive.

Drive-by, remove the documentation that says that the QString
overloads might not keep the string alive: they do and forever will.

[ChangeLog][QtCore][QRegularExpression] Added the matchView()
and globalMatchView() functions that operate on string views.
The match(QStringView) and globalMatch(QStringView) overloads
have been deprecated.

Change-Id: I054b8605c2fdea59b556dcfea8920ef4eee78ee9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-29 23:04:27 +02:00
Alexandru Croitor
d528e96e73 CMake: Rename tests to be unique for top-level builds
Pick-to: 6.4
Task-number: QTBUG-105238
Change-Id: I6c0276d14b4d90046b0fcfd281e198f59318e804
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-07-28 21:33:26 +02:00
Thiago Macieira
0f76e55bc4 QMetaObject: rewrite invokeMethod()
Use the QMetaMethodPrivate::invokeImpl() function we added in the last
commit, without recreating the method signature. Instead, only do a
comparison on the method name and allow invokeImpl() to decide whether
this method can be called with the given arguments. This will allow
invokeImpl() to have more flexibility in deciding if the arguments match,
using the stored metatype information.

Change-Id: I36b24183fbd041179f2ffffd17021a86484bfab6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:16 -07:00
Thiago Macieira
a1c34d8bd0 QMetaObject: rewrite QMetaMethod::invoke
This adds an internal method to QMetaMethodPrivate to do the work of
actually placing the call on a given meta method. This rewrite should
make the code clearer, but make no otherwise perceptible difference in
behavior.

The next commit will rewrite QMetaObject::invokeMethod to use this new,
internal function to avoid doing a lot of string allocations.

Change-Id: I36b24183fbd041179f2ffffd170219c0deaaf7f5
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-28 11:50:12 -07:00
Alexandru Croitor
317e8f61b8 CMake: Remove unnecessary INCLUDE_DIRECTORIES . in tests
Change-Id: Iafc4f9fcc2a68d299d6d3f255bbcaf90acd0399b
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:46:53 +02:00
Alexandru Croitor
4d22405e48 CMake: Don't use PUBLIC_LIBRARIES for tests and test helpers
Change-Id: I9b7404e1d3a78fe0726ec0f5ce1461f6c209e90d
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-28 14:46:53 +02:00
Mårten Nordheim
85f4679dbd tst_qsslsocket: remove schannel workarounds for old certificate
The certificate was updated recently and doesn't have the same
deprecated hash functions and small key size as the old one did.

Change-Id: I301ad50a96a30483b92a6e30f61e78e8d6b955ca
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-28 14:05:05 +02:00
Thiago Macieira
990c18d9c7 tst_QMetaObject: add a test for using Q_ARG with a non-const ref
This is in use in tst_qdbusinterface.cpp, so let's have it here to make
sure it works:

    QVERIFY(QMetaObject::invokeMethod(&iface, "ping",
                                      Q_RETURN_ARG(QDBusVariant, retArg),
                                      Q_ARG(QDBusVariant, arg),
                                      Q_ARG(QDBusVariant, arg2),
                                      Q_ARG(QDBusVariant&, retArg2)));

Change-Id: I36b24183fbd041179f2ffffd170271424c048292
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 21:09:58 -07:00
Thiago Macieira
b01051dda7 tst_QMetaObject: make sure we don't mix references with non-refs
We should fail to even find the method. `QString' and `QString&` are not
compatible.

Change-Id: I36b24183fbd041179f2ffffd170259bcf07fd459
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 21:09:57 -07:00
Thiago Macieira
48ce496c50 tst_QMetaObject: add some tests for passing and receiving pointers
Change-Id: I36b24183fbd041179f2ffffd170259a81d65a36e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 21:09:56 -07:00
Thiago Macieira
06c3de5ee3 tst_QMetaObject: change tests to forward-declared-only
The type MyUnregisteredType needs to be only forward-declared for the
trick to work. The issue is not about registration, because since commit
fa987d4441 ("MetaObject: Store the
QMetaType of the methods"), we will record the meta type of the type
anyway, which will eventually allow the meta object to actually find
this type.

Instead, the tests are valid for a type that is only forward-declared.

Change-Id: I36b24183fbd041179f2ffffd1702182746f7c1b2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 21:09:55 -07:00
Thiago Macieira
6b3c6155e9 Remove qvariant_p.h
Change-Id: I3859764fed084846bcb0fffd1704480153e34973
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2022-07-27 14:51:31 -07:00
Thiago Macieira
27b1026139 QVariant: split the warning from customConstruct()
In one of the three calls to customConstruct() -- QVariant::detach() --
we've already checked that the type is valid, so don't re-emit the
warning there.

Change-Id: I3859764fed084846bcb0fffd1703a3c7c0fb3164
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 12:35:50 -07:00
Thiago Macieira
2e6398bd46 QMetaType: don't record trivial construction function pointers
We can implement the trivial {default,copy,move} construction outselves
inside qmetatype.cpp and qvariant.cpp, simplifying the QMetaType
interface object, removing up to three relocations per QMTI.

This adds the testing for QMetaType::isXxxConstructible and
isDestructible that couldn't be added before.

Change-Id: Ic44396b31ba04712aab3fffd16ff0a28f541d507
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-27 12:35:50 -07:00
Thiago Macieira
74fac865cf QMetaType: add registerType() and qRegisterMetaType(QMetaType)
This also rewrites QMetaType::id() on top of the helper, with the benefit
of calling a member static function, so QMetaType doesn't need to be
spilled onto the stack. In some upcoming changes I need to ensure that
QMetaTypes are registered so they can be found by name and I'd like to
have a dedicated function name for that, instead of calling .id().

Since I needed to add docs for the new function, I've updated for the
old one too.

[ChangeLog][QMetaType] Added QMetaType::registerType() and an overload
of qRegisterMetaType() taking QMetaType (the two functions do the same
thing). These two functions ensure a given QMetaType is registered with
the Qt global registry, so they can be found by name later. Using
qRegisterMetaType<T>() also accomplishes the same thing, but is slightly
better for completely generic code because it will avoid emitting the
registration for built-in types.

Change-Id: I3859764fed084846bcb0fffd170351d606034c22
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 20:12:30 -07:00
Thiago Macieira
b1d9331c15 QMetaType: fix isRegistered()
It's not registered until an ID is assigned.

Pick-to: 6.4
Change-Id: I3859764fed084846bcb0fffd17034f5b369c5b4d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 14:33:21 -07:00
Thiago Macieira
51905f8e76 tst_QMetaType: suppress most warnings
It's not warning-free, but it's much better.

Pick-to: 6.3 6.4
Change-Id: I3859764fed084846bcb0fffd170323c9ed12dd23
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 14:33:21 -07:00
Thiago Macieira
aae882b02f tst_QMetaType: merge flags and flagsStaticless
And rewrite them with templates. QMetaType::typeFlags() simply calls
flags() anyway.

Pick-to: 6.3 6.4
Change-Id: I3859764fed084846bcb0fffd170323f9d8c80466
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-26 14:33:21 -07:00
Dimitrios Apostolou
57be602fde Fix test being flaky on Linux
The cause is that the first EXPOSE event comes with the window not
having focus yet. See QTBUG-105177.

Also remove processEvents() as events are always processed when doing
qWaitFor...().

Task-number: QTBUG-105177
Change-Id: I2260d1885388bbf7091c423bc9b4c16e2ed0090f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-26 16:33:41 +02:00
Dimitrios Apostolou
2f8127f526 Test fails always on Android, so skip it
Previously the failure was been ignored because of the very generic
"linux" entry in the BLACKLIST file

Task-number: QTBUG-105201
Change-Id: I6914fe350f78266fc18541eb8fcd881f5a4ac511
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-26 16:33:34 +02:00
Dimitrios Apostolou
b1891e86d7 Test is no longer flaky
+ I could not reproduce the flakiness on OpenSUSE Tumbleweed.
+ No significant flakiness can be seen for this test in our testresults
  statistics.
+ Ubuntu-16.04 is no longer part of our CI

Change-Id: I7a18fc3fe2e58af8533171ebae0457b08424e810
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-26 16:33:27 +02:00
Dimitrios Apostolou
83090e16cb Fix flakiness of test on OpenSUSE/KDE
The cause is that the first EXPOSE event comes with the window not
having focus. See QTBUG-105177.

Fixes: QTBUG-67254
Task-number: QTBUG-105177
Change-Id: I04789d0a173979d9a60893989f76566b617c6576
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-26 16:33:22 +02:00
Alexandru Croitor
84c9a79a69 CMake: Make tst_qdbusabstractadaptor depend on qmyserver
Pick-to: 6.2 6.3 6.4
Change-Id: I8a38c6e2de7639ac8cd07e36a4f6d79830d34dc8
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-07-26 14:33:42 +02:00
Marc Mutz
d76bf64531 QByteArray: fix base64 round-trip w/more than 2GiB data
There was an explicit int cast in fromBase64Encoding() which was never
ported to qsizetype and therefore truncated the result.

Fix by removing the int cast.

Add a test, optimize it for as low memory usage as possible, given we
need to work in input and output data each in excess of 2GiB.

Fixes: QTBUG-104985
Pick-to: 6.4 6.3 6.2
Change-Id: I9c0924957e62e5cb3003132cd811b8b0315d8ac1
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>
2022-07-26 02:06:17 +02:00
Edward Welbourne
21e9c223b7 Test skip and fail in cleanup() as well as in cleanupTestCase()
The skipcleanup and failcleanup tests were actually testing skip and
fail in cleanupTestCase(), not in cleanup(). Add almost-duplicate
tests and clean up so that we now have {fail,skip}cleanup(,testcase}
tests to cover all four cases. Generated expected output. The new
tests (with old names) get their fail or skip - during cleanup() -
reported against the test instead of the cleanupTestCase function.
(Results for {init,cleanup}TestCase() are always reported, even when
these slots are not defined, as no-op passes.)

Pick-to: 6.4
Change-Id: I0988d1696b50c0e2f30c45ddc25e1bd0bfd2151a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2022-07-25 19:29:07 +02:00
Thiago Macieira
df0085d3a2 QVariant: do allow non-default-constructible types
So long as you only ask us to copy it. Copying is mandatory, though.

I'll firm up the warning in a later commit, which may not get cherry-
picked as far back.

Pick-to: 6.2 6.3 6.4
Fixes: QTBUG-105140
Change-Id: I3859764fed084846bcb0fffd170432abf65dc197
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-22 12:42:55 -07:00
Dimitrios Apostolou
45501f6ca6 Ensure list has elements before getting them
Before a recent fix it would happen occasionally that
lastNormalizedPositions.at(0) would segfault because the list was
empty. The cause of the flakiness was fixed, but make the test more
resilient anyway by checking first the list is correctly populated.

Furthermore on some platforms this check fails:

  qAbs(leftWidget.lastNormalizedPositions.at(1).x() - 0.8) < 0.05

So instead of QVERIFY use QCOMPARE_LT to print the values when it fails.

Task-number: QTBUG-104268
Change-Id: Id5430eb53c133cf5d23647cfd9749f01f266efce
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-22 19:19:59 +02:00
Dimitrios Apostolou
60f61198f2 Fix test flaky-crashing on OpenSUSE with KDE window manager
Sometimes XCB_EXPOSE event is being propagated twice, once before and
once after qWaitForWindowExposed(). But the window has focus only after
the second expose event. Changing it to qWaitForWindowActive() fixes the
issue.

Fixes: QTBUG-104268
Pick-to: 6.2 6.3 6.4
Change-Id: Ibc78dd4958ed1a4a8d0967b29d2a53457ab9ae8b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-22 19:19:58 +02:00
Ivan Solovev
4b9c738185 QAction: add QT_DEPRECATED_VERSION_6_0 to deprecated methods
And fix all the new warnings.

Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: I2a5791f495575d71d2344429aca3363f9922e31b
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-21 23:12:15 +02:00
Ivan Solovev
8b029ef142 Do not use QTextFormat::FontFamily when building with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000
The QTextFormat::FontFamily enum is deprecated since Qt 6.0, however it
is still used in the code.

To retain backward compatibility with the old data stream formats, we
introduce a new internal QTextFormat::OldFontFamily enum value, which
has exactly the same value as QTextFormat::FontFamily, and use it
instead.

Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ibf5258b621c2b0aa507005dfe2c1e80c26ddb0d4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-21 19:59:08 +02:00
Ivan Solovev
68ea9c0227 QGuiApplication: do not emit deprecated signals
... when QT_DISABLE_DEPRECATED_BEFORE is past the deprecation version.

This commit actually stops using the deprecated signals when we build
Qt with QT_DISABLE_DEPRECATED_BEFORE >= 0x060000. Otherwise we will
get a compilation error because the signals will be removed.

Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ie513ecc9451bf2d88f80857cf19f3d2b4958d022
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-07-21 19:59:07 +02:00
Ivan Solovev
24de000a9c QCursor: add missing QT_DEPRECATED_VERSION_X_6_0 for deprecated methods
When the method is wrapped into
 if QT_DEPRECATED_SINCE(MAJ, MIN)
we also need to add QT_DEPRECATED_VERSION_[X_]_MAJ_MIN macro right in
front of the method declaraion, to actually trigger a deprecation
warning.

This patch does that for QCursor's deprecated methods, and fixes all
related compilation warnings in QtBase.

Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ic8d059e8c852d4b2dee55e7ea94f4fc7a402cdf4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-07-21 19:59:07 +02:00
Fabian Kosmale
6a0e59ed50 QVariant: Avoid crash when constructed from unsuitable metatype
If the metatype does not support copy and default construction, then it
it unsuitunsuitable for use in QMetaType. We cannot prevent users from
passing in such metatypes (as we have e.g. a ctor taking QMetaType), so
verify this in customConstruct, and make the variant invalid in that
case.

Pick-to: 6.2 6.3 6.4
Change-Id: Ib1f0149c8fb9a1cce0049fd0311980754cc85d1b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-07-21 08:37:34 -07:00
Alexandru Croitor
552605b0fc CMake: Rename test to tst_gui_variant_no_application
Coin test collector expects tests to start with the tst_ prefix.

Pick-to: 6.2 6.3 6.4
Change-Id: I5cd49bf75fddc121fdfbde80d8a24a6110098011
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-20 16:51:19 +02:00
Alexandru Croitor
5afb5fb8e0 CMake: Rename test to tst_qobjectrace
Coin test collector expects tests to start with the tst_ prefix.

Pick-to: 6.2 6.3 6.4
Change-Id: Idc991273bacc41b62dbbf70f2ae0f3e712d34ab6
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2022-07-20 13:15:59 +02:00
Marc Mutz
ccb2e4dbb1 QOpenGLBuffer: add move-SMFs and swap()s
- add move special member functions (docs copied from QHostInfo)

- add member swap

- use move-and-swap, not pure-swap, because these objects hold
  resources (handles) other than just memory

- Q_DECLARE_SHARED (it's not implicitly shared, but explicitly)
  - adds ADL swap and Q_DECLARE_TYPEINFO

[ChangeLog][QtOpenGL][QOpenGLBuffer] Added member-swap(), move
constructor, move assignment operator.

Change-Id: I22dc92108bdd393fff4361db23e94eaf3d7ea9cc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-20 13:15:55 +02:00
Marc Mutz
cb9715557c tst_QByteArray: fix custom QCOMPARE for QBAs > 2GiB
The tst_QByteArray test redefines the QCOMPARE macro to check the LHS
to be NUL-terminated. Because the code was never ported from int to
qsizetype, it fails for QByteArrays of size > 2GiB.

Fix by porting to qsizetype.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104985
Change-Id: Ib3951b0efed5f734ae1324ea2d455bb7762fb9c4
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-20 12:56:18 +02:00
Volker Hilsheimer
4802eec2ff QMutex: limit moreStress test to idealThreadCount threads
Or the previous limit, 10.

The test has a flaky and failing history, esp on macOS. Trying to
provoke race conditions with more threads than we have cores has little
value.

Pick-to: 6.4
Change-Id: I99dd2b5a6f64faa83963c279c84fc547416f914f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-20 06:57:43 +02:00
Volker Hilsheimer
2738a80acd QWidget: extend timeouts in flaky enterLeaveOnWindowShowHide test
That test has a very flaky history on Windows 11, presumably because
there are even more fade-in/out effects. Wait longer for those to
finish.

Fixes: QTBUG-102239
Pick-to: 6.4 6.3 6.2
Change-Id: I1d59f4422469e60a8c4dc5a52c48f0344e954491
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-17 13:20:04 +02:00
Timur Pocheptsov
d8ff4d9f57 tst_qnetworkreply: replace server.pem/key pair
OpenSSL v3 fails to set server's certificate, complaining that
"md is too weak".

Pick-to: 6.4 6.3 6.2 5.15
Fixes: QTBUG-49205
Change-Id: Ib21b10ff13bc2621ae2aaaab962efaaf77a854bc
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-15 22:42:43 +02:00
Volker Hilsheimer
e6c7d049f4 QGraphicsProxyWidget: make tolerance in mapToGlobal test at least 4
a61bf508e3 reduced the tolerance from 4 to
3 in one case, making the test more rather than less flaky on systems
with a device-pixel-ratio of 1.

Pick-to: 6.4 6.3 6.2
Change-Id: I245443f0dcb1aa40176c127025501b63f12f161b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-15 14:44:32 +02:00
Volker Hilsheimer
37c829f511 QPalette: detach before modifying resolve mask when resolving
Amends 1d961491d8. We modify the resolve
mask after making a shared copy of 'other', so we must detach. Call the
setter designed for that purpose.

Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-98762
Change-Id: I4f45223e74764a341378992172787fae73efb8b7
Reviewed-by: JiDe Zhang <zhangjide@uniontech.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-07-15 09:58:23 +02:00
Fabian Kosmale
2c81ba2df9 QThread: Clean up bindingStatusOrList if object gets deleted
Deal with the case that the object gets deleted between a call to
moveToThread and the start of the thread by removing the object from the
list in that case.

Fixes: QTBUG-104014
Pick-to: 6.4
Change-Id: Ib249b6e8e8dfbc4d1332bb99a57fa9d3cff16465
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-14 19:34:46 +02:00
Volker Hilsheimer
a2c7428e4d QGraphicsWidget: skip test if graphics view fails to show
We set Qt::X11BypassWindowManagerHint on the view, which regularly makes
the test fail on X11 systems in the

QVERIFY(QTest::qWaitForWindowActive(dummyView.data()))

check.

If the view fails to show, skip the test instead of failing, we are not
testing anything X11 specific here, running this test on other platforms
will be good enough.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-98921
Change-Id: I46dbcddf51ee1e92eb3bbb29bb57fcc314266bea
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-14 15:55:30 +02:00
Volker Hilsheimer
a61bf508e3 QGraphicsProxyWidget: make tolerance for errors depend on DPI
The test already accepts an error margin for coordinate mapping. It is
still flaky, so make that margin larger if the DPI of the widget >1.

Pick-to: 6.4 6.3 6.2
Change-Id: I0a598e5e94ac82c551cbeb935e2fa08cad048f84
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-14 15:24:43 +02:00
Eskil Abrahamsen Blomfeldt
ade2df4c4b Relayout QStaticText when dpi changes
If the cached font has a different DPI than the one used in
QPainter, we need to treat this the same as if other font
properties have changed and redo the layout.

This happened when running the QStaticText test on Wayland,
because the default dpi was 100 and the QPixmap we ended up
drawing to was 96. This caused the pixel size of the font to
be calculated differently when doing drawText() (using 96 dpi)
and drawStaticText() (using the cached 100 dpi).

Pick-to: 6.4
Fixes: QTBUG-100982
Change-Id: Ie4270341bb8a64b6458eb67ba460a282c65dc26b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-14 14:09:33 +02:00
Eskil Abrahamsen Blomfeldt
9a45a01a2c Try re-enabling test on Wayland
Running this test on Wayland passes for me, so maybe something
has magically improved.

Change-Id: I161b697c5be96af48938228267cb405048c78852
Reviewed-by: Inho Lee <inho.lee@qt.io>
2022-07-14 07:35:33 +02:00
Morten Johan Sørvig
5548b940fb wasm: add echo_client_mainthread example
This example connects an echo server running behind
WebSockify, on localhost.

For example, start websockify with

    websockify 1515 localhost:1516

to accept a webscoket connection on 1515 and forward
to echo_server at 1516.

Pick-to: 6.4
Change-Id: Id71364e4ab8c46d3482b515fcd1b991b61d7404b
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-14 01:10:56 +02:00
Volker Hilsheimer
d609b20842 QCompleter: make filesystem test robust against slow I/O
Use a signal spy to watch for the relevant signal from the file system
model and wait for that before checking whether the completer responded
to that signal by showing (or not showing) the popup.

If the file system model doesn't fire within the default timeout of 5
seconds, skip the rest of the test.

Fixes: QTBUG-46113
Pick-to: 6.4 6.3 6.2
Change-Id: I9becfe19a220bdb178ed8275c327d55ea19aa342
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-07-13 22:41:43 +02:00
Volker Hilsheimer
826a98cff1 QProcess: skip processesInMultipleThreads test on emulators
The test has timed out when run on ARM in qemu. We start more threads
than the ideal count, which is likely too much for the emulator when not
running the native architecture.

Pick-to: 6.4
Change-Id: I42e11945070646551e77c10618df762a4bffc8ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-13 21:02:01 +02:00
Ivan Solovev
12262adeba Do not use QExposedEvent::region() in internal code
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: I5ee41802ecc4d6291aaaa1f0efddd20027c1c1e4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 16:45:00 +02:00
Volker Hilsheimer
92e696b4ba Use debug stream in QTest::toString's default fallback if possible
For built-in types, this is a compile-time assert - we should not have
any types in Qt for which we have neither debug streaming nor a
QTest::toString specialization implemented. A build of most of Qt
submodules passes with this change, after minor modifications to some
tests. We cannot declare QSizeHint::Policy as a metatype after the
QMetaType has already been instantiated for it, and the QDebug stream
operator for QElaspedTimer needs to be correctly declared within the
namespace.

Add a self-test function for a custom type, and update reference files
of the self-test.

Task-number: QTBUG-104867
Pick-to: 6.4
Change-Id: I2936db5933f4589fce45f47cf2f3224ed614d8c9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-07-13 15:14:35 +02:00
Eskil Abrahamsen Blomfeldt
3fee97c4ab Skip test which depends on window activations on Wayland
Wayland does not support window activation, so rather than skipping
tests based on platform name, we can use the platform capability
(which will also cover future platforms with the same issue)

Pick-to: 6.4
Task-number: QTBUG-104241
Change-Id: Ibf5f8968f3979b789ef68f92768419bef4500fb3
Reviewed-by: Inho Lee <inho.lee@qt.io>
2022-07-13 14:35:03 +02:00
Shawn Rutledge
8d9301b413 Add QInputDevice::name() to output in device_information manual test
Pick-to: 6.4 6.3 6.2
Task-number: QTBUG-104878
Change-Id: I4299228c90777d71f01c3e2607f8ad4af6e081ed
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 14:35:02 +02:00
Fabian Kosmale
268ff00ef5 QThread: Initialize bindingStatus for adopted threads
If we create a QThread from QThread::current(), we want it to have a
correct value for its bindingStatus. Thus, initialize bindingStatus in
the ctor of QAdoptedThread.

Task-number: QTBUG-101177
Task-number: QTBUG-102403
Pick-to: 6.4 6.3
Change-Id: I3ef27ed62c5dc25eed05d551c72743a1b8528318
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-07-13 12:51:59 +02:00
Morten Johan Sørvig
7e0711e0c0 wasm: secondary thread blocking sockets example
Connects to echo_server via websockify, like the async version.

Pick-to: 6.4
Change-Id: I9ed560cd388cfddbd0d284d8d40fb7ddf964ba96
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2022-07-13 09:29:28 +02:00
Volker Hilsheimer
0dadb951b5 qobjectrace test: Don't hardcode the number of threads
Use QThread::idealThreadCount instead. This requires that we use
QVarLengthArray, as MSVC doesn't allow us to allocate arrays with a
non-constexpr size on the stack.

By using as many threads as the system has cores, we are more likely
to detect race conditions reliably. On systems with fewer cores (in
particular on qemu platforms like QNX, where this test has been
failing a lot), we'll less likely end up with false negatives due
to timeouts.

Pick-to: 6.4 6.3 6.2
Change-Id: Ie8631aef544ca7b53c06a0729d05459016745486
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 17:16:37 +02:00
Laszlo Agocs
7de0f3e9cc rhi: Clean up some inconsistencies
Some of the offsets are already quint32 in the API (vertex input
attributes, dynamic offsets, offsets in draw calls), matching the
reality of the underlying 3D APIs, but many buffer-related functions
use int as of now, simply because that used to be the default choice,
and the same goes for sizes (such as buffer or range sizes). This is
not quite consistent and should be cleaned up if for nothing else then
just to make the classes consistent, but also because no 3D API use a
signed type for offsets, sizes, and strides. (except OpenGL for some)

When it comes to strides (for vertex inputs and raw image texture
uploads), those are already all quint32s. This is straightforward
because most of the 3D APIs use 32-bit uints for these regardless of
the architecture.

Sizes and offsets are often architecture-dependent (Vulkan, Metal),
but there is at least one API where they are always 32-bit even on
64-bit Windows (UINT == unsigned int, D3D11). In addition, we do not
really care about buffer or texture data larger than 4 GB, at least
not without realistic use cases and real world testing, which are
quite unlikely to materialize for now (esp. since we still have the
width/height of 2D textures limited to 16 or 32K in many cases even on
desktops, whereas 2GB+ buffers are not guaranteed in practice even
when an API seemingly allows it).

In any case, the important change here is the signed->unsigned
switch. A number of casts can now be removed here and there in the
backends, because the offsets and sizes are now unsigned as well,
matching the underlying API reality. The size can be potentially
increased later on with minimal effort, if that becomes necessary for
some reason.

Change-Id: I404dbc365ac397eaeeb3bd2da9ce7eb98916da5f
Reviewed-by: Inho Lee <inho.lee@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-07-12 17:16:37 +02:00
Volker Hilsheimer
7b6350fa77 QJniObject: Add template overloads for get/setStaticField
Allow specifying the Java class on which to set/get the field via its
corresponding C++ type, removing the need to explicitly provide the
Java type string.

Those were missing from a085a14d76, which
was noticed when porting QtConnectivity over to the new template APIs.

Pick-to: 6.4
Change-Id: I8f324c9fcc486b4c6c2f2b9051f7eca0cbec0e91
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-07-12 13:25:04 +02:00
Øystein Heskestad
1c563035c7 Disable unit testing setting up QTcpServer on special Apple interfaces
The iBridge interface is used for the keyboard touch bar, and the Apple
Wireless Direct Link interfaces are used by Apple for various purposes.
Setting up a server on these interfaces does not work.
Only the tst_QTcpServer::linkLocal unit test on macOS is affected by
this change.

Fixes: QTBUG-103892
Change-Id: I29701ce51d5e40dff6c59547a8639c1fba330d36
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 13:24:57 +02:00
Mikolaj Boc
fd45278eaa Specialize MetaObjectForType for non-pointer QObject-derived types
QMetaTypeInterfaceWrapper tries to find the metaObjectFunction using
the MetaObjectForType template. Using SFINAE, for a QObject, it should
resolve to a suitable specialization.

Such a specialization doesn't yet exist. It had to be created.

The following path returns nullptr for registered meta types:

  auto metatype = QMetaType(typeId);
  requestedTestType.metaObject() -> returns nullptr since a bad template
  argument is fed to MetaObjectForType<T> in
  QMetaTypeInterfaceWrapper<IneritingFromQObject>::metaType's static initializer.

Change-Id: I8b31c51e12cb19c333e00480b0177354b910ce1e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-07-12 13:24:57 +02:00
Sona Kurazyan
5e8cc498a1 QDomDocument: add a missing full-stop to a warning message
Change-Id: I3c44afa466cbcb12fc0b44ad8bd1b52ded5f4ddd
Pick-to: 6.4 6.3 6.2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-12 13:24:57 +02:00
Sona Kurazyan
6bc227a06a Port QXmlStremReader to QAnyStringView
Port the constructor and addData() method to QAnyStringView, but keep
the overloads taking a QByteArray to avoid extra copies when actual
QByteArray is passed. These overlaods need to be Q_WEAK_OVERLOADs, to
avoid ambiguities (e.g. for const char * arguments).

Additionally, add a test to make sure the patch doesn't break parsing
from a QLatin1StringView input.

[ChangeLog][QtCore][QXmlStremReader] Added constructor and addData()
overloads taking QAnyStringView.

Change-Id: I0efaab82a2123271c88407e380f3c67d1099a4a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-07-12 13:24:56 +02:00
David Skoland
281d915ba4 Add wasm exception for tst_qchar
Since wasm doesn't like filesystems that well, we omit this test in
tst_qchar for wasm, this allows us to still run the test without the
case where it needs to read the normalization file.

Change-Id: I37e54d97e119f94e1a9ca53917d0b93183321899
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2022-07-11 17:21:27 +02:00