Commit Graph

15912 Commits (4fa9f13397abf5da44a0fbd70692fa2c8f79ac13)

Author SHA1 Message Date
Rym Bouabid 4fa9f13397 Make QAtomicScopedValueRollback public API
Move the private header to public.
Make documentation a part of public interface.

[ChangeLog][QtCore][QAtomicScopedValueRollback] New class.

Task-number: QTBUG-115107
Change-Id: I6c9f5448e74a5b62f4d97ee079944f4b1b731121
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-08 02:24:41 +01:00
Marc Mutz a5bcb41678 tst_bench_QImageReader: add a benchmark for raw QFatoryLoader operations
This is Eirik's QtCore-only QTBUG-114253 reproducer added to the
nearest fitting existing benchmark.

Done-with: Eirik Aavitsland <eirik.aavitsland@qt.io>
Pick-to: 6.6 6.5 6.2 5.15
Task-number: QTBUG-114253
Change-Id: Iba68bedebae908af497267860e2b230db269787e
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2023-12-07 22:55:08 +00:00
Marc Mutz 6c60117d01 tst_QString: explain TransientDefaultLocale better
A default-constructed QLocale gets initialized with the
currently-active default locale, and apparently retains that setting
henceforth. That is why the `prior` member is not explicitly
initialized, which is confusing at face value.

Explain the mechanism better, and explicitly default-initialize the
member, so the next reader of the code saves the time to research
this.

Amends 76dfda1ad1.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I1d1171f8564c70a971938b92b809f63ba5637d3a
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-12-07 23:55:08 +01:00
Marc Mutz 0a86a77e5f tst_containerapisymmetry: remove the extra push_back
... and make sure it cannot happen again by using Extract Method to
let the compiler do the counting between the resize and the
sequence-of-push_back alternatives, because this author clearly can't.

Amends 3c0fdd7341.

Pick-to: 6.6 6.5
Change-Id: If18f30d60f556e5e668876a38423f3e519fb79b0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 23:55:08 +01:00
Thiago Macieira db991cb4e1 QBitArray: replace the member operator~ with a hidden friend
Which takes the array to be inverted by value, so we get free move
semantics and allowing us to perform the negation in-place.

[ChangeLog][Potentially Source-Incompatible Changes] The bitwise AND,
OR, XOR, and NOT operator functions on QBitArray are now hidden
friends. This may cause source-incompatibility in unusual coding styles
(like 'array.operator~()') or with classes that have a casting 'operator
QBitArray()'.

Change-Id: I85b3fc2dd45c4693be13fffd1795ba1fbaf23769
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 14:55:07 -08:00
Marc Mutz 03e78e5d62 Long live QSpan as public API!
Provide qspan_p.h as backward-compatibility header.

[ChangeLog][QtCore][QSpan] New Qt equivalent of std::span.

Fixes: QTBUG-115022
Change-Id: I1cc27dc0aa1f7406f0a41d7a75f176cd7f858feb
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 22:38:15 +00:00
Ievgenii Meshcheriakov d3860918ea QDBusConnectionPrivate: Close connection after failed q_dbus_bus_register()
The connection should be closed before executing
q_dbus_connection_unref(). Failing to do so results in an assertion
inside libdbus:

    dbus[1573958]: The last reference on a connection was dropped
    without closing the connection. This is a bug in an application.
    See dbus_connection_unref() documentation for details.
    Most likely, the application was supposed to call
    dbus_connection_close(), since this is a private connection.

The q_dbus_bus_register() may fail if maximum number of active
connections for a bus was reached. This can be tested by creating
a custom bus with "max_completed_connections" parameter set to 0.
Add such a test to tst_qdbusconnection.

Fixes: QTBUG-34613
Change-Id: I6ae7df19bf8b6546c2a504931ba852dc15d35f78
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 23:36:15 +01:00
Marc Mutz c39fff0da5 Add missing <=> 0 operator to Qt ordering types
It's required by the standard, see e.g. [1] and the eel.is links in
the code.

[ChangeLog][QtCore][QPartialOrdering] Added three-way comparison
operator (<=>) against literal zero, available when compiling in C++20
mode.

[1] https://en.cppreference.com/w/cpp/utility/compare/partial_ordering#Comparisons

Change-Id: I8a3b76661400930c6e247cf5b138ff52bf784395
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz ccd0dc7f6d QPartialOrdering: add lower-case flags for std/Qt:: compatibility
The misspelt flags (Less, etc) make it hard to use QPartialOrdering
interchangably with Qt or std ordering types, e.g. in generic code.

[ChangeLog][QtCore][QPartialOrdering] Added a set of lower-case flags
(::less, ::greater, etc) to improve source-compatibility with
{Qt,std}::partial_ordering.

Change-Id: I160600c01c4a2ab72c7b217a306d08045e363578
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz 07ed8acdf9 QPartialOrdering: add missing conversions to/from Qt::_ordering types
Since QPartialOrdering is supposed to be a drop-in-replacement for
Qt::partial_ordering, it need to have the same conversions from
Qt::_ordering types that Qt::partial_ordering has.

Fix by adding the necessary conversion and relational operators and
conversion constructors.

Change-Id: Ib8e78c850b43c8bcb3bb15c5f7d25be9d0da7339
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:15 +01:00
Marc Mutz a0ae96e3e7 QPartialOrdering: add missing conversion from std::{weak,strong}_ordering
QPartialOrdering is suppsed to be a drop-in replacement for
std::partial_ordering, so it has to be convertible from all
std::_ordering types.

It was, however, only convertible from std::partial_ordering, and two
user-defined conversions in a row are not allowed.

Add the missing constructors. They, in turn, can then delegate to the
partial_ordering constructor.

Change-Id: I085d95677b258b4a61aabfd5468c1c43c2212766
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 23:36:14 +01:00
Ivan Solovev 3d231e27a8 Long live qCompareThreeWay()
qCompareThreeWay() is a top-level wrapper around the helper
three-way comparison methods, which is mostly convenient for
generic client code.

When implementing compareThreeWay() for Qt types, we normally
provide the implementation only for (LeftType, RightType) pair,
but not the reversed one.
However, it is expected that qCompareThreeWay() would be available
for both combinations, because the reversed result can be easily
calculated.
Solve it by providing a helper hasCompareThreeWay<LT, RT> variable
and branching the implementation based on its value.

The noexcept check is inspired by the old implementation of qSwap().

[ChangeLog][QtCore] Added qCompareThreeWay() as a public API for
three-way comparison.

Task-number: QTBUG-104113
Change-Id: I6f24494d968c336f3dcdf620004b4190769cbdb2
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 23:36:14 +01:00
Volker Hilsheimer 9bbfdd6844 QIcon: turn platform engines on by default
They are used when an icon is constructed via QIcon::fromTheme, unless
an application-defined theme provides the requested icon. Update the
documentation.

For now we don't provide a way to "opt out". This might change,
depending on the feedback during the Qt 6.7 beta phase.

[ChangeLog][QtGui][QIcon] Qt now has implementations of native icon
engines for macOS, iOS, Windows 10, Windows 11, and Android. These
engines provide access to the native icon libraries and fonts, mapping
standard icons to the corresponding native icon asset. Icons from
application-defined themes take precedence, but the last-resort fallback
icon passed as the second parameter into the
QIcon::fromTheme(QString, QIcon) overload is only used if the icon is
not available from the native library. See the QIcon documentation for
details.

Change-Id: I618e5c137c40f8e6309c0e4d4219a5a2759a475d
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 16:43:17 +00:00
Ievgenii Meshcheriakov 850fe6bea5 tst_qdbuslocalcalls: Remove casts to int in arguments to QCOMPARE
Those casts serve no useful purpose. Not having them results in
a slightly cleaner output.

Change-Id: If8ce1c680ce6f80a15534f9f4fe6d19d137f6443
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 17:43:17 +01:00
Volker Hilsheimer 5f1fffc00e QIcon: add theme icon constants
Add a list of constant string literals for a subset of icons from the
freedesktop specification. Those are icons we document to support today,
and that users might have written themes for.

Omit icons that are mime types (we have Q(Abstract)FileIconProvider
and QPlatformTheme::fileIcon for that), the "flag-aa" icon (where 'aa'
is an ISO 3166 country code, and Face* icons. Flags and Face icons can
be added as supported QIcon constants, but should then be rendered as
emojis from the respective font (they are not provided by any of the
native icon libraries or icon fonts).

We use string constants instead of an enum so that we have the same code
path for icon constants, user-defined icons, and native icons. I.e. in
addition to QIcon::fromTheme(QIcon::ThemeIcon::EditCopy), code can
request the icon for "trash.circle.fill" on Apple platforms, or
or for U"\ue5cd" on platforms where the engine is font-based; or an app
can define their own icon name and provide the assets through a theme-
description, as before.

The downside is that we cannot use arrays for looking up the native icon
for an enum-value in the engine implementations, but given that icons
are cached this is an acceptable trade-off.

To make the list of icon contants more manageable, have them in a
separate header file. Since we want those constants to live in the QIcon
"namespace", we then include that header in a declaration of a nested
struct, "ThemeIcon", resulting in e.g. QIcon::ThemeIcon::EditCopy.

Change-Id: Ic20e36ab321e6c4b20806ec0b400bba13fffc983
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 12:39:06 +01:00
Tinja Paavoseppä 2ed64adb9f Android: Skip focusProxy_QTBUG_51856() test case temporarily
Running the test case leads to multiple calls to show the software
keyboard, which due to Android QPA implementation leads to the
keyboard being shown during subsequent test cases, leading to
random failures. Skip it temporarily on Android until the
Android QPA implementation is fixed.

Task-number: QTBUG-119574
Change-Id: I29f234fe08cb33358cb5cb0f8e51b1cc0f8e8906
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Tinja Paavoseppä <tinja.paavoseppa@qt.io>
2023-12-07 10:56:43 +02:00
Tinja Paavoseppä 97625e84b1 Android: Skip showAndMoveChild() test case temporarily
grabWindow() currently returns a null QPixmap on Android due to even
raster windows being backed up by OpenGL/QRhi. The test case uses
grabWindow() internally to grab contents to a pixmap and comparing
whether the pixmap contents are as expected, leading now to failures
due to null QPixmap being returned.

Task-number: QTBUG-118849
Change-Id: I51cda2d43fe482252d5604f6b18281d810aa4d2f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 10:56:43 +02:00
Volker Hilsheimer 76b58be4b8 QIcon: don't rely on getting a null-icon in test
If a QPA-provided engine provides an "edit-cut" icon, then it won't be
null. We cannot reliably test that the icon came from the fallback theme
as the cacheKey of the icon doesn't change (the proxying to a different
theme is handled internally by the QThemeIconEngine).

That the cacheKey of a QIcon doesn't change even if the pixmaps we get
from it change is not a problem in practice; QIcon is a named container
for  transient graphical assets that might change for reasons outside of
Qt's control (such as color scheme, or display resolution).

Change-Id: I695e8ad0c8f0aec7f17a2c242e64b615178b78b5
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2023-12-07 09:34:12 +01:00
Christian Ehrlicher 4e6f7ad26c QTabBar: properly calc tab positions when changing tab position
The previous attempt to fix this bug did not work out well since it
tried too hard to avoid double calculations. Therefore restore the old
behavior and fix makeVisible() instead.
This amends 1082038bd8

Pick-to: 6.6 6.5
Fixes: QTBUG-119366
Change-Id: I738a3cd3537ecf0983480d2f961f45f81d101bd9
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-07 08:41:01 +01:00
Marc Mutz 2d052b038d Check that QMulti{Map,Hash} (still) store in reverse insertion order
It's wrong, but let's not break it unconsciously.

Pick-to: 6.6 6.5
Change-Id: Ic3daa7df4db2ef34ff5d08fddecf9a932ad92156
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2023-12-07 07:16:23 +02:00
Marc Mutz 3c0fdd7341 tst_ContainerApiSymmetry: check value_types with a const member
QVarLengthArray is the only Qt container currently known to be fine.

std::vector is supposed to be fine, too, since C++14. Turns out that
libstdc++ gets resize(n, v) wrong, though, because it never
implemented the resolution to wg21.link/lwg2033. Known issue, linked
in code comment. Worked around for the time being. Keeping std::vector
in, though, because in this test suite we do cross-check with
std::vector, and other platforms, and most of GCC's std::vector
functions, adhere to the standard.

Pick-to: 6.6 6.5
Change-Id: I26e11c4a100695c604cebcf7e14a1ae5078d9ec7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-07 06:16:23 +01:00
Marc Mutz 5f775e6719 Fix QStringConverter::encodingForName() for trailing `-`, `_`
The (internal) docs say that - and _ are ignored, and they're ignored
everywhere, except as suffixes. If the old code only ignored them as
infixes, fine, that would make some sense, but it ignored infixes and
prefixes, so there's no reason for it to not ignore suffixes, too.

Fix by continuing the loop until both input ranges are exhausted, or a
mismatch was found.

[ChangeLog][QtCore][QStringConverter] Fixed a bug where
encodingForName() failed due to trailing characters (`_`, `-`) that
ought to have been ignored.

Pick-to: 6.6 6.5
Change-Id: Iec21489d988eda7d33c744c170f88cd665b73f34
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 05:16:23 +00:00
Marc Mutz 091793ccaa qcomparehelper.h: simplify compareThreeWay() SFINAE helpers
There's no restriction on the number of enable_if's in a
template-initializer, so simplify the compareThreeWay() constraints by
having separate constraints each for LeftType and RightType. Fewer
templates to instantiate = faster compile speed.

As a drive-by, drop remove_reference_t. We control all users and all of
them pass already-decayed types.

Change-Id: I17c01c7aa1ac03bb6db4b0bef1371ebc0641641d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-07 06:16:23 +01:00
Ivan Solovev 4b755bc11a Teach Qt::compareThreeWay() to support native float16 types
Provide a custom variable template to detect float types and
specialize it for QtPrivate::NativeFloat16Type.
This will allow to enable three-way comparison for qfloat16.

Task-number: QTBUG-104113
Change-Id: Id12c42c86f8dc9e233fe39776b0f0e28088de9e1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-12-07 06:16:23 +01:00
Marc Mutz 7f5b795f75 QSpan: ensure interoperability with std::span
We accepted QSpan as a NIH-type instead of waiting for C++20 and
std::span, because we said that there's no impedance mismatch between
the two, as they both implicitly convert into each other.

But we actually never checked that they do.

Fix this omission by adding constructors that treat std::span exactly
the same as QSpan itself, and adding the respective static_assert()s
to tst_QSpan to check that (within the constraints imposed by the
standard on std::span), they actually do convert into each other.

The only two problematic cases are that fixed-size std::span
constructors are explicit, so span is only constructible, not
convertible, from QSpan. Likewise, for an rvalue QSpan to be
acceptable to the std::span constructor, QSpan needs to opt-in to
enable_borrowed_range (while we're at it, do enable_view, too).

We so far have rejected adding these opt-ins for our own container
classes because we wanted to avoid the compile-time overhead of
including the huge <ranges> header into such central headers as those
that define our containers.

But std::span itself has to specialize these traits, and its range
contructor has to use them, so they must be available from <span>,
too, possibly the stdlib puts the definition into a much smaller
header. So just assume we can specialize it after including just
<span>, provided __cpp_lib_concepts is also defined.

Pick-to: 6.6
Change-Id: I2202869b60c98047256b0fbcb12336f5d8e550ba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 02:46:22 +01:00
Marc Mutz c851fb2456 QSpan: check conversion from initializer_list
The docs at cppreference.com hint at a corresponding ctor being added
for C++26 (though I don't see it in eel.is/c++draft, yet).

Even so, replacing former initializer_list functions with QSpan ones
is definitely one of the upcoming use-cases, so test it.

Can't use from_container_impl() here as initializer_list<T> is already
immutable, so QSpan<int> is not compatible, only QSpan<const int>.

Pick-to: 6.6
Change-Id: Iecdf29e629d48313edd5e56d358b9137da76deb6
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-12-07 02:46:13 +01:00
Christian Ehrlicher d4d40aee94 Tests: remove blacklisted CIs no longer available
Remove the following CIs from BLACKLIST files as they are no longer
used:
  - msvc-2015
  - msvc-2017
  - windows-7sp1
  - opensuse-42.3
  - ubuntu 16.04/18.04/20.04
  - rhel 6.6/7.4/7.6
  - redhatenterpriselinuxworkstation-6.6

Change-Id: Ief9550e3455a1ed211d978933262c8d5557b0fec
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-12-06 22:07:44 +01:00
Marcin Zdunek 65756f65db Skip tests that resize on EGLFS
EGLFS doesn't allow resizing on top window. These testcases pass on CI, as "eglfs" is not tested, only "offscreen".

Task-number: QTBUG-115777
Change-Id: I6fb09c93e1863b2c9ed9e122078761e6b6e64889
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-12-06 21:47:03 +01:00
Laszlo Agocs bb1d9bab36 rhi: Make sample count selection logic be closer to Qt 5
Pick-to: 6.6 6.5
Fixes: QTBUG-119148
Change-Id: Ia119ab3ced9da08853c608aa256bde08a6fd8d4e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-12-06 19:01:19 +01:00
Marc Mutz 3a57885c37 tst_tostring: support computed expected values
We need an owning container to keep the data alive when the _data
function computes the expected value instead of passing it as a
literal string, so replace the QByteArrayView we used so far with a
const QByteArray.

If a test failed, print the tail ends of the failing strings. This
is useful when toString() implementations printing the operands of
the failed toString()-under-test result comparison decide to
truncate the output. It works around the fact that we both test
toString() and use toString() to report any failure.

As a drive-by, add a missing blank line between function definitions.

Amends a2551c45d4.

Pick-to: 6.6
Change-Id: I0b217aeb1a6d475df8e8b9fb821046f1cceb1a3e
Reviewed-by: Jason McDonald <macadder1@gmail.com>
2023-12-06 09:46:55 +00:00
Marc Mutz 6e41101217 tst_QCompare: restore some test coverage to QPartialOrdering
When I split Qt::partial_ordering off of QPartialOrdering, O
duplicated the partialOrdering() test, but lost the conversion() part
of the tests.

This patch brings them back.

Because we maintained the test coverage for Qt::partial_ordering, it
suffices to check that QPartialOrdering::X correctly maps to
std::partial_ordering::x. The rest follows from transtivity of
equality.

We're still lacking conversions of QPartialOrdering to Qt::_ordering
types. That will be the subject of a follow-up patch.

Amends 4b6f757020.

Change-Id: I1938d09f696ed8d58143dbacccb72cfd54ca12dd
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-05 23:04:30 +01:00
Marc Mutz ee623402df tst_QCompareHelpers: extract Qt/std-mapping into public header
We'll need this elsehere, too.

Change-Id: I91a35a23dd201f7867898cee5b4d6743883f71fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2023-12-05 22:56:45 +01:00
Marcin Zdunek f6831d08c4 Skip test cases that resizes window on eglfs_viv on VxWorks
This change is required when running in real hw with eglfs backend. It passed on CI because CI used "offscreen" backend and eglfs is not tested on CI at the moment.

Task-number: QTBUG-115777
Change-Id: I4bbfbedcbe21c5c2041be9bdb8ae370156bb6200
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2023-12-05 16:46:45 +00:00
Assam Boudjelthia 7a9bc220c7 Android: fix and simplify the orientation change logic
Move the orientation change handling to the display manager
and call it from the relevant places to repeated and scattered
code for the same functionality.

Bring back part of 072387edec
which checks discard a resize event that's not valid that
reports not up to date layout size.

If DisplayManager.DisplayListener.onDisplay() initiates the
orientation change, handle it immediately if we don't expect
the size to change, i.e. if the orientation is changing from
portrait to inverted portrait and vise versa for landscape.
Otherwise, expect the change to be initiated again shortly
after from QtLayout.onSizeChanged().

Also, add improve the unit test of the orientation change,
and test for the widget size after such changes to make
sure QTBUG-94459 is not reached again.

Fixes: QTBUG-119430
Task-number: QTBUG-115019
Task-number: QTBUG-94459
Change-Id: I5f060d91531af677ddf891f2af360d5f399e26e5
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2023-12-05 16:28:12 +00:00
Ievgenii Meshcheriakov 2c3116b8d2 tst_qdbusabstractadapter: Don't skip tests
The tests were skipped since 2018 due to QTBUG-66223.
The tests were never re-enabled even though the issue log indicates
that failure were not reproducible anymore.

Task-number: QTBUG-66223
Task-number: QTBUG-59336
Change-Id: I96ddfb2cd4ddbcac82feddcd15279e218104a9b4
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-12-04 20:44:36 +01:00
Tor Arne Vestbø bc6c44d004 Unskip tst_QApplication::testDeleteLater() on macOS
It passes locally, let's give it a shot in the CI.

Fixes: QTBUG-24318
Change-Id: I7df735bdc7963c9c1a8ad8befdc0642f796c32a1
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2023-12-04 19:12:52 +01:00
Volker Hilsheimer 3156d7b778 Blacklist tst_Http2::duplicateRequestsWithAborts on QNX
It fails frequently. Might have to blacklist the entire test case, or
even skip when running on qemu, if this doesn't help.

Task-number: QTBUG-119616
Pick-to: 6.6
Change-Id: I446612c0fb5b2afc021aeb2fab9be010ac071acd
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2023-12-04 16:04:18 +01:00
Marcin Zdunek 8e97af265d Disable timezone which is not supported on Vxworks
Task-number: QTBUG-115777
Change-Id: I69bf26d2e752d76d06edf569766d4298fb4fd1a8
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-29 16:08:56 +00:00
Alexandru Croitor 832eda3beb CMake: Remove deprecated PUBLIC_LIBRARIES option in wasm tests
Tests should only use the LIBRARIES option.

Pick-to: 6.5 6.6
Change-Id: I3c1e4a563448e8f97219c10566cea921a2807abc
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
2023-11-29 15:00:57 +00:00
Ivan Solovev 7a3fed3f20 QTimeZone: use new comparison helper macros
The class had operator==() and operator!=() defined as public member
functions, so use QT_CORE_REMOVED_SINCE and removed_api.cpp to get
rid of these methods and replace them with hidden friends.

Extend unit-tests by using the helper functions from QTestPrivate.

Task-number: QTBUG-104111
Change-Id: Ib9ca613005e2f1521dea5e3cd9e2baa0b47fede4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-11-28 21:30:58 +01:00
Ivan Solovev 96f494bf92 Implement helper Qt::compareThreeWay() function for built-in types
The helper function

 RetType compareThreeWay(const T &left, const T &right) noexcept;

is used for C++20-comparison macros. Normally it's the user's
responsibility to provide this function as a hidden friend of the class
which uses the comparison helper macros.
For built-in types we provide the implementation inside the Qt
namespace.

We have to use custom IsIntegralType trait because libstdc++ only
treats __{u}int128_t types as integral when compiling in -std=gnu++XX
mode, and we compile Qt in -std=c++XX mode.

This patch provides the implementations only for compareThreeWay()
overloads, because there is no need to implement comparesEqual() for
built-in types. It would just be equivalent to calling operator==(),
so the user can do it directly.

Task-number: QTBUG-104113
Change-Id: I7b3f395458e1ee4c64f442ad48bbf4fec4c19c52
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-28 21:30:33 +01:00
Ivan Solovev fe12650e9d Implement compare helper macros
These macros should unwrap into a proper set of equality and ordering
operators, depending on the C++ standard being used.
For C++17, all 6 operators (==, !=, <, >, <=, >=) are overloaded, while
for C++20 only the overloads for opeartor==() and operator<=>() are
provided.

The macros are documented as internal for now.

The macros rely on two helper functions:
  bool comparesEqual(LeftType lhs, RightType rhs);
  ReturnType compareThreeWay(LeftType lhs, RightType rhs);

The comparesEqual() helper function is used to implement operator==()
and operator!=().
The compareThreeWay() helper function is used to implement the four
relational operators in C++17, or operator<=>() in C++20.
ReturnType must be one of Qt::{partial,weak,strong}_ordering.
When possible, the functions should also be declared constexpr and
noexcept.
It's the user's responsibility to provide the functions before
using the macros.

Implement a test case which applies the new macros to the dummy
classes, and uses the new helper function to verify the comparison
results.

The MSVC compiler before version 19.36 has a bug, where it fails
to correctly generate reverse opeerators in C++20 mode. Introduce
a new Q_COMPILER_LACKS_THREE_WAY_COMPARE_SYMMETRY definition for such
compiler versions, and use it to manually generate reversed
operators when needed.

Task-number: QTBUG-104113
Change-Id: Idc19d55df011fd616ff654f35a964e831b8ab93b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2023-11-28 20:30:19 +00:00
Edward Welbourne 5108192f67 Clean up QDate(Time)?::fromString() test-data tables, adding a column
The new column is currently unused, added for the benefit of an
imminent change, but adding its value was going to change every data
row, making the new rows with a different value there hard to see amid
the diff.

So add the unused value to the existing data rows and clean them up in
the process:
* Use modern string literals
* Split lines (that need it) in a consistent way
* Give test-cases not-entirely-meaningless names.

Change-Id: I9abdd24b7bb945796878c664d2ed82ca6c409fc1
Reviewed-by: Isak Fyksen <isak.fyksen@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-28 19:59:49 +01:00
Sami Shalayel 26f0eaba52 do not override initial AUTOMOC_MACRO_NAMES value
The CMake documentation states that the AUTOMOC_MACRO_NAMES property of
a target is initially set to CMAKE_AUTOMOC_MACRO_NAMES, so do not
override it in qt_enable_autogen_tool.
Instead, append the extra macro names not set by the upstream CMake
CMAKE_AUTOMOC_MACRO_NAMES variable.

Add a test for this.

Change-Id: Ib0ef28e7fc9c5f9559150bbe73ffdeac767adc82
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2023-11-28 19:59:49 +01:00
Edward Welbourne 4f05ffeb41 Restore ASN.1 Element tests after move to plugin
When SSL backends were broken out as plugins, various tests were
suppressed since the code they test is now in a plugin, no longer part
of the network libraries.

The ASN.1 test is, however, fairly self-contained, so just compile it
with the relevant plugin sources (which are likewise self-contained)
and brute-force the paths to line up for the test.

Task-number: QTBUG-46843
Change-Id: I778489e68b7361a7fd55c88d2a35257ad6a58c46
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2023-11-28 19:59:49 +01:00
Eirik Aavitsland 7706c2a28e Raster painting: Correct the coordinate rounding in drawPoints()
When using the cosmetic stroker (i.e. plain pens with effective line
width of 1), drawing points with fractional coordinates >= 0.5 would
fill the wrong pixel.

This is a long-standing bug where the drawPoints() code in the
cosmetic stroker code was missed during the painting coordinate system
shift for Qt 5.0. Prior to that, coordinates were interpreted as the
upper left corner of a pixel, so rounding fractional coordinates to
the closest integer would be the correct way to determine the pixel to
be filled. From Qt 5 onwards however, coordinates instead designate
the center point of the primitive to be stroked. In order to determine
which pixel is most covered by the unit square centered in the given
coordinates, fractional coordinates must be rounded downwards
(floored).

This fix makes the behavior consistent between the cosmetic and
non-cosmetic stroker, so that drawPoints() with e.g. penwidths 1 and
1.01 in practice fills the same pixels.

Pick-to: 6.6
Fixes: QTBUG-119306
Change-Id: I39cb7ad55229553dda098e6fbc9ee449b1fd9664
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
2023-11-28 19:47:56 +01:00
Ahmad Samir bacee888ac tests/manual: fix compiler warnings about missing override keyword
Change-Id: I878c430faf97328a3faf15692c252ba1e8e3482f
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2023-11-28 16:11:59 +02:00
Ievgenii Meshcheriakov 86cfafcb5a qdbuscpp2xml: Register QtDBus metatypes
Explicitly register QtDBus-specific metatypes before attempting
to generate output. This fixes a bug when types like QDBusObjectPath
are sometimes ignored by this tool. Export QDBusMetaTypeId::init()
for that reason. Add a regression test to tst_qdbuscpp2xml.

Fixes: QTBUG-34550
Change-Id: I16faa79a794d09a26bad45e18730379681a20b50
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-28 13:37:56 +01:00
Thiago Macieira 878e3342e1 QFactoryLoader: add metaDataKeys() to return just the "Keys" entry
Without parsing the whole metadata structure into a QCborValue.

QFactoryLoader::indexOf() is only used in the icon engine and
accessibility loaders. QFactoryLoader::keyMap() has more users, but
QFactoryLoader::metaData() is still by far the most used interface.

Task-number: QTBUG-114253
Change-Id: I8bd6bb457b9c42218247fffd179753524fc9b6a5
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2023-11-28 03:14:03 -08:00
Thiago Macieira 4a432a7617 QFactoryLoader::instance(): don't fully parse static plugins' data
Commit d9766ddc3d (Qt 5.12) replaced the
use of the old binary JSON format with CBOR, which is more compact and
standard, but requires actual parsing instead of just a quick size
verification. For regular, loaded plugins, the metadata is stored in
parsed QCborValue format, but for static plugins, we were re-parsing
each staticplugin's metadata for every single call.

This avoids a full parsing and only parses the CBOR header to find the
IIDs (moc always outputs the IID first).

Fixes: QTBUG-114253
Pick-to: 6.6
Change-Id: I8bd6bb457b9c42218247fffd179750ec6c9e3252
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2023-11-28 03:14:03 -08:00