Commit Graph

15814 Commits

Author SHA1 Message Date
Ivan Solovev
6658ccf5a1 Add QCborValue(StringLike) constructor benchmark
... to test the impact of migrating the underlying implementation to
QAnyStringView.

As a drive-by: use [[maybe_unused]] instead of Q_UNUSED in the
benchmark for operator[].

Task-number: QTBUG-101707
Pick-to: 6.6 6.5 6.2
Change-Id: I4bae7deadbe9bbd6f267364d78e94ea4541c1339
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-15 19:25:04 +02:00
Mårten Nordheim
f4c8e11ad7 tst_http2: increase testing for authenticationRequired
Make sure the reply is marked as finished and that the body is received
even if we didn't succeed.

In a real scenario that would include some text like Access Denied.

Also, no longer clear() the authenticationHeader in the server, since
that meant the server would not send the header again if the client
failed to authenticate. Luckily this wasn't actually causing any
problems before, since we only tested the expected www-authenticate
header.

As a drive-by: clang-tidy complained about not using const-ref for a
lambda.

Pick-to: 6.6 6.5 6.2
Change-Id: Ia4452fff7d9370d7d460433257d84eff0a6f469b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-15 13:18:13 +02:00
Jøger Hansegård
80a14c86b2 Add QTest option for repeating the entire test execution
Repeated test execution can be useful, under a debugger, to catch an
intermittent failure or, under memory instrumentation, to make memory
leaks easier to recognize.

The new -repeat flag allows running the entire test suite multiple times
within the same process. It works by executing all tests sequentially
before repeating the execution again.

This switch is a developer tool, and is not intended for CI. It can only
be used with the plain text logger.

Change-Id: I2439462c5c44d1c8aa3d3b5656de3eef44898c68
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-15 11:07:09 +00:00
Michael Weghorn
d2bf45c6ed a11y: Report strikethrough via text attribute
Let `QAccessibleTextWidget::attributes`
report whether strikeout is applied to text
via the "text-line-through-type" IAccessible2 text
attribute [1].
Use a value of "single" when strikeout is applied,
and "none" otherwise.

A previous change already implemented bridging that to
the corresponding AT-SPI "strikethrough" attribute.

Update the existing test tst_QAccessibility::textAttributes_data
to take into account that this attribute is reported
as well now.

[1] https://wiki.linuxfoundation.org/accessibility/iaccessible2/textattributes

Fixes: QTBUG-118106
Change-Id: I0416f00b1c11709d9cd0ca0ee38cc6df6caa6dcf
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2023-11-15 12:06:23 +01:00
Jøger Hansegård
8d367dec15 Add QUniqueHandle - a general purpose RAII wrapper for non-memory types
When interfacing with C-style APIs, such as the Windows API, resources
are often represented using handle objects. Lifetime management of such
resources can be cumbersome and error prone, because typical handle
objects (ints) do not give any help to release resources, and to manage
ownership.

Although std::unique_ptr can be retro-fitted with a custom deleter, and
helps transfer of ownership, it is inherently a pointer type. It can
therefore be clumsy to use with C-style APIs, particularly if the
invalid (uninitialized) handle value is not a nullptr. Also, the
std::unique_ptr does not work well when an allocating function returns
the handle as a pointer argument.

The QUniqueHandle addresses these issues by providing a movable only
value type that is designed as a RAII handle wrapper.

A similar handle wrapper exists in the Windows SDK, as part of the WRL
library. Unfortunately, this is Microsoft specific, and is not supported
by MINGW.

Since the QUniqueHandle is platform independent, it can be used also
with non- Microsoft platforms, and can be useful with other C-style APIs
such as FFmpeg or SQLite.

Pick-to: 6.6 6.5
Change-Id: Ibfc0cec3f361ec004febea5f284ebf75e27c0054
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-15 05:01:51 +01:00
Christian Ehrlicher
6259f4e7b4 QGuiApplication: check return value of platformTheme::palette()
Under some circumstances (e.g. setDesktopSettingsAware(false) on
windows) it may happen that the call to platformTheme::palette() returns
a nullptr which is not checked before dereferencing the pointer.
Therefore add a check for this to avoid a crash.

Fixes: QTBUG-111527
Change-Id: I6443d5d1a9b813f499d8f65b4fee55b0b8299b16
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-11-14 20:24:58 +01:00
Ahmad Samir
6e8563fb2d QStandardItem: store Qt::UserRole-1 in a static constexpr var
Change-Id: I809135aed1883130891863e7c8650d0b3e7f3a35
Reviewed-by: David Faure <david.faure@kdab.com>
2023-11-14 21:23:50 +02:00
Ahmad Samir
85eebedb16 QStandardItem: add note about reimplementing data/setData() wrt. flags
Extend the unittests.

Drive-by change: add missing include, otherwise static analyzers
(clangd) complain.

Fixes: QTBUG-105150
Pick-to: 6.6 6.5 5.15
Change-Id: I312133d5b35119e2e51002dfefe0e141c0708e3d
Reviewed-by: David Faure <david.faure@kdab.com>
2023-11-14 21:23:45 +02:00
Volker Hilsheimer
536fd29bdf JNI: Add convenience overloads for registerNativeMethods
Add a template overload for the QJniEnvironment member function so that
a declared type can be used.

And add a static registerNativeMethods class member function to declared
types.

As a drive-by, document the initializer_list overloads. The
"template <typename Class>" convenience wrappers are currently all
undocumented, as we first need to document the QtJniTypes type system
and declaration macros.

Change-Id: I8ff9edc4e493694e6d2c26d4bc7b06bd8e05bf0c
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-13 22:35:27 +01:00
Marcin Zdunek
c706011dc0 Add checking if using eglfs
We are using eglfs in VxWorks which make 3 few testcases fail, because eglfs windows are fullscreen by default.
This is the same solution as in qt5 in tag 5.12.6 from commit with hash 39027ef076c.

[...] EGLFS forces the first top-level window - either a QWidget or a QQuickView - to become fullscreen. [...]
from: https://doc.qt.io/qt-6/embedded-linux.html

Change-Id: I3ab3208b3c7c1b2e27d879bac1ee0679f48109e2
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-11-13 18:42:01 +00:00
Marc Mutz
51c75ae2ff tst_qxp_is_virtual_base_of: disable all warnings for GCC < 10
The -Winaccessible-base switch was added for GCC 10. Older GCCs had no
way to suppress the warnings, and the existing suppression of
-Winaccessible-base caused a warning of its own:

  qcompilerdetection.h:1125:49: warning: unknown option after ‘#pragma GCC diagnostic’ kind [-Wpragmas]
   1125 | #define QT_DO_PRAGMA(text)                      _Pragma(#text)
        |                                                 ^~~~~~~
  qcompilerdetection.h:1150:49: note: in expansion of macro ‘QT_DO_PRAGMA’
   1150 | #  define QT_WARNING_DISABLE_GCC(text)          QT_DO_PRAGMA(GCC diagnostic ignored text)
        |                                                 ^~~~~~~~~~~~
  tst_is_virtual_base_of.cpp:53:1: note: in expansion of macro ‘QT_WARNING_DISABLE_GCC’
     53 | QT_WARNING_DISABLE_GCC("-Winaccessible-base")
        | ^~~~~~~~~~~~~~~~~~~~~~

Since GCC 8 and 9 are slowly fading away as supported compilers, the
simplest fix to get a clean build is to suppress all warnings for the
test on these compilers, by passing -w, as suggested by
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90449.

Short of moving the affected code into a separate header file and
applying `#pragma GCC system_header` to it, there appears to be no
other way to get rid of the warning.

Amends a1bdee4697.

Change-Id: I12eb1f8d486b1e2413675991659bf9ad3a7869ae
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-13 18:42:01 +00:00
Marc Mutz
ddce99989f Improve tst_QStringConverter::encodingForName_data()
Add more tests and DRY the code using the usual row() lambda trick.

Pick-to: 6.6 6.5
Change-Id: I810fba0ab2a96e740e67392155f9507675fe57ae
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-13 19:42:01 +01:00
Marc Mutz
47325e01b7 Rename QImageReader benchmark to tst_bench_
Helps finding it, e.g. in QtCreator, as it's now disambiguated from
tst_QImageReader, the auto-test.

As a drive-by, remove all empty functions.

Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Icb0a3627488bbf4cb0c9d6bc9890f31a88096afd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-13 19:42:00 +01:00
Marc Mutz
54c25c7c31 tst_QFactoryLoader: remove unused member variable
Commit 862f42e806 removed the last use
of the Android-only `directory` member, but didn't remove the member's
definition.

Remove it now, probably fixing a Clang -Wunused-private-field warning
on Android.

Pick-to: 6.6 6.5 6.2
Task-number: QTBUG-87438
Change-Id: I67a1d97f29a0dde20ff29fb9b5bbaa5611cb9e17
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-13 19:42:00 +01:00
Tor Arne Vestbø
df834fde52 tst_QWindow::setVisibleThenCreate(): Fix unused argument warning
Use the arguments to call the parent class implementation.

Pick-to: 6.5 6.6
Change-Id: I602a66447fb8681b3ec9ef8e2e281828612d178c
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-13 18:16:50 +00:00
Tor Arne Vestbø
db33628452 Ensure foreign window can be reparented out of contained window again
A foreign window embedded into a Qt hierarchy must also support
being removed from that window hierarchy.

Pick-to: 6.6
Change-Id: Id4d08079ff19d67a8989937bc72602e8bd14b31b
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-13 19:14:59 +01:00
Marc Mutz
9bccfb56c2 Q(Persistent)ModelIndex: use new test framework for op==
All good, except missing noexcept.

Can't test ordered relational operators because the classes provide
only op<, not the full set, so this has to wait until we port
Q*ModelIndex to the new comparison framework.

Change-Id: I05e26c88f0bd8c035ef0461c7c50b218c513da08
Reviewed-by: David Faure <david.faure@kdab.com>
2023-11-13 17:35:54 +02:00
Ivan Solovev
bfb237d19a TestLib: provide helper functions to test relational operators
The patch provides two sets of functions:
* functions to perform compile-time check for all cv-ref combinations
* functions that actually verify the comparison results for all
  cv-ref combinations.

For now it does not test operator<=>(), even if compiled with C++20,
because Qt types do not yet implement it.

The patch uses the new helper functions to improve testing of date and
time classes, because they already provide a full set of relational
operators.

Change-Id: I8bd869c489543719ea856d6609cac53cbd4dc122
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-13 16:35:54 +01:00
Christian Ehrlicher
e4315204b1 QDial: don't crash when min==max and setting a value != min & max
QDial::bound() is crashing when min == max due to a division by zero.
Therefore check for this condition beforehand and return min.

Pick-to: 6.6 6.5 6.2 5.15
Fixes: QTBUG-104641
Change-Id: I612625af1ad18333d59a7771abfdec602301b58e
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-12 23:45:30 +01:00
Christian Ehrlicher
ab4bb5077c tst_qstandarditemmodel: fix memleaks
QStandardItemModel::takeItem/Row/Column() return items not owned by the
model anymore and therefore need to be cleaned up manually

Pick-to: 6.6
Fixes: QTBUG-116532
Change-Id: Ic8797f58184f56b9c4ef415ce8f2363c1b352388
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-12 11:21:50 +01:00
Christian Ehrlicher
0416e080cf QStandardItem: Fix reset parent in takeItem()
After the change for QTBUG-89145 the parent was not set to 0 when the
item was not attached to a model.

Pick-to: 6.6 6.5 6.2
Fixes: QTBUG-117900
Task-number: QTBUG-89145
Change-Id: I421e775130b03ce3eb2dd1dd05370e7391af087b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-12 10:21:46 +00:00
Assam Boudjelthia
f5e2302851 Android: don't call delegates outside of the Activity
The delegate classes shouldn't be used outside of the Activity/Service
classes, since they're practically private implementation, so don't use
them anywhere outside Activity/Service.

Since Qt Android apps still mainly support having one QtActivity/
QtService, QtNative heavily uses those objects to do various operations.
For that reason, we still need to use the delegate there. The aim is
to change that in future patches and do the operations where they make
more sense for example directly under QtActivityBase/QtActivityDelegate
or Service counterpart.

The QtServiceDelegate is used no where and have no special
implementation, so it's removed here.

Task-number: QTBUG-118077
Change-Id: I5e106318169be19fec8163e8e500ee573af0e1bc
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-10 21:57:11 +02:00
Marc Mutz
b113b01a71 QStringConverter: harden encodingForName() against nullptr
The nameMatch() function has an implicit precondition that neither
argument is nullptr: it immediately dereferences both arguments.

Prevent the crash by checking for name == nullptr early, before
passing to nameMatch().

Add tests for null and empty.

As a drive-by, make variables in the test const (needed for the
QByteArray to avoid detaching, peer pressure for the others).

Amends a639bcda1e.

Pick-to: 6.6 6.5 6.2
Change-Id: I4a30f6c130310eb701ba7c7251168294489c34db
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-11-10 19:24:33 +02:00
Christian Ehrlicher
83e92e2557 QTabWidget/Bar: ignore hidden tabs for key events
Even a tab was hidden it could be accessed with the key navigation or
a scroll event which lead to painting artifacts.

Pick-to: 6.6 6.5 5.15
Fixes: QTBUG-101219
Task-number: QTBUG-63038
Change-Id: I58be694eef5f86cccecbe528891a39a4acdda15f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-09 20:57:43 +01:00
Jarek Kobus
52eae99b51 QtConcurrent::run() test: Add tests taking static function
Change-Id: I75d862a756d0543d8925459b3871abb979ffd481
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-09 16:52:44 +00:00
Mårten Nordheim
26ded9dedf tst_QDockWidget: use local context for timer
If we use 'this' as context it might still try to invoke
the timer after we have left the function, leading to
stack-use-after-return.

To avoid doing an in-depth dive if it's okay to use mainWindow as the
context or not, I just added a new local QObject.

Amends 9ff40b59da

Pick-to: 6.6 6.5
Change-Id: I2c3bdc1eb06731d9c38979610303876c2748fb73
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-09 13:09:55 +01:00
Jan Grulich
63fa92f2ef QCryptographicHash: fallback to non-OpenSSL implementation for Keccak
Current versions of OpenSSL 3 don't support Keccak hashes as these are
going to be introduced with OpenSSL 3.2 so we should rather fallback to
the non-OpenSSL implementation instead of using SHA3.

Fixes: QTBUG-118814
Pick-to: 6.5 6.6
Change-Id: Iedeb81cd76d43d920fc10e1efdac261bc12a394c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-08 18:40:14 +01:00
Piotr Wierciński
d544c0ff58 wasm tests: Fix and clean manual Selenium test
Remove obsolete parent_window_limits_moves_of_children test of moving
child window in parent. Child windows no longer have decorations,
therefore they cannot be dragged by a title bar.
Fix child_window_activation test, which now uses correct coordinates
to probe for stacked windows.

Change-Id: If5ddd8d4486673a961572de7c57df72c3cea9350
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-11-08 18:24:18 +01:00
Jonas Karlsson
a8df174369 QHeaderView: relayout on resetDefaultSectionSize
We now call setDefaultSectionSize with the new default section size.
This clamps the value to min/max section size and it will resize
affected sections.

Pick-to: 6.5 6.6
Fixes: QTBUG-116013
Change-Id: I39849aca8d0672629ce0b3ca244038c27e045d4b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-11-08 18:24:17 +01:00
Ivan Solovev
e85a3cde2f QSharedMemory: fix attach() -> create() for non-legacy SystemV mode
The problem with non-legacy mode is that the backend uses the same
filename for the system semaphore file and for the shared memory file.

What happens is that when we try to call attach(), a semaphore is
created. Later in attach() we set unix_key, because ftok() returns
a valid handle (it uses the file which was created for semaphore).
After that, an attempt to actually attach to a shared memory fails, but
no clean-up is done.
So, a later call to create() sees that unix_key is already valid, but
it cannot properly clean it, because it does not actually refer to
any shared memory.

Fix it by cleaning up unix_key and nativeKeyFile if shmget() call in
attach() fails.

Pick-to: 6.6
Change-Id: Ibccc3ac307d8b2e07e1b9b24b55f97a859a03131
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-08 15:56:54 +01:00
Laszlo Agocs
7c3779006d tst_qrhi: Exercise a readonly storage buffer in the simple test
...not only in the tessellation-related ones (that are skipped
with D3D).

The checked-in .qsb file is generated with a patched shadertools
that fixes a bug regarding readonly storage buffers and HLSL.

Change-Id: Iafbad4e81875d7b4f877435b9b1e6078019d52ac
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-11-08 16:15:18 +02:00
Christian Ehrlicher
5a5c96c65d Add QPixmapIconEngine::isNull()
Reimplement the virtual function QIconEngine::isNull() for
QPixmapIconEngine. This lets QIcon::isNull() return true when no pixmaps
are loaded during QIcon::addFile() e.g. due to a wrong filename.

Pick-to: 6.6 6.5
Fixes: QTBUG-118667
Change-Id: I29f2c492e55b60638507fa398ef7af76f4e9ff48
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-11-08 11:11:48 +01:00
Christian Ehrlicher
90822833f3 QCheckBox: Don't emit checkStateChanged when nothing changed
QCheckBox::checkStateChanged() was emitted with msvc even though the
check state was not changed due to a faulty comparison.
Amends: 37b47ebf94

Pick-to: 6.6
Fixes: QTBUG-118716
Task-number: QTBUG-104688
Change-Id: Iafeabeb9214f6c7510ea4ed87fabb7dc0ba175a6
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-11-08 11:11:48 +01:00
David Faure
889c3e2e5b QMimeDatabase: update freedesktop.org.xml to shared-mime-info 2.3
... and update the unittest accordingly.

Compared to the 2.3 release there 2 fixes in freedesktop.org.xml,
due to issues discovered when running tst_qmimedatabase:
* Give higher priority to the more specific image/apng magic
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/262
* Lower priority for text/x-mpsub's magic
https://gitlab.freedesktop.org/xdg/shared-mime-info/-/merge_requests/263

Task-number: QTBUG-118616
Change-Id: I56053b343619a8a711af28e6490c160d13169734
Reviewed-by: Liang Qi <liang.qi@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-07 16:04:03 +01:00
Ivan Solovev
fb1dcbfcba QSharedMemory: fix attach() -> create() for legacy SystemV mode
The attach() -> create() sequence was not covered by unit-tests in
qtbase, but this approach is used inside QSharedImageLoader.

It turns out that 02c42b26e1 broke this
usecase for legacy mode, and the create() triggered an assertion
in QSharedMemorySystemV::updateNativeKeyFile(). Fix it by clearing
the nativeKeyFile if ftok() call in QSharedMemorySystemV::handle()
fails().

Add unit-tests for the attach() -> create() scenario.
These tests revealed that this scenario fails also in non-legacy mode
for SystemV, so add QEXPECT_FAIL for these cases for now. This will
be addressed in a separate patch.

Pick-to: 6.6
Change-Id: If133fa56c82eba902374dc48d2757046b3d40baf
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-07 15:43:05 +01:00
Volker Hilsheimer
93a6cd8bdf JNI: allow QString as a parameter to native methods
Expect a jstring on the va_list, and implicitly construct a QString from
that.
As a drive-by, allow native methods to take parameters by reference, and
move implementation details into a Detail namespace.

Add test coverage.

Change-Id: I31214938ccaea3f4d539b432e29d12434dd98377
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Petri Virkkunen <petri.virkkunen@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-07 01:59:51 +08:00
Mårten Nordheim
10f5e4f809 QLocal8Bit::convertToUnicode[win]: Support stateless flag
By just setting state to nullptr.

Pick-to: 6.6 6.5
Task-number: QTBUG-105105
Change-Id: I6b4f8fe39f1ba51dcfaf98ce7e42c2acd4c4cf98
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-06 18:23:19 +01:00
Piotr Wierciński
105a8d90bc wasm tests: Fix manual Selenium tests
Manual tests using Selenium for browser automation were not properly
updated when we introduced changes to our DOM structure.
Update the testing framework so elements in shadow root may be
properly accessed.

Change-Id: I45f7d63a833bc48a3b68016ef937e56425bdff87
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>
2023-11-06 11:56:25 +01:00
Edward Welbourne
df73672f97 QTimeZone(qint32 offsetSeconds): use IANA ID when one is available
Principle of least surprise: prefer IANA IDs over synthesized ones.
This also aligns what id() returns more nearly with what
availableTimeZoneIds() reports. Amend some tests to match the new
behavior, extend one test to verify id-round-tripping (also for the
IANA zones) and another to verify single-digit offset IDs get
zero-padded.

Document the complications in how id() relates to what is passed to
the constructor. (It was already complicated; the present change just
aligns it better with IANA IDs, where possible.) Mention, in
availableTimeZoneIds(), that (and why) it only includes IANA's offset
IDs. Drive-by: fix a typo in another availableTimeZoneIds() overload's
doc.

[ChangeLog][QtCore][QTimeZone] When created from (only) a UTC offset,
or from (only) a non-IANA UTC-offset ID, a QTimeZone instance now uses
an IANA UTC-offset ID, where one is available with a matching offset.
Previously it used a synthesized UTC±hh[:mm[:ss]] one which would omit
trailing :00 for minutes or seconds, which the IANA ID may well
include.

Task-number: QTBUG-118586
Change-Id: Ifc4976f36361c830c88a8bef0e8b963fe5a2ab43
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 18:27:14 +01:00
Samuli Piippo
99cec50f56 tests: skip setPermissions test if running as root
Running this test as root doesn't make sense, and it is the reason
why QNX is failing.

Pick-to: 6.6 6.5
Change-Id: Ibbdce9090882cb9dd87d7fcd0802a481f9e7883c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-03 11:00:11 +02:00
Shawn Rutledge
83b592346b Modify the MDI manual test to allow multiple views of same document
- editing same document in different views is possible? yes
- resizing one QTextEdit calls QTextDocument::setTextWidth(), which
  affects the width in the other view too. You can resize either one,
  but you can't have two views with different layouts, of course.

Added a categorized log message in QTextDocument::setTextWidth()
for a sanity check.

Task-nunber: QTBUG-35688
Change-Id: I59c4d10143fda3a66b946237832274d67f9d9d45
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-02 20:49:32 -07:00
Ivan Solovev
02c42b26e1 QSharedMemory: fix semaphore creation in legacy mode
The legacy mode was using the new nativeKey to create a semaphore.
As a result, on macOS the name of the semaphore key file was the same
as the name of the shared memory key file.
This lead to a situation when the file was mistakenly deleted when
destroying any instance of the shared memory, not only the one that
created it.
Fix it by using QSystemSemaphore::legacyNativeKey() in legacy mode.

Add a test to verify that we cannot re-create a shared memory with the
same key. The test was failing on macOS without the fix.

Fixes: QTBUG-111855
Pick-to: 6.6
Change-Id: Ib0bc41791e889b1888bbb8aa9044c6b053b63a5a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-02 21:14:10 +01:00
Eskil Abrahamsen Blomfeldt
c5b3fd134b Skip mixedScript test on platforms with no Hangul font
This test depends on the system actually supporting Korean
text, otherwise it will just return a single glyph run with
the digit and the missing glyph symbol.

Pick-to: 6.5 6.6
Fixes: QTBUG-118649
Change-Id: I54e55414ae4ba0a6328c7c3a57ae8840d3b123b1
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-02 17:41:14 +01:00
Anton Kudryavtsev
4fad57e750 QStringView: add isLower and isUpper
[ChangeLog][QtCore][QStringView] Added isLower() and isUpper()

Change-Id: Ie6cd20bd375d42cbdfb17953b2307d025c31ec77
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-02 13:50:42 +03:00
Ivan Solovev
f5a5c59918 Extend QTestPrivate property tests - actual implementation [2/2]
This patch provides the actual implementation to detect binding loops
in property setters.

These test will help to catch all the existing binding loops that were
introduced when migrating to new bindable properties.

The logic of the new tests is taken from
tst_QObject::objectNameBinding(), but generalized to be applicable to
all bindable properties.

The original code from tst_QObject can now be removed.

The patch effectively reverts f791570b86
because a lambda returning a nullptr now means that the binding loop
test should be skipped, which is not a good default behavior.
Now when all the existing bindable properties are fixed, it's fine to
give a compilation error when adding new tests, if the class is not
default-constructible.

Task-number: QTBUG-116345
Pick-to: 6.6 6.5
Change-Id: I059d444d4bb023c050a22e5b1974565e4f581b5c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-11-01 22:05:38 +02:00
Volker Hilsheimer
e21d35b9f7 JNI: don't implement a signature for 'long' C++ type
On Android, `long` has the width of the system, while `jlong` is always
64 bit. If we support `long` as a signature type equivalent to `jlong`,
then it becomes possible to write code that fails to compile, or in the
worst case crashes at runtime, on a 32bit system.

Instead, support quint64, which is always the same size as jlong.

Change-Id: I60432ec7411e697b5f6e1f153216ceee0af7e0f1
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-11-01 15:58:40 +08:00
Ahmad Samir
e90705687f QMetaEnum: refactor keysToValue
- Show warning messages for malformed keys string
- Use QBAV instead of QL1SV, some methods in the public API may get
  QU8SV overloads in later commits
- Extend unittests; also rename the unittest, it's really testing
  key(s)ToValue()

Change-Id: Iec944ef4c2c5d18ab038cb933e954cf50c912523
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-10-31 19:36:00 +02:00
Tor Arne Vestbø
db17487c93 Fix tst_QWidget::hoverPosition blacklisting for x86_64
The blacklist just uses 'x86'

Pick-to: 6.6 6.5 6.2
Change-Id: I9279e4c497e566f59be54b5cc71a7671d3a3370f
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-10-31 10:27:19 +01:00
Tor Arne Vestbø
adf39eff44 Blacklist tst_QWidget::hoverPosition() on macOS 14 x86_64
It relies on moving the mouse, which is likely related to this
failing in CI.

Pick-to: 6.6 6.5 6.2
Change-Id: Ib4a3ba7a9e874c9c2ef2d6d16143adf072e47588
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
2023-10-31 00:16:28 +00:00
Mårten Nordheim
d8d5922f16 QLocal8Bit::convertFromUnicode[win]: handle trailing high surrogate
The win32 API doesn't give us much choice. _Some_ code pages have
support for returning some error if we pass a specific flag, but not
all of them.

Anyway, since the code pages might not support all that UTF-16 provides,
we can't reasonably make it error out on characters that cannot be
converted.

So, the most reasonable thing we can handle is a unpaired high surrogate
at the end of a string, assume that the rest of the string was fine, and
that the low surrogate will be provided in the next call.

Pick-to: 6.6 6.5
Fixes: QTBUG-118185
Task-number: QTBUG-105105
Change-Id: I1f193c9d8e04bec769d885d32440c759d9dff0c2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-10-30 21:25:35 +02:00