Commit Graph

14282 Commits

Author SHA1 Message Date
Marc Mutz
29f911ab92 tst_QTextScriptEngine: replace QList with const array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Ifef42704c4f695a8fb05ea5d9b3e095af3f35171
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-08 16:03:28 +02:00
Marc Mutz
3b6ae86ce8 tst_QSctpSocket: replace QList with const array
"Never use a dynamically-sized container for statically-sized data."

Port the loop from Q_FOREACH (which can't deal with arrays) to ranged
for (which can).

Pick-to: 6.6 6.5
Task-number: QTBUG-115839
Change-Id: Iecfc037c8bbfc0b3196ed0c65f680768a8d2353a
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-08 16:03:28 +02:00
Marc Mutz
52ef958429 tst_macdeployqt: fix runVerifyDeployment()
QList rather pointlessly has a startsWith() function, which means this
code compiled. But the code makes no sense: it tests the same
condition over and over again, so I'm assuming that it should be
path.startsWith() and not path_s_.startsWith().

Amends 3f56950862, but that just
imported the code from qttools. I didn't check whether the bug was
present there, already.

Pick-to: 6.6 6.5
Change-Id: I98a4bbfe0400700655a5c2137f7a976a835a8d28
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-08-08 15:49:26 +02:00
Marc Mutz
af34c64d7f tst_QMdiArea: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables, albeit sometimes at the cost of an extra scope
(can't, yet, use C++20 ranged for loops with initializer).

In resizeMaximizedChildWindows(), decided to leave the container
construction as-is and use std::as_const instead (applying IILE to
make the container const would be too much churn).

In setViewMode(), removed a pointless clear() that prevented the
container from being marked const. There are no references to the
container following the clear(), and the container does not hold smart
pointers, so the clear() cannot have had non-trivial side-effects.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I00ce9c12ab696de30229f3605c16313af7eafffc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-07 23:56:11 +02:00
Marc Mutz
081670b840 tst_QGestureRecognizer: port away from Q_FOREACH
The single use of Q_FOREACH in this test is safe to port 1:1 to a
ranged for-loop, since we're in a constructor, and the loop body only
calls member functions of data members (incl. the base class), so we
cannot possibly modify the container passed in as a constructor
argument: any connections or event processing that could re-enter our
caller hasn't been set up, yet.

Task-number: QTBUG-115803
Change-Id: I7095aef1edddbda0d1b0c471192b18acd6fd1793
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 23:56:10 +02:00
Marc Mutz
ddcf716762 tst_QGroupBox: port away from Q_FOREACH
These are all simple: QObject::children() returns a reference-to-const
QList, so we can leave the calls in the for loop (no detach()ing).

The loop bodies also clearly don't modify the list of the QObject
children (they're just QVERIFYs).

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I9c5dcb2aefc433a1dead55dab669e645b6906963
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-08-07 21:56:10 +00:00
Marc Mutz
e0c1ae09fd tst_QWizard: port away from Q_FOREACH[5/5]: CombinationsTestData ctor
This is iterating over data member containers that are otherwise only
touched in the constructor of the same object. Luckily, the
initialization of these containers does not require *this, so use
NSDMI and mark the containers const, proving they can never be
modified and thus the protective copy of Q_FOREACH isn't required. Now
that we got rid of Q_FOREACH, we can and do make them arrays for extra
measure ("never use dynamically-sized containers for statically-sized
data").

Unfortunately, C++ neither allows us to use "flexible array
members" nor AAA in NSDMI, so grab the nettle and supply the array
size manually (ever so slightly violating DRY, but the compiler will
complain if we get it wrong).

Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: Ibb2ce48b6dcaf2e9d3d1a625602f3865d280c7c6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 21:56:10 +00:00
Marc Mutz
4741a7cd1c tst_QWizard: port away from Q_FOREACH[4/5]: TestWizard dtor
This is iterating over a data member container that's otherwise only
touched in the constructor of the same object. The only reason why
it's not a const is that the initialization from QWizard::addPage()
makes that very cumbersome. So port to a ranged for-loop and apply
std::as_const().

Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I033e3725df95b29a8ef295c4e74d746d83234835
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 23:56:10 +02:00
Marc Mutz
d67aa6291d tst_QWizard: port away from Q_FOREACH[3/5]: OptionInfo ctor
This is iterating over the keys() of a member container we've just
filled in the same function. The loop body clearly doesn't modify the
container being iterated over. Port to the future-proof ranged
for-loop over asKeyValueRange(), using the _-in-SB pattern Christian
Ehrlicher showed me to indicate we're not interested in the value.

Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I3d86a1de9ea460b7d57fa421ea76e41d2c122f43
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 23:56:10 +02:00
Marc Mutz
d0a4b29132 tst_QWizard: port away from Q_FOREACH[2/5]: WizardPages::shown()
This is safe to port to a ranged for loop, as it's iterating over a
private member container that is not modified under iteration
(WizardPage::shown() is just returning a boolean member).

Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I50891e4b7509bd64399a128a5ee47d7795374f8e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 23:56:10 +02:00
Marc Mutz
88464f7e93 tst_QWizard: port away from Q_FOREACH[1/5]: TestWizard::applyOperations()
This function is called only from one test function. Mark the
function's argument as const in the caller, bringing this use into the
const-local category, which is implicitly safe to port 1:1 to
ranged-for.

Task-number: QTBUG-115803
Pick-to: 6.6 6.5
Change-Id: I9145c1ae2aed5ab3cafc4947dc3eaaf9a27c6a04
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-07 23:56:10 +02:00
Piotr Wierciński
2fe2281f0a Tests: Fix typo in qfuture test
Fix typo so tst_qfuture on platforms without exceptions can be build
correctly.

Change-Id: I32c12effdda13da9c8669bfddd362acc1c8a14c7
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
2023-08-07 23:56:10 +02:00
Edward Welbourne
c84d78d105 Update QTimeZone data to CLDR v43
Ran the script, no new IDs to add. Revised tests of Central Standard
Time: America/Ojinaga has joined Matamoros for it, in Mexico.

Pick-to: 6.6 6.5
Fixes: QTBUG-115732
Task-number: QTBUG-111550
Change-Id: I9b41d8c0156b9fbe3961dbe9a35d55493fc55501
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-07 19:51:09 +02:00
Tor Arne Vestbø
546d4c9d33 tst_foreignwindow: Add basic test of foreign window reparenting
Pick-to: 6.6
Change-Id: I008fad0f6527503a13ded4818eec5cb280f65cf4
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-08-07 17:58:53 +02:00
Marc Mutz
32e8b27285 tst_QFileDialog/2: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

The only noteworthy point here is that, in order to mark it as const,
I had to move a container definition to the more narrow scope in which
it was actually initialized. There are no references to the container
outside the narrow scope that would require it to be defined in the
larger scope.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: I20890f48a48ca662679f55fa5db759419d4db8c5
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-07 13:28:20 +02:00
Marc Mutz
b8881ff280 tst_QComboBox: port away from Q_FOREACH
These are all trivial: all are over (already or newly-made) const
local variables.

Pick-to: 6.6 6.5
Task-number: QTBUG-115803
Change-Id: Idd6e65065ee27c2d29ce1b49607aadb2eaf5e15d
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-08-07 13:28:10 +02:00
Alexandru Croitor
ce8874fc3b CMake: Place resources into static libraries, not object libraries
During the Qt 5 -> Qt 6 and qmake -> CMake porting time frame, it was
decided to keep resources in an object file (object library), rather
than putting them directly into a static library when doing a static
Qt build, so that the build system can take care of linking the
object file directly into the executable and thus not forcing
project developers to manually initialize resources with
the Q_INIT_RESOURCE() macro in project code.

This worked for most qmake and cmake projects, but it created
difficulties for other build systems, in the sense that these projects
would have to manually link to the resource object files, otherwise
they would get link time errors about undefined resource symbols,
assuming they kept the Q_INIT_RESOURCE() calls.
If the project code didn't contain Q_INIT_RESOURCE calls, the
situation would be even worse, the linker would not error out,
and the missing resources would only be discovered at runtime.

It's also an issue in CMake projects that try to link to the
library files directly instead of using the library target names,
which means the object files would not be automatically linked in.
Many projects try to do that because we don't yet offer a convenient
way to install libraries and reuse them in other projects (the SDK
case), so projects end up shipping only the libraries, without the
resource object files.

We can improve the situation by moving the resources back into their
associated static libraries, and only keeping a static initializer as
a separate object file / object library, which references the actual
resource initializer symbol, to ensure it does not get discarded
during linking.

This way, projects that link using targets get no behavior difference,
whereas projects linking to static libraries directly can still
successfully build as long as their sources have all the necessary
Q_INIT_RESOURCE calls.

To ensure the resource symbols do not get discarded, we use a few new
private macros. We declare the resource init symbols we want to keep as
extern symbols and then assign the symbol addresses to volatile
variables.
This prevents discarding the symbols with the compilers / linkers we
care about.

It comes at the cost of an additional static initializer per resource,
but we would get the same + a bigger performance hit if we just used
Q_INIT_RESOURCE twice (once in the object lib and once in project
code), which internally needs to traverse a linked list of all
resources to check if a resource was initialized or not.

For GHS / Integrity, we also need to use a GHS-specific pragma to keep
the symbols, which we currently use in qtdeclarative to ensure qml
plugin symbols are not discarded.

The same macros will be used in a qtdeclarative change to prevent
discarding of resources when linking to static qml plugins.

A cmake-based test case is added to verify that linking to static
libraries directly, without linking to the resource initializer
object libraries, works fine as long as the project code calls
Q_INIT_RESOURCE for the relevant resource.

Fixes: QTBUG-91448
Task-number: QTBUG-110243
Change-Id: I39c325aac91e36d53c3576a39f881949c3b21e3f
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-04 14:15:05 +02:00
Liang Qi
6f6e62650d tests: skip three tests in tst_QDockWidget on Wayland
Task-number: QTBUG-107153
Pick-to: 6.6 6.5
Change-Id: Iad2bc83db96c25508b54ecc5b7c74280cfe90270
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-04 09:09:47 +02:00
Thiago Macieira
bb0e994072 tst_QFile: restrict to running on Linux
My FreeBSD does not have /proc mounted, so this test doesn't run almost
ever. I have no idea about OpenBSD and no one has tested Qt on AIX in
over a decade.

Change-Id: Ifbf974a4d10745b099b1fffd1777a598ee91eb5d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-03 20:49:51 -07:00
Ievgenii Meshcheriakov
06397cc45f tst_qdbuscpp2xml: Remove unused variables
Change-Id: I131d7336e36d34f60fca0f37f76cd77ef674f405
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00
Ievgenii Meshcheriakov
8d89b4ef21 qdbuscpp2xml: Support MEMBER field of Q_PROPERTY
Emit properties with MEMBER field specified with 'readwrite'
access. Previously only READ and WRITE filed where used
for deriving the access value.

Add a property using MEMBER to the test class used by
tst_qdbuscpp2xml.

Fixes: QTBUG-115631
Change-Id: I12351985a9fafd934ccc5e0b805077a9e44b6608
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 16:09:17 +02:00
Tor Arne Vestbø
5e6d46a9f7 tests: Move NativeWindow helper class to shared header
Pick-to: 6.6
Change-Id: Ia7dc54aa761fdfde42d49a41475a4fbc74036aeb
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2023-08-03 16:09:17 +02:00
Liang Qi
c41733b06b tests: blacklist tst_QWidget::render() on Wayland
which is flaky.

Task-number: QTBUG-115598
Pick-to: 6.6 6.5
Change-Id: Ibb0a0c6b1e225144e2ce796691c40bb7510bfd56
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-08-03 07:23:37 +02:00
Ahmad Samir
8ed2bc9194 QByteArray: change append(QByteArray) to match QStringBuilder behavior
I.e. concatenating a null byte array and an empty-but-not-null byte
array should result in an empty-but-not-null byte array.

This matches the behavior of QString::append(QString) too.

Fixes: QTBUG-114238
Pick-to: 6.6
Change-Id: Id36d10ee09c08041b7dabda102df48ca6d413d8b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:22 +03:00
Ahmad Samir
d1da83002d QByteArray: remove a unittest
It relied on an implementation detail of operator+=(), that the latter
wouldn't just use assignement (e.g. if `this` is empty/null).

It also had undefined behavior, when the char array used with
fromRawData() went out of, the nested, scope, the code was pointing to a
dangling stack pointer.

Thanks to Thiago for the explanation in code review.

This ties in with further changes in this series, where append() is
changed to preserve null-ness; there is no way to preserve null-ness in
append() while keeping this unittest passing.

Change-Id: I43b9f60db9ce2d471f359f32bcc48e7b4cfceeab
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-03 02:12:22 +03:00
Thiago Macieira
4a5f3c8b93 CMake: remove check for cxx11_future
Everyone must have this by now. This test was 1193 ms of CMake time.

Since this was a PUBLIC feature, I've left it around with a constant
condition.

Change-Id: Ifbf974a4d10745b099b1fffd177754538bbff245
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-08-02 12:36:18 -07:00
Tor Arne Vestbø
4ede419533 tst_foreignwindow: Run test with high-DPI disabled
To avoid having to take high-DPI scaling into account for geometry
calculations/comparisons.

Pick-to: 6.6
Change-Id: I941b74781264455b70520df8d1e6e91592e00310
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-02 19:36:13 +02:00
Mikolaj Boc
63b64084cd Make more of tst_settings pass on WASM
Missing parts of local storage backend implemented:
- fallback mechanism
- removal of all child keys for groups
- variant decoding instead of string decoding
- report AccessError when organization is empty in settings' ctor

Some WASM-specific adjustments to tst_qsettings have also been
introduced.

Task-number: QTBUG-115509
Fixes: QTBUG-115037
Change-Id: I02cde965b11d98a64fc1ecb261d74838c508afd6
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2023-08-02 15:43:45 +02:00
Edward Welbourne
9237908327 Update QLocale to CLDR v43
Ran the scripts, added the new enum members to docs.
Updated tests:
* Two of the new languages are right-to-left,
* Canada has replaced a silly date format with a sensible one.

Fixes: QTBUG-111550
Change-Id: Ie6f1e6e94477167c9e2b5c67e6518ca0f6a7e7fb
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
2023-08-02 09:38:34 +02:00
Tor Arne Vestbø
ec3d09bd9c cmake: Enable Objective-C++ language for standalone test projects
Amends 8450ab8dec.

Task-number: QTBUG-93020
Change-Id: Ied86754dbcd216a73cc77135c2c45303463d28d2
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-08-01 20:42:30 +02:00
Ivan Solovev
eb0abd9789 Use QT_SUPPORTS_INT128 macro to handle 128-bit integral types
Introduce QT_SUPPORTS_INT128 and QT_NO_INT128 marcos to handle 128-bit
types. These macros allow to undef Qt's own 128-bit types and the
related code, but keep the compiler definitions unchanged.

This is required for Qt Bluetooth, where we need to use
QT_BLUETOOTH_REMOVED_SINCE to get rid of the APIs using
QtBluetooth-specific struct quint128 which clashes with the 128-bit
types. The idea is to use QT_NO_INT128 in Qt Bluetooth's
removed_api.cpp instead of directly undef'ing __SIZEOF_INT128__,
because the latter is UB.

This commit amends befda1acca.

Pick-to: 6.6
Change-Id: Ia2c110b5744c3aaa53eda39fb44984cf5a01fac2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-08-01 10:30:51 +02:00
Thiago Macieira
cff13c2417 QMetaType: fix recursive detection of std::optional operators
Commit ca54b741d6 used the internal
has_operator_equal (and commit 01d94760d8
copied that for has_operator_less_than) instead of using the recursive
expander that was being used here. That assumed that the contained type
in std::optional would always be the last final check, which is an
incorrect assumption.

Fixes: QTBUG-115646
Pick-to: 6.6 6.5
Change-Id: Ifbf974a4d10745b099b1fffd177702934bec27ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2023-07-31 18:43:55 -07:00
Edward Welbourne
5993480b69 Correct some testlib selftest data: blacklisted does not qFatal()
The blacklisted test does not crash, as its expected output indeed shows.

Pick-to: 6.5 6.6
Change-Id: I07522a7d065b5f39620975a3546bcd156024c41d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-31 18:16:05 +02:00
Tor Arne Vestbø
118f2210c6 tst_selftests: Fix mistaken early return when checking error output
In porting the selftest machinery to Catch2 in 24e83de8d1 we
accidentally added an unconditional early return when determining
whether to check for unexpected stderr output, resulting in not
checking error output on any platform.

The return statement has now been moved into the Q_CC_MINGW
condition, but as we now seem to have similar issues on macOS
and Linux with some of the tests outputting "Received signal 6
(SIGABRT)" as we do for QEMU, we need to add a few more explicit
early return conditions to the function.

Pick-to: 6.5 6.6
Change-Id: I7a25f000843b5f1003a5db883f08285185046b46
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-31 18:16:05 +02:00
Edward Welbourne
2e9d33e534 Use correct index for QLocale::system()'s static
Nothing prevents client code from calling QLocale::setDefault() before
we ever instantiate QLocale::system() - aside from some quirks that
mean setDefault(), currently, does instantiate QLocale::system() to
force initialization of defaultLocalePrivate - so using defaultIndex()
could set the system QLocalePrivate instance's index incorrectly.

In any case, even if the index is initially set correctly, a
subsequent change to the system locale would change the correct index;
and nothing outside QLocale::system() has access to the instance that
would then be remembering an out-of-date index.

Actually tripping over that inconsistency took some deviousness, but
was possible. The index is (currently) only used for month name
lookups and those special-case, for the Roman-derived calendars, the
system locale, to only use the index if the system locale offers no
name for a month. Meanwhile, updateSystemPrivate() uses the fallback
locale's index for its look-up of which CLDR data to copy into the
fallback QLocaleData for the system locale.

None the less, a non-Roman calendar's lookup will go via the index to
get at the CLDR data for that calendar, thereby exposing the system
locale's index to use; and, sure enough, a setDefault() could lead
that to produce wrong answers.

In QLocale::system() there's a cached QLocalePrivate, whose index we
need to ensure stays in sync with the active system locale. So pass
its &m_index to systemData(), which will now (when passed this) ensure
it's up to date. Since we always have called systemData(), to ensure
it is up to date, we can skip that update in the initialization of the
cached private and use m_index = -1 to let systemData() know when it's
in the initial call, thereby making the static cache constinit.

Amended a test to what proved the issue was present.

Change-Id: I8d7ab5830cf0bbb9265c2af2a1edc9396ddef79f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-31 17:16:14 +02:00
Ahmad Samir
b902b152af QObject: replace _q_reregisterTimers with a lambda
- Pass the QList by value, no heap allocation and no plain new/delete
- A lambda means that there isn't runtime string-based lookup to find
  the member method in QObjectPrivate

The code is only a couple of lines and used in a single place, so might
as well move the code from _q_reregisterTimers to the local lambda.

Modify tst_moc to account for the numer of methods in QObjectPrivate
changing. The test had hardcoded numbers.

Change-Id: I07906fc7138b8e601e4695f8d2de1b5fdd88449c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-31 01:52:25 +03:00
Jacek Poplawski
cd33d90e9f Skip tst_QMimeDatabase::mimeTypeForUnixSpecials_data when AT_FDCWD is not defined
Change-Id: I6fd3bb3e56733b79f349934319a071f8eabaf0ea
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-28 23:13:09 +02:00
Thiago Macieira
84f8d4961d Revert "Fix signed integer overflows in tst_QAtomicInteger"
This reverts commit f647375275. There are
no signed integer overflows in atomics.

For the non-atomic side, unlike the commit being reverted, we fix the
signed integer overflow by removing the "signed" part instead of the
"overflow" part, and use unsigned integer overflows instead.

Change-Id: I53335f845a1345299031fffd176f5ba479163e44
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2023-07-28 11:20:35 -07:00
Fabian Kosmale
f0039bd517 moc: handle "L" integer suffix
This commit adds some initial support for handling the 'L' suffix after
numbers. This one is especially important given that the __cplusplus
define is using it.
Other suffixes will be handled in some later commit, which should also
unify the already divergent parse behavior between DIGIT and PP_DIGIT
parsing (e.g. when it comes to byte prefixes).

Task-number: QTBUG-83160
Task-number: QTBUG-115558
Pick-to: 6.6 6.5 6.2
Change-Id: Ie61eae49c468abfaee80e7e4f7097917a254dc0e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-28 12:23:53 +02:00
Edward Welbourne
4693c81268 Correct feature test in tst_qtranslator's CMake config
There is no QT_CONFIG_thread.
Thanks to Alexey Edelev for spotting why I couldn't run the test.

Pick-to: 6.6 6.5
Change-Id: I11c99d9b1ff8fed67b118028b76fba8ee6db3c42
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-07-27 15:09:24 +02:00
Marcin Zdunek
e71693efb9 Socketpair is not supported on Vxworks
Change-Id: I7cfebfc85933ace1e449860b29c8ec85201690a0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-27 08:46:18 +02:00
Assam Boudjelthia
de7eaa940d Android: temporarily skip tst_qprinterinfo, tst_qwidget and tst_qwindow
Those tests often fail on Android 13 on RHEL 8.6 and 8.8. This patch
skips them to unblock CI while the underlying reasons are investigated
and fixed.

Task-number: QTQAINFRA-5606
Change-Id: If088d69c2160470ef50b2e74cd9b9399451c526d
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-07-26 20:12:49 +03:00
Thiago Macieira
a7f227f56c Make qYieldCpu() public API
Rewritten to be a bit simpler, added a few more yield/YieldProcessor
alternatives, added RISC-V support.

[ChangeLog][QtCore] Added qYieldCpu() function.

Fixes: QTBUG-103014
Change-Id: I53335f845a1345299031fffd176f59032e7400f5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-07-25 07:21:56 -07:00
Dennis Oberst
c2310f8e03 QNativeIpcKey: add qHash() function
Equality comparable types should define a qHash() function.

Pick-to: 6.6
Change-Id: I1677fbefa3d09d49a292d369b808793f884c32e9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-07-25 12:31:04 +02:00
Dennis Oberst
c6fe64b17c Add QStrongOrdering and QWeakOrdering
These new classes align with the criteria of std::strong_ordering
and std::weak_ordering and were the missing types required by
the three-way comparison operator.

References:
https://en.cppreference.com/w/cpp/utility/compare/strong_ordering
https://en.cppreference.com/w/cpp/utility/compare/weak_ordering

Change-Id: Ie6620ca98103800fd5504810dc5689c1dd1c2972
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-07-25 12:31:04 +02:00
Axel Spoerl
93e9d21490 tst_QExplicitlySharedDataPointer: Remove stray comment
Remove stray comment at the end of tst_qexplicitlyshareddatapointer.cpp

Pick-to: 6.6
Change-Id: I31a6c38002e56e7c43e527864ba3d9324950079f
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-07-25 12:31:04 +02:00
Axel Spoerl
3bb991ca05 tst_QXmlStream: Remove stray comment
Remove stray comment at the end of tst_qxmlstream.cpp

Pick-to: 6.6
Change-Id: I88550e2b75194e7895d8578ca0e8350af59d4dfe
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
2023-07-25 09:31:17 +02:00
Thiago Macieira
07258c38c3 tst_QLocale: add testing of the extremes for doubleToString
Change-Id: I5f7f427ded124479baa6fffd1760b1ec36e7e827
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-24 15:35:48 -07:00
Ahmad Samir
309e7d88c3 QStringBuilder: test more concatenation variants
- rvalues, they work due to e.g. the implicit conversion to QString, so
  the compiler picks the "const String &" overloads. (This may change by
  adding rvalue overloads in a later commit, although that will mean
  adding many more operator+() overloads to disambiguate the calls)
- QByteArray + QByteArrayView
- More P and more Q (even though in some cases P and Q are defined as
  the same operator in some QStringBuilder unittest "scenarios")

Change-Id: I4e7daecdb6887fb52f45732cd32323af20b1b850
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-07-24 01:04:55 +03:00
Ahmad Samir
f107773742 QValidator: return State::Intermediate for certain trailing characters
E.g. a group separator, a -/+ sign, or 'e' (exponent). Input ending with
one of these characters now returns Intermediate, as it can become
Acceptable if the user types more characters.

Remove a check from initialResultCheck(), as it's now covered by
QLocaleData::validateChars() checking that the last character in the
buffer is -/+, this works the same if buffer's size is 1.

Extended unittests based on the linked bug report; the other cases for
"last" are already covered by existing unittests.

Task-number: QTBUG-111371
Change-Id: I9b6979c29f07a5f57b040004cd3dbf4e27147c21
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-07-24 00:04:47 +02:00