Commit Graph

13786 Commits

Author SHA1 Message Date
Edward Welbourne
02d130db7e Avoid duplicate descriptions in TAP's incident YAML
When a B?Fail's description doesn't match the QVERIFY/QCOMPARE
regexes, it got output as a comment in the YAML block after the test
line had already reported it as a TODO comment. An empty description
would also have lead to an empty comment in the YAML block. Condition
this fallback output case on there being a description that hasn't yet
been reported in the test line.

Task-number: QTBUG-96844
Change-Id: Id7fe81d26ddb01da3d8003ada8fa590a5e1a166f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-22 17:43:13 +01:00
Edward Welbourne
58b0d72f8d TAP test logger: treat blacklisted XFail the same as XFail
In all places but one they were treated the same; fix that last one to
match the rest. This removes one line from the YAML block for each
blacklisted XFail test; in each case, this message duplicates the one
on its "not ok ... # TODO..." test line.

Change-Id: Iff2028afccd979db7f2c84e85d1b78541900008e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-22 17:43:13 +01:00
Samuel Mira
2ba3cde348 Android: Blacklist failing tests on tst_QGraphicsProxyWidget
Backlist failing tests on Android. To be fixed later.

Task-number: QTBUG-100470
Task-number: QTBUG-101888
Pick-to: 5.15 6.2 6.3
Change-Id: Iaa33b555f6063702af683c683e0b07ce2910fe13
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-03-22 17:49:05 +02:00
Pasi Petäjäjärvi
5c85b0c7a4 CI: QNX qemu need docker service ports explicitly defined for visibility
Network autotests cannot connect to services on docker containers from
QNX qemu without all ports explicitly defined (both host and container)
side.

Pick-to: 6.2 6.3
Task-number: QTQAINFRA-4684
Change-Id: Iba44cfa17d42d43ecec3e29985e404f75d5fc232
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
2022-03-21 22:30:01 +02:00
Ulf Hermann
908ee8aab1 QProperty: Allow manual scheduling of binding notification
In some situation we want to notify even if the value didn't change.

Task-number: QTBUG-101771
Pick-to: 6.2 6.3
Change-Id: I7d82a9f6e0f7d5eb48065e3f428b814939181ea8
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-21 20:41:23 +01:00
Volker Hilsheimer
c924c05ae2 Replace deprecated QColor::fromString in tests and documentation
Don't use deprecated methods in tests, and don't refer to them in
documentation.

Change-Id: I110480742d9a7b9b0a2e194e3fe610208c1e07da
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-21 20:41:23 +01:00
Øystein Heskestad
eaabd0c545 QAnyStringView: constexpr detect 8-bit ASCII as Latin 1
This has performance benefits when doing comparisons.
The check is only performed at compile time.

Task-number: QTBUG-101014
Change-Id: I55694b045fe5e75d9671d0a3a70c80d998cf98c8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-21 20:36:23 +01:00
Volker Hilsheimer
f3466fad53 Build QMenuBar test without warning
Adapt to changes in QWidget::addAction API from 08e4d2db08.

Pick-to: 6.3
Change-Id: If6e05b47de88cf55070238f08b96586b855cc5c1
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-20 23:19:03 +01:00
Sona Kurazyan
d0f9e593d4 Rename tst_qlatin1string and switch to using QLatin1StringView
Task-number: QTBUG-98434
Change-Id: Iec477835880263175edbc03f21b40f1ad67dbef0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-19 18:51:08 +01:00
Marc Mutz
c52ebb3aba QRect: add toRectF()
For symmetry with QRectF::toRect().

[ChangeLog][QtCore][QRect] Added toRectF().

Fixes: QTBUG-73160
Change-Id: If2bda64b8fe4bc113191dda927e9bb86ebcb4c69
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-19 12:02:24 +01:00
Marc Mutz
5dc570f8b1 QLine/QMargins: add toLineF/toMarginsF()
For symmetry with QLineF::toLine().

[ChangeLog][QtCore][QLine] Added toLineF().

[ChangeLog][QtCore][QMargins] Added toMarginsF().

Task-number: QTBUG-73160
Change-Id: I69051cdd2fe4a3c0a000ab86e363a2918a7aea7c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
2fb0135efa QSize/QPoint: add toSizeF/toPointF()
For symmetry with QSizeF::toSize().

[ChangeLog][QtCore][QSize] Added toSizeF().

[ChangeLog][QtCore][QPoint] Added toPointF().

Task-number: QTBUG-73160
Change-Id: I65b088b4f7365ab671ef2f0c75821b707f5ac26d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
f97daab7a6 QObject: restore flags printing in dumpObjectTree()
This was lost when QtCore, QtGui and QtWidgets were split up. Restored
now via a virtual function on QObjectPrivate.

Chose to return std::string instead of QString or QByteArray because
its SSO is usually sufficient to hold these flag strings.

[ChangeLog][QtCore][QObject] Restored printing of Qt3-style
information from dumpObjectTree().

[ChangeLog][QtWidgets][QWidget] Restored printing of Qt3-style
information from QWidget::dumpObjectTree().

Fixes: QTBUG-101732
Change-Id: I39ff5728ea5f5abbdbf81b5d7e13b8d16b6ee8b7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-19 12:02:24 +01:00
Marc Mutz
6ec1dc904d QSettings: port key processing to QAnyStringView
... in preparation for replacing the QString keys in the public API
with QAnyStringView ones.

This removes the "important optimization" that avoids a detach in the
common case where the input is the same as the output of
normalization. But that optimization is beside the point, because it
trades a memory allocation avoided in the library for O(N) allocations
inserted into user code for each call to QSettings::value(), the vast
majority of which are calls with string literals.

With the public interface ported to QAnyStringView in the follow-up
patch, we can then internally optimize memory allocations _in a central
place_ (e.g. by returning std::u16string or QVarLengthArray<QChar> from
normalizeKey() instead of QString). But first we need to get rid of all
the unwarranted allocations in user code.

Change-Id: I45fc83d972c552a220c9c29508001d3f172e1162
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-19 07:09:55 +00:00
Volker Hilsheimer
5e566ab373 When clearing selected items, iterate over a copy of the QSet
Selection change handlers of the items might call a method that
implicitly recreates the selectedItems QSet, which then invalidates
the iterators of the ranged for loop, resulting in crashes.

Iterate over a copy of the set instead.

Add a test case that crashen without the fix.

Fixes: QTBUG-101651
Pick-to: 6.3 6.2
Change-Id: I6da6f4043fe1906b0186931a37283f635cb5a404
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-18 21:56:19 +01:00
Luca Di Sera
33d62de7c8 Enable move semantics for QTemporaryDir
Add move constructor and move assignment operator.

To allow for the the change to be implemented QTemporaryDir, the
internal d_ptr was modified from a QScopedPointer, which is not movable,
to a raw pointer.

Add member + free swap implementations.

Add tests.

[ChangeLog][QtCore][QTemporaryDir] Enabled move semantics.

Change-Id: I9f196a77c70b4ca0b7f0c06505d00fdd87a9785c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-18 20:56:19 +00:00
Ivan Solovev
30830e0cba Android: use empty Intent to clear clipboard data on API < 28
ClipboardManager didn't have any APIs to clear clipboard data before
API level 28.
As a workaround an empty Intent with MIMETYPE_UNKNOWN is created and
inserted into the clipboard for lower API levels.
This makes the QApplication::clipboard()->clear() method work more or
less as expected.
This allows to unblacklist tst_QPlainTextEdit::copyAvailable().

Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I454376199cf3b8eed0fa2ecf2f85b87f40892280
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-18 18:35:03 +01:00
Marc Mutz
9985cc330a uic: use C string literals for setObjectName()
Because setObjectName() now takes a QAnyStringView, passing C string
literals is much more efficient than using QString::fromUtf8().

This patch only deals with setObjectName() as a known property,
probably from a name attribute. If the objectName property is set by a
<property> element (or so I assume), we still emit a
QString::fromUtf8(). Detecting objectName there would be too much
magic.

Besides, I haven't been able to find why sometimes there's a second
setObjectName call right after the first, when in the XML it seems all
kosher (name attribute and objectName <property> agreeing on the
content).

Change-Id: Icf07bad841ac735a9c744bbd955428ba15758089
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-18 18:35:03 +01:00
Janne Juntunen
a5ee74754d tst_qopengl: set surfaceType explicitly
Parent window in sizeLessWindow test was using software pipeline at
least on webOS, causing a QCRITICAL() exit when the test was executed.

Fixes: QTBUG-101869
Pick-to: 6.3
Change-Id: Ie8cc0ea0b6a09729475389be44197e01a45b217f
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2022-03-18 13:02:11 +02:00
Giuseppe D'Angelo
1b14569753 QMutexLocker: strenghten the locking operations
There is no reason to allow relock() on a locked locker, or unlock()
or an unlocked one, just like we don't allow that on a plain mutex
to begin with. The docs already said that e.g. relock() locks an
_unlocked_ locker.

[ChangeLog][QtCore][QMutexLocker] QMutexLocker allowed relock() and
unlock() on an already closed (resp. open) locker object. These
semantics have always been undocumented and are now unsupported
(in both cases they yield undefined behavior.)

Change-Id: Id5f67beb5dc30d6435dae88a3085fba93ec7d96e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-18 05:18:28 +01:00
Edward Welbourne
e10d613509 Add QByteArray::percentDecoded() as an instance method
Percent-decoding was previously only present as a static method taking
a QBA parameter; it might as well be an instance method of that
parameter. Change most QBA tests to use it rather the static method.

[ChangeLog][QtCore][QByteArray] percentDecoded() is now available as
an instance method of the byte array to be decoded, equivalent to the
static QByteArray::fromPercentEncoding().

Change-Id: I982101c44bdac5cc4041e85598d52ac101d38fa1
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-18 01:22:54 +01:00
Sona Kurazyan
73e7fc2d8e Fix a few more {QString, QByteArray}::count() deprecation warnings
Change-Id: I0be2d5e7a8f6af3bc1077ae6d1f20cc5da8f2266
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-17 21:03:08 +01:00
Allan Sandfeld Jensen
173dd2a033 Fix lancebench after lancelot restructuring
Pick-to: 6.3 6.2
Change-Id: I5e17230761ca5482b3376787afab29d15de58dac
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-17 18:57:47 +01:00
Giuseppe D'Angelo
20d0ff1a39 QMutexLocker: add move semantics
The class is similar to unique_lock in that it allows for unlocking
and relocking. Since the locked state is tracked by QMutexLocker itself,
it's trivial to make it movable.

[ChangeLog][QtCore][QMutexLocker] The class is now movable.

Change-Id: I534044f8024575e996c12efb2236761d493798a3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 18:57:47 +01:00
Fabian Kosmale
8f73b25e52 Benchmarks: Do not depend on transitive includes
Change-Id: I1d0dbfca130f43d76de2d6ac585a0f242d490b5a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 17:14:37 +01:00
Fabian Kosmale
819e1bf91d Tests: Do not depend on transitive includes
Change-Id: Ibc6a948480a904913a5427e6408d4d296784fb4f
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-17 17:14:37 +01:00
Giuseppe D'Angelo
5089db0303 QFuture: fix QtFuture::connect corner-cases
Connecting to nullptr, or connecting to a non-signal PMF, would result
in a QFuture which would never finish. Catch these cases and handle
them.

Windows+MSVC for some reason fails the test. I can't entirely understand
why, so I've marked it as XFAIL, with QTBUG-101761 to track it.

Change-Id: I314980e7e9b7156d8cddd3b33d5cbf1d0bcd6116
Pick-to: 6.2 6.3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-03-17 17:14:36 +01:00
Alexey Edelev
8adacba3e6 Add VERBATIM option to add_custom_command calls
Use VERBATIM option to prepare the correct command line for the
add_custom_command. This especially sensitive when using build
directories with names containing special symbols, that cannot be
handled by shell correctly.

Change-Id: I51d7041cb806411135fd59bf6273c04a3c695443
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-17 15:15:06 +01:00
Sona Kurazyan
893dd5d7be Add QStringView::localeAwareCompare()
QString already has a localeAwareCompare(QStringView, QStringView)
static method. Use it in QStringView::localeAwareCompare(QStringView).

[ChangeLog][QtCore][QStringView] Added
QStringView::localeAwareCompare().

Task-number: QTBUG-98431
Change-Id: Iec3865a5439d9fb653cc1150da21042186bdee98
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 14:27:45 +01:00
Sona Kurazyan
b86b22cfde Move localeAwareCompare tests from tst_qstring to tst_qstringapisymmetry
Pick-to: 6.3 6.2
Change-Id: I3c395d989e4659ebfa24b78f34b2a99769b734dc
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-17 14:27:45 +01:00
Liang Qi
f08e57540d GUI: add ScreenWindowGrabbing capability
On Wayland, there is no protocol to do it yet.

Task-number: QTBUG-100792
Task-number: QTBUG-101145
Change-Id: Id72625a8161359111a2d0f43f3215e787778ba6b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-17 14:27:44 +01:00
Eirik Aavitsland
9619cec279 Baseline testing: Fix overriding of Project property
Remove some kludgy, redundant and never used functionality for setting
project and test case names, as it also hindered overriding those
properties at runtime.

Pick-to: 6.3 6.2
Change-Id: Ibef7d7d0cb5fc1e462752f2ba2db76cc088dbd48
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-17 14:27:44 +01:00
Marc Mutz
9f8da21239 QDateTime: future-proof swap()
In Qt 7 32-bit builds, the ShortData will be larger than the
d-pointer.

So don't swap() the d-pointer, but a) delegate to Data to swap itself
and b) swap the ShortData there, adding a static_assert in the .cpp
file that triggers when the assumption that ShortData is always at
least as large as a pointer is violated.

Found while porting away from overly-generic qSwap(), so done that,
too.

Task-number: QTBUG-97601
Pick-to: 6.3 6.2
Change-Id: I5139da58d99e9491a582ff2cb2f817cd96952044
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-17 06:14:58 +00:00
Laszlo Agocs
bc54031d57 Exercise reparenting more in QOpenGLWidget autotest
Change-Id: I771250ba889835e886c2801066ef023d82c5186d
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2022-03-17 05:34:55 +00:00
Giuseppe D'Angelo
979ee48ca1 QObject: add another couple of tests for broken connect()
Connecting to a non-signal should fail, but apparently it doesn't on
Windows+MSVC under certain conditions.

Task-number: QTBUG-101761
Change-Id: I3e014660e4e5b287242e32307f677bb22ab10a39
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-17 01:02:15 +00:00
Tatiana Borisova
715420095a Fix has_signaling_NaN usage for INTEGRITY
- The newest GHS compiler versions set the value of has_signaling_NaN to False.
  Add compilation and autotest fix for GHS-compiler 2021/2022 releases.

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I45e5da6759a15c60c17f896e565002cbba8524ed
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 20:09:37 +02:00
Marc Mutz
1977c922e9 QFlatMap: make insertion STL-compatible
That is, insert() doesn't overwrite an existing entry, and range
insert inserts the first of equivalent keys' values, not the last.

This allowed this author to optimize the implementation of
makeUnique() to a O(N) algorithm (was: O(N²)). Said optimization would
have been possible with the old semantics, too, but I wrote the
algorithm first and only then noticed the broken insert() behavior is
present on QFlatMap, too, so I decided not to let good code go to
waste and to fix both problems at the same time.

In order to give users a hint of the changed semantics, make the new
API opt-in until Qt 6.5, so Qt 6.4 ships with the both the old and the
new semantics disabled, where they contradict.

Fixes: QTBUG-100092
Change-Id: Ic96d8bfe6bed9068dbe8c0d7171bd8921050fd95
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-16 18:28:27 +01:00
Volker Hilsheimer
58a14d9433 Enable tests to turn off Windows Vista animations
Animations in that style depend on the current time, which makes it
impossible to run baseline tests. Introduce a dynamic property that
allows us to set the time that animations use.

This way, tests can turn the animation off, or control which time should
be used.

To keep performance overhead low, check only once whether the dynamic
property is set at all.

Pick-to: 6.3
Change-Id: I9bc57b9867fb0d852e101570eca4c7609e7fe1a8
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-16 15:56:17 +01:00
Alexandru Croitor
21bffeec90 CMake: Add deployment auto test
Add a cmake test that builds a simple widgets application, installs
it, in a shared Qt build deploys the runtime dependencies and then
runs it to confirm that the app works.
With a static Qt, the installation of the runtime dependencies is
skipped, but the app should still run.

The test is expected to pass only when targeting Windows and macOS
(both when using shared and static Qt).

Pick-to: 6.3
Task-number: QTBUG-98545
Change-Id: I41b616e1e1fc463d57c64be9273ed4dc755e9187
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-03-16 15:56:17 +01:00
Marc Mutz
e74e27e67e QObject: give some TLC to dumpRecursive()
In no particular order:

- use the variable field width feature of QString::asprintf() to
  generate the indentation implicitly, instead of fill()ing a
  QByteArray with the desired number of spaces

- just default-construct 'flags', don't assign an empty string

- use qUtf16Printable() to avoid funneling UTF-16 data through 8-bit
  encodings

- use a C++11 ranged for instead of a counted loop

- remove a pointless isEmpty() guard (the loop won't execute when the
  children().isEmpty())

- avoid copying object->children() (returns by cref, so it's also ok
  to stuff it directly into the ranged for loop).

Add a test.

Pick-to: 6.3
Change-Id: Ie7314713cb48de7e890cdee0760c0361dd24fd18
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-16 02:26:56 +00:00
Andreas Buhr
50f6356f8e Repair some of tst_qtableview tests on Android
The test task191545_dragSelectRows relied on the fact
that the view is not scrolling. But on a small screen,
it scrolls automatically.

Fixes: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: I691361c965ab03d8a012f2b83715c7c96d990ec5
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Marc Mutz
f3c340c276 QStringTokenizer::toContainer(): allow more types of target containers
The previous constraint called for the value_type of the container to
exactly match the value_type of the tokenizer, which means
toContainer() could only ever work on containers of views. But there
is value in allowing QStringList, even though it works only on QL1S
needles (QStringView -> QString isn't implicit). But users may have
other types that for better or worse implicitly convert from views, so
we shouldn't over-constrain the function.

[ChangeLog][QtCore][QStringTokenizer] toContainer() now works on
containers whose value_type can be constructed from the tokenizer's
value_type. It no longer requires an exact match.

Fixes: QTBUG-101702
Change-Id: Ie384cd1c4b51eaa57675f2a014141ceec8651c81
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-15 21:05:31 +01:00
Assam Boudjelthia
a818885a3d Android: expect QPlainTextEdit::canPaste() to fail after clipboard clear
Android 9 introduce an API call to clear the clipboard, before that
it wasn't possible to do that, the test QPlainTextEdit::canPaste()
should expect that to fail.

Pick-to: 6.3 6.2
Task-number: QTBUG-100470
Change-Id: Ie2d8aabf77672c62b3a6c72a080a4e37f1696303
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
2022-03-15 16:09:04 +02:00
Eirik Aavitsland
f46db29d8c Painting: fix overriding and combining different clip types
In a recent improvement (6de36918c0) the
last set clip region or path was stored in separate variables, in
order to be set again if the aliasing mode changed. That solution was
too simplistic, as it would break down as soon as more than one clip
area was set, with the latter either replacing or intersecting the
first. It was also unnecessary to introduce new storing of clip areas
and transforms, as those are already recorded in the clipInfo stack in
the painter state. This patch hence reverts much of that implementation.

However the basic idea of setting the clip area again after AA change
is good, so that part is kept, implementated instead by calling a
pre-existing function to replay the clipInfo stack.

One of the baseline test cases is extended to excercise the
combination of clip areas. As a driveby, support for setClipRectF is
added to the painting baseline test scripts, and the build of the
manual lance tool is fixed.

Fixes: QTBUG-101474
Pick-to: 6.3 6.2
Change-Id: Ide8b70d8cbf138deb06cbb84f69e62f7405886e6
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 12:45:46 +01:00
Volker Hilsheimer
1822550529 QFormLayout: Fix assert when showing with hidden rows
Amends a74cdf778c, after which the
initialization of items in invisible rows is skipped. Since data members
in QFormLayoutItem were lazily initialized, this resulted in out-of-bounds
access of QList entries.

Use member initialization for all QFormLayoutItem fields, and check that
vLayoutIndex is valid before using it to access the list entry. Skip
labels and fields for which it is not initialized.

Add test case. As a drive-by, silence the test's provoked warning
messages via ignoreMessage.

Change-Id: I374b414a51df20b9af3087a2676061fc6b7f23e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 12:45:46 +01:00
Marc Mutz
0aaada0ddc QString::asprintf: check that passing field widths as arguments works
Pick-to: 6.3 6.2 5.15
Change-Id: Ifb36179b9c26ce15378f10c2947c8cb1e38e10d4
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 11:36:09 +01:00
Marc Mutz
78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
Marc Mutz
ce83a03cfd QColor: deprecate isValidColor, setNamedColor, string-ish ctors
[ChangeLog][QtGui][QColor] The constructors from string-ish type, as
well as the setNamedColor() and isValidColor() functions, have been
deprecated effective Qt 6.6 in favor of fromString() and
isValidColorName(), resp.

Fixes: QTBUG-101389
Change-Id: I002646bd48c1e4340dc6842fd136fc9f35bb9b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 10:36:09 +00:00
Heikki Halmet
ee0908228f Revert "Blacklist: test cases blacklisted in tst_QXmlStream:"
This reverts commit d3a297c0ab.

Reason for revert: Unnecessary blacklisting

Task-number: QTBUG-101332
Change-Id: I1e2c94585e719199724695347b243dffcde49259
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2022-03-15 07:32:32 +00:00
Giuseppe D'Angelo
9b8015ed8d QMutexLocker: add isLocked()
It's basically for free.

[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.

Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-15 03:32:14 +01:00
Volker Hilsheimer
b2edef557c Baseline: don't compensate for DPRs != 1.0
The resulting blurriness is too significant, and it's hard to see where
the difference comes from. Better to encode the screen DPR into the
appearance ID if it's not 1.0, and warn about the comparison not being
done to the baseline images with a 1.0 DPR.

Pick-to: 6.3
Change-Id: Iceab7b0a4cc50627145bd1267cff22344f7d8e5b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:10 +01:00
Volker Hilsheimer
16d154ca5f Baseline: Allow setting git commit through environment variable
Widget tests run in VMs that don't have their own git clone.

Pick-to: 6.3
Change-Id: I20ab32affabfc7ce6dfaa445306b19efb51803e9
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:09 +01:00
Volker Hilsheimer
ad333b9b87 Baseline testing: make style name explicit
Mangling it into the checksum makes it hard to navigate the available
images.

Pick-to: 6.3
Change-Id: I54dcab5681e747ce1c5fe1b141ef6c4441d1f7eb
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 23:38:09 +01:00
Edward Welbourne
479c95729a Support global data tags in blacklisting identification of test-cases
Previously the blacklisting file format only worked with slot:data or
plain slot names for the items to blacklist. However, tests with
global data report themselves with the global data-row tag in the same
way as function-specific ones do; and tests which have both join the
two as slot(global:data) in the test output name, so the reader is apt
to mistake global:data for a data tag. In any case, it is potentially
desirable to be able to blacklist a function with either or both of
global and local data-row tags specified. Add support for that and
remove a blacklisting that was only needed due to the lack of this
support.

For now, make the new parameter to checkBlackLists() optional, so
that qtdeclarative's qmltest framework can adapt to this change.

Fixes: QTBUG-100870
Change-Id: I9125811ebdab75d3fb462ba8b60561f003426502
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-14 20:16:35 +01:00
Edward Welbourne
84984cfce2 Add some %-encoding round-trip tests that use % in the plain-text
This was not previously tested.

Change-Id: Icd287b519f6bc5d450f4490990ac78b0d06774f6
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-14 20:16:34 +01:00
Laszlo Agocs
1ea73bc29b Fix losing QOpenGLWidget paints when a child widget is invisible
Pick-to: 6.3 6.2
Change-Id: I136b486d30e31acadd6b1b837dc7e834ee3e23fb
Fixes: QTBUG-101620
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
2022-03-14 17:48:52 +01:00
Volker Hilsheimer
fd4186cd23 Fix click position for check box and radio button baseline tests
Some styles override the clickable area.

Pick-to: 6.3
Change-Id: Id6ec9d9aa2faff39489b2baa412af4339779ff5c
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
2022-03-14 16:13:06 +01:00
Ville Voutilainen
7f85425cb5 pthread_yield() has been removed in newer linux distros
pthread_yield() is a non-posix extension and was deprecated for a long time.
It's been removed recently at least from Fedora 35. Use sched_yield() instead.

Change-Id: Iae47fa09cc89005aa466446149be87e1b673c074
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-14 07:53:34 +02:00
Liang Qi
9c6b986d96 gui: return first default device when seatName isNull
for QInputDevice::primaryKeyboard() and
QPointingDevice::primaryPointingDevice().

This also reverts ae9fefe3c8.

Fixes: QTBUG-100790
Pick-to: 6.3
Change-Id: Id02f277db25f823eb29e939e25801325df8e4076
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-03-13 22:08:16 +01:00
David Faure
7382e5735e QCompleter: fix crash when setting the same model twice
Found when retesting the testcase completer.zip from QTBUG-54642

Pick-to: 6.3 6.2 5.15
Change-Id: Id84eefeb3a33dc6d790cfa23755352381cc097a9
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-13 16:13:29 +00:00
Axel Spoerl
2140edaaab Add setCurrentId in QWizard
setCurrentId(int id) implemented incl. forward skip warning
respective test added in tst_qwizard

Fixes: QTBUG-99488
Change-Id: Ieaf31698baf1e8ec97484b4a221c8587385c9fb3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-12 13:24:29 +01:00
Sona Kurazyan
6585963583 Deprecate {QString, QByteArray}::count()
And remove their uses.

[ChangeLog][QtCore][Deprecation Notice] Deprecated QString::count()
and QByteArray::count() that take no parameters, to avoid confusion
with the algorithm overloads of the same name. They can be replaced
by size() or length() methods.

Change-Id: I6541e3235ab58cf750d89568d66d3b1d9bbd4a04
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-12 01:05:45 +01:00
Laszlo Agocs
68a4c5da9a Compose render-to-texture widgets through QRhi
QPlatformTextureList holds a QRhiTexture instead of GLuint. A
QPlatformBackingStore now optionally can own a QRhi and a
QRhiSwapChain for the associated window.  Non-GL rendering must use
this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still
rely on resource sharing between contexts. A widget tells that it
wants QRhi and the desired configuration in a new virtual function in
QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is
evaluated (among a top-level's all children) upon create() before
creating the repaint manager and the QWidgetWindow.

In QOpenGLWidget what do request is obvious: it will request an
OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget)
will be more interesting: it needs to honor the standard Qt Quick
env.vars. and QQuickWindow APIs (or, in whatever way the user
configured the QRhiWidget), and so will set up the config struct
accordingly.

In addition, the rhiconfig and surface type is (re)evaluated when
(re)parenting a widget to a new tlw. If needed, this will now trigger
a destroy - create on the tlw. This should be be safe to do in
setParent. When multiple child widgets report an enabled rhiconfig,
the first one (the first child encountered) wins. So e.g. attempting
to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same
top-level window will fail one of the widgets (it likely won't
render).

RasterGLSurface is no longer used by widgets. Rather, the appropriate
surface type is chosen.

The rhi support in the backingstore is usable without widgets as well.
To make rhiFlush() functional, one needs to call setRhiConfig() after
creating the QBackingStore. (like QWidget does to top-level windows)

Most of the QT_NO_OPENGL ifdefs are eliminated all over the place.
Everything with QRhi is unconditional code at compile time, except the
actual initialization.

Having to plumb the widget tlw's shareContext (or, now, the QRhi)
through QWindowPrivate is no longer needed.  The old approach does not
scale: to implement composeAndFlush (now rhiFlush) we need more than
just a QRhi object, and this way we no longer pollute everything
starting from the widget level (QWidget's topextra -> QWidgetWindow ->
QWindowPrivate) just to send data around.

The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split
is all gone. Instead, there is a QBackingStoreDefaultCompositor in
QtGui which is what the default implementations of composeAndFlush and
toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs
should continue working mostly as-is, apart from adapting to the
texture list changes and getting the native OpenGL texture id out of
the QRhiTexture)

As QQuickWidget is way too complicated to just port as-is, an rhi
manual test (rhiwidget) is introduced as a first step, in ordewr to
exercise a simple, custom render-to-texture widget that does something
using a (not necessarily OpenGL-backed) QRhi and acts as fully
functional QWidget (modeled after QOpenGLWidget). This can also form
the foundation of a potential future QRhiWidget.

It is also possible to force the QRhi-based flushing always,
regardless of the presence of render-to-texture widgets. To exercise
this, set the env.var. QT_WIDGETS_RHI=1. This picks a
platform-specific default, and can be overridden with
QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be
extended to query the platform plugin as well to check if the platform
plugin prefers to always do flushes with a 3D API.

QOpenGLWidget should work like before from the user's perspective, while
internally it has to do some things differently to play nice and prevent
regressions with the new rendering architecture. To exercise this
better, the qopenglwidget example gets a new tab-based view (that could
perhaps replace the example's main window later on?). The openglwidget
manual test is made compatible with Qt 6, and gets a counterpart in form
of the dockedopenglwidget manual test, which is a modified version of
the cube example that features dock widgets. This is relevant in
particular because render-to-texture widgets within a QDockWidget has
its own specific quirks, with logic taking this into account, hence
testing is essential.

For existing applications there are two important consequences with
this patch in place:

- Once the rhi-based composition is enabled, it stays active for the
lifetime of the top-level window.

- Dynamically creating and parenting the first render-to-texture
widget to an already created tlw will destroy and recreate the tlw
(and the underlying window). The visible effects of this depend on the
platform.  (e.g. the window may disappear and reappear on some,
whereas with other windowing systems it is not noticeable at all -
this is not really different from similar situtions with reparenting
or when moving windows between screens, so should be acceptable in
practice)

- On iOS raster windows are flushed with Metal (and rhi) from now on
(previously this was through OpenGL by making flush() call
composeAndFlush().

Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-11 21:25:00 +01:00
Tor Arne Vestbø
8ccf1080fc tst_QLocalSocket: Clean up leftover local sockets before listening
If a test crashes it might leave local sockets, causing test failures
on subsequent runs due to the socket already being "in use".

Pick-to: 6.3
Change-Id: Ie1107c414f4819026907071c7b8281b2e27b8541
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Tor Arne Vestbø
d5b3238def tst_QLocalSocket: Output error when listening fails
Pick-to: 6.3
Change-Id: I742de5f522e4a28794abdee863eea2758536d392
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2022-03-11 20:32:08 +01:00
Marc Mutz
d743fd0d0a qDecodeDataUrl(): treat ";base64" marker as case-insensitive
RFC2397 doesn't explicitly mention it, but references RFC2045, which,
in Section 2, states:

> All media type values, subtype values, and parameter names as
> defined are case-insensitive.

and goes on, in 6.1:

>   mechanism := "7bit" / "8bit" / "binary" /
>                  "quoted-printable" / "base64" /
>                  ietf-token / x-token
>
>   These values are not case sensitive

So regardless of whether "base64" is a parameter name, or a mechanism,
we need to treat it case-insensitively.

Use QLatin1String::endsWith() instead of QByteArray::endsWith(),
because the former takes Qt::CaseInsensitive while the latter would
need a toLower().

Add a test.

As a drive-by, use the same trick for the existing case-insensitive
comparison with "charset".

As a further drive-by, fix inappropriate uses of QLatin1String (=
where they don't prevent allocations).

[ChangeLog][QtCore][QUrl] Now recognizes the ";base64" marker in
"data:" URLs case-insensitively.

Pick-to: 6.3 6.2
Change-Id: Ife6ba771553aaad3b7c119c1fa631f41ffa8f590
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-11 19:15:49 +00:00
Marc Mutz
61e3fe7fd9 Do not assume implicit string-ish → QColor conversion
We want to mark the corresponding QColor ctor(s) explicit.
Use Qt::GlobalColor or the new QColor::fromString() instead.

Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-11 20:15:49 +01:00
Marc Mutz
52092802b7 Rewrite tst_qdataurl as a data-driven test
... to make adding new test cases simpler.

Pick-to: 6.3 6.2 5.15
Change-Id: I54d08cebc7ae4bea9f0397ba3eec1ef6308a5161
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>
2022-03-11 20:15:49 +01:00
Marc Mutz
eded55cfbb tst_qflatmap: fix -Wunused-local-typedef (Clang)
False Positive, of course, since it's used in dependent callee
transparent_impl().

Amends 58e8ae5605.

Pick-to: 6.3
Change-Id: I7520fb7cf6bce28a5fd9381783ba349119309132
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-03-11 19:15:49 +00:00
Robert Löhning
0031c5cb79 QStyle: Fix cases when logicalValue is outside range
Change-Id: I410c40425d6677612dbe3a40cbaa1debba998064
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-10 12:39:11 +01:00
CI Insignificant Platforms Monitor Bot
797a6ca7e6 Blacklist: test cases blacklisted in tst_QSystemSemaphore:
- initialValue on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101618
Change-Id: Iea5a45690aa2e1225297c3b652d88864cf5f3ddb
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-03-10 08:18:42 +00:00
Fabian Kosmale
ba6c1d2785 QProperty: fix threading issues
QObject's cache the binding status pointer to avoid TLS lookups.
However, when an object is moved to a different thread, we need to
update the cached pointer (as the original thread might stop and thus no
longer exist, and to correctly allow setting up bindings in the object's
thread).
Fix this by also storing the binding status in QThreadPrivate and
updating the object's binding status when moved. This does only work
when the thread is already running, though. If it is not running, we
instead treat the QThreadPrivate's status pointer as a pointer to a
vector of pending objects. Once the QThread has been started, we check
if there are pending objects, and update them at this point.

Pick-to: 6.2 6.3
Fixes: QTBUG-101177
Change-Id: I0490bbbdc1a17cb5f85044ad6eb2e1a8c759d4b7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-03-10 07:21:11 +01:00
Noah Davis
64ffe0aacb Widgets: use QPlatformTheme::ButtonPressKeys for pressing buttons
QComboBox is included because it works like a button when it is not
editable. QGroupBox is included because it has a checkbox and QCheckBox
is a subclass of QAbstractButton.

Change-Id: Iad89259314e77f78c915dce83ec601df94c88941
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2022-03-09 19:13:41 -05:00
Robert Löhning
4b49c2006f QStyle: Fix overflows and crash when converting slider positions
Qt Creator crashes when max is INT_MAX and min is -1, see bugreport.

Change-Id: I441e76c0ff87052083ed3d77e6085b186402e5d8
Fixes: QTBUG-101581
Pick-to: 6.2 6.3
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-09 20:38:16 +00:00
Sona Kurazyan
82e12c79b2 Add an overload of QStringView::count() for QLatin1String
Required for the API symmetry between QStringView and QLatin1String.

[ChangeLog][QtCore][QStringView] Added an overload of
QStringView::count() for QLatin1String.

Change-Id: Ic49a4b31e8f6f0969eff0f792654d23a60e06c49
Task-numer: QTBUG-98431
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-09 15:58:47 +01:00
Sona Kurazyan
30d28810ee Add QLatin1String::count(needle)
[ChangeLog][QtCore][QLatin1String] Added QLatin1String::count(needle).

Task-number: QTBUG-98433
Change-Id: I31c9fdf14fd81500722ff9f5998eadf0e6cedc5c
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-09 15:58:47 +01:00
Marc Mutz
b142d2ad73 tst_qflags: test w/and w/o QT_TYPESAFE_FLAGS
Also contains some fixes which fix the Windows build, amending
e1b8257dee.

Pick-to: 6.3
Fixes: QTBUG-101294
Fixes: QTBUG-101304
Change-Id: I779f50fc705ed32f0314daf28b39b477a7fe925d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-08 11:16:19 +01:00
Marc Mutz
5235b1bdc8 tst_qstringapisymmetry: check expected overloads are selected
Check that the expected overloads are selected in
QString/QAnyStringView overload sets.

Pick-to: 6.3
Change-Id: I38148c20a72eb60cf86844a39fe0ed419d2fa562
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-08 06:51:11 +01:00
Marc Mutz
78b6876974 Long live QColor::fromString()!
It is customary for Qt types that can be constructed from string-ish
to provide a fromString() named constructor. QColor didn't, relying
instead on a set of overloaded implicit and explicit constructors.

Add the named constructor, with the intent to deprecate the string-ish
QColor constructors after a grace period.

To prevent new users from using known-to-become-deprecated API, mark
the old functions as \obsolete.

Also rename isValidColor() to isValidColorName(). The only reason why
these are lumped together in single commit is so that their docs can
refer to each other instead of having to temporarily refer to obsolete
API.

[ChangeLog][QtGui][QColor] Added fromString() and isValidColorName(),
both taking QAnyStringView.

Task-number: QTBUG-101389
Change-Id: I2857c728257ad2f14c7c968b45547bdf07c44b63
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-08 06:51:10 +01:00
Volker Hilsheimer
3f5a424264 Move cursor out of the way before running test
Without this change, the test fails when run twice in a row. Also, skip
the test if we can't move the cursor.

Pick-to: 6.3
Change-Id: Ic45c073007d114fbd7825cedef6761c1e410b4af
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-08 01:52:32 +01:00
Volker Hilsheimer
e27e3ad546 Un-blacklist test that's always skipped on macOS
Pick-to: 6.3
Change-Id: I045e1923b471f6bb1d482f32924f190a94b21d2a
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-08 01:52:32 +01:00
CI Insignificant Platforms Monitor Bot
d60e29cab7 Blacklist: test cases blacklisted in tst_QTouchEvent:
- multiPointRawEventTranslationOnTouchPad on windows-11

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101519
Change-Id: Idbba677893f559ee239739d8c78aa820d974e120
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-03-07 22:14:10 +00:00
Marc Mutz
53890b5d3c qtestmouse.h: compile with QT_TYPESAFE_FLAGS
Also include the comprehensive tests for bool cast compilation which I
originally wrote to confirm that the QTEST_ASSERT() change should be™
correct.

Pick-to: 6.3
Task-number: QTBUG-101406
Change-Id: I9a2871bfd4be9999b7a720bec775bba7aeffbe24
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-03-07 18:25:35 +01:00
Tor Arne Vestbø
9e01827193 Add QFileInfo::isAlias() to reflect whether the file is a macOS alias
Change-Id: I772066d0d8e69893f7c4aee1cd2305d46d5834c4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-03-06 18:46:54 +01:00
Thiago Macieira
49722de995 QWeakPointer: befriend other QWeakPointers
Commit c677b3b8af added move constructors,
which introduced the issue.

Pick-to: 6.2 6.3
Fixes: QTBUG-100795
Change-Id: I74249c52dc02478ba93cfffd16d2c879b923e352
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-04 19:00:45 -08:00
Sona Kurazyan
f39f539858 Add numeric conversion methods to QLatin1String
[ChangeLog][QtCore][QLatin1String] Added numeric conversion
methods.

Task-number: QTBUG-98433
Change-Id: I414577ae715debe3d5ba9c6a160859aca790e017
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-05 02:03:17 +01:00
Edward Welbourne
f0333355dd Add tests for an assertion seen on Windows
QDateTimeEdit's default constructor instantiates the start of
1752-09-14 as its default earliest time; however Friedeman has seen
this triggering an assertion. The QDTE tests should be picking that up
anyway, but let's overtly test it in QDate's startOfDay testing, too.

Change-Id: Ifae87f2695ac3a7993c173a7c21809c87d5daa71
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-04 23:26:13 +01:00
Ivan Solovev
5133ed072a Android: skip crashing tst_QPlainTextEdit::ensureCursorVisibleOnInitialShow
The test crashed for some reason, so other testcases are also not
executed. Skip the test for now to enable more tests in the CI

Task-number: QTBUG-89402
Pick-to: 6.3 6.2
Change-Id: I5ad38645d1b8f86c64da7208c0ae4f66d126c7d9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Ivan Solovev
79dcb2657c Android: unblacklist tst_QPlainTextEdit tests
Most of the blacklisted tests were already fixed earlier.

The tst_QPlainTextEdit::adjustScrollbars() test needed a small fix
to show the window non-fullscreen, so that the scrollbar could appear.

Task-number: QTBUG-87423
Task-number: QTBUG-89402
Pick-to: 6.3
Change-Id: I849f411a5798053742323fc4db3fe30f2b690a8b
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 22:20:18 +01:00
Marc Mutz
1931689c7d tst_qstringapisymmetry: check QString/QAnyStringView overloads w/Q_WEAK_OVERLOAD flipped
This overload set may come in handy to cushion some of the concerns
regarding replacing QString functions with QAnyStringView ones.

Overloading with a Q_WEAK_OVERLOAD QAnyStringView function requires
users to jump through hoops in order to avoid the QString overload,
but with the Q_WEAK_OVERLOAD roles reversed, the QAnyStringView
overload becomes the preferred version, relegating the QString
overload to a fall-back to facilitate sharing where it makes sense
(e.g. for QObject::setObjectName()).

Pick-to: 6.3
Change-Id: Ic65ead505beee627976a306e2d430e800540a600
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2022-03-04 08:39:07 +01:00
Sona Kurazyan
ebfe4318b8 Fix tst_qstringapisymmetry::count* to test all argument combinations
Use two template parameters for the haystack and needle types, to test
all possible combinations of all argument types.

Note that the tests for QByteArray::count() are removed: it doesn't
make sense to have them in tst_qstringapisymmetry, and we already have
the symmetry tests for QByteArray in tst_qbytearrayapisymmetry.

Change-Id: I33901fd135eb7433f0d45300a7248aef4d40324a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 04:05:12 +01:00
Sona Kurazyan
b8755e2a4d Fix an error in tst_QStringApiSymmetry::count_impl()
Don't use the haystack as needle when testing count() for QLatin1String.
This wasn't caught earlier, since QLatin1String has no count() yet, and
the codepath was never tested.

Pick-to: 6.3 6.2
Change-Id: I2764070894ddce047eceaea52456e5a521252dab
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-04 04:05:12 +01:00
Ivan Solovev
d589f3eefe Android: unblacklist tst_toolsupport::offsets
The test is no longer failing on Android in dev and 6.3, but still
failing in 6.2.
I think it's fixed by 63a35898f4
which is integrated into dev and 6.3

Task-number: QTBUG-87396
Pick-to: 6.3
Change-Id: I82e0aac1547f8e43353f0948cd3f91b4b8f9720e
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-03-04 02:37:11 +01:00
Sona Kurazyan
e440fec7fc Add literal operators for QLatin1String and QLatin1Char
The operators are declared in the Qt::Literals::StringLiterals
namespace, to avoid collisions in the global namespace.

[ChangeLog][QtCore][QLatin1String] Added literal operator""_L1 that
converts string literals and chars to QLatin1String and QLatin1Char.

Fixes: QTBUG-98434
Change-Id: Ia945a6acf4b8d4fbbb5f803264e4d79d7b17a8da
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
2022-03-04 01:58:10 +01:00
Giuseppe D'Angelo
0deff80eab Associative containers: add a way to obtain a key/value range
Our associative containers' iterator's value_type isn't a destructurable
type (yielding key/value). This means that something like

  for (auto [k, v] : map)

doesn't even compile -- one can only "directly" iterate on the
values. For quite some time we've had QKeyValueIterator to allow
key/value iteration, but then one had to resort to a "traditional" for
loop:

  for (auto i = map.keyValueBegin(), e = keyValueEnd(); i!=e; ++i)

This can be easily packaged in an adaptor class, which is what this
commmit does, thereby offering a C++17-compatible way to obtain
key/value iteration over associative containers.

Something possibly peculiar is the fact that the range so obtained is
a range of pairs of references -- not a range of references to pairs.
But that's easily explained by the fact that we have no pairs to build
references to; hence,

 for (auto &[k, v] : map.asKeyValueRange())

doesn't compile (lvalue reference doesn't bind to prvalue pair).
Instead, both of these compile:

  for (auto [k, v] : map.asKeyValueRange())
  for (auto &&[k, v] : map.asKeyValueRange())

and in *both* cases one gets references to the keys/values in the map.
If the map is non-const, the reference to the value is mutable.

Last but not least, implement pinning for rvalue containers.

[ChangeLog][QtCore][QMap] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiMap] Added asKeyValueRange().
[ChangeLog][QtCore][QHash] Added asKeyValueRange().
[ChangeLog][QtCore][QMultiHash] Added asKeyValueRange().

Task-number: QTBUG-4615
Change-Id: Ic8506bff38b2f753494b21ab76f52e05c06ffc8b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-04 00:21:44 +01:00
Ievgenii Meshcheriakov
16b614f2e1 Network: Use system publicsuffix database copy when available
[ChangeLog][Network][QNetworkCookieJar] It is possible to use
system's copy of publicsuffix database when it is available.
This behavior is enabled by default on Linux and can be
controlled using new command line switches -system-publicsuffix,
-qt-publicsuffix, -no-publicsuffix, and -publicsuffix=all.

Fixes: QTBUG-95889
Change-Id: I911e1a13c1422cdc35851953309fff064e7c5f26
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-03-03 15:56:09 +01:00
Marc Mutz
6f5c78fe3d QFlatMap: add remove_if
The existing API of QFlatMap did not allow efficient removal of
elements:

- std::remove_if does not apply, because it works by moving elements
  back in the range onto those that need to be removed, which doesn't
  work in flat_map's case, because, like for all associative
  containers, the key in value_type is const.

- The node-based erase-loop (over it = cond ? c.erase(it) :
  std::next(it)) works, but, unlike in traditional associative
  containers, is quadratic, because flat_map::erase is a linear
  operation.

According to Stepanov's principle of Efficient Computational Basis
(Elements of Programming, Section 1.4), we're therefore missing API.

Add it.

I couldn't make up my mind about the calling convention for the
predicate and, despite having authored a merged paper about erase_if,
can never remember what the predicate is supposed to take, so be fancy
and accept all: (*it), (it.key(), it.value()), (it.key()). This means
that unary predicates can either not be generic or must be properly
constrained to distinguish between pair<const K, V> and K, but that's
not necessarily a bad thing.

There's no reason to supply a Qt-ified removeIf on top of the standard
name, because this is private API and doubling the names would do
nothing except double the testing overhead.

Fixes: QTBUG-100983
Change-Id: I12545058958fc5d620baa770f92193c8de8b2d26
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-03 00:25:14 +01:00
Marc Mutz
b2c7f17b94 tst_qflags: don't suppress deprecation warnings
... if there aren't any.

Pick-to: 6.3
Change-Id: I8531e0c1c3ca41d1b1a9d55c9d11782bd63b6f76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-03 00:18:39 +01:00
Sona Kurazyan
e4aa4d4f3d Add compile-time checks for QLatin1String
Change-Id: If1b10a857275fb53c5d0b230bf6d11ce3e1ff2ca
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-02 22:22:36 +01:00
Sona Kurazyan
736213bf66 QLatin1String: add missing APIs for compatibility with Qt string views
As a drive-by, fixed misleading wording used in docs.

[ChangeLog][QtCore][Potentially Source-Incompatible Changes][QLatin1String]
Added QLatin1String(std::nullptr_t) constructor, which makes
QLatin1String(0) call ambiguous. To fix the ambiguity, nullptr
must be passed instead of 0.

Task-number: QTBUG-98433
Change-Id: I2b888aa23469343d78aa640dc39a6028b77165dd
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2022-03-02 22:22:36 +01:00
Liang Qi
586fd9e034 tests: XFAIL a few in tst_QStaticText on Wayland
Task-number: QTBUG-100982
Pick-to: 6.3 6.2
Change-Id: I18cdb79d9261bac40cc619f9d327d0ef7ed722c4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-02 15:37:33 +01:00
Liang Qi
e49d2daf19 tests: XFAIL tst_QOpenGL::bufferMapRange() on Wayland
Task-number: QTBUG-100918
Pick-to: 6.3 6.2
Change-Id: I1b892a80bcb44e0e4f658ed7073c54900d8a358c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-02 15:37:33 +01:00
Liang Qi
2b3d11383e tests: XFAIL tst_QImageReader::setScaledClipRect() SVG/SVGZ
on Wayland

Task-number: QTBUG-100917
Pick-to: 6.3 6.2
Change-Id: I66c42bb0ceca83fd0531159c606d22c58b18b371
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-03-02 15:37:32 +01:00
Eirik Aavitsland
423b650938 Fix painting clipping glitches with fractional scaling
In QPainter, clipping can only be done on whole pixels. The various
ways of specifying a clipping rectangle to the QPainter API have been
inconsistent in how fractional rectangles (either specified directly,
or as a result of fractional scaling) are mapped (rounded) to integer
coordinates.

Also, the mappings have not made sure to keep the edge-to-edge
property of clip rects under scaling. This is particularly important
when scaling QRegions with multiple rects, as QRegion is designed on
the assumption that an area can be described as a set of edge-to-edge
rects.

The fix rounds a clip rect identically with a fill rect. (Indeed, a
followup plan would be to merge QRasterPaintEngine's
toNormalizedFillRect() with the rectangle rounding function in this
commit).

Notably, a QRectF clip is now interpreted the same as a QPainterPath
clip describing the same area.

This modifies d9cc149995

Task-number: QTBUG-100329
Fixes: QTBUG-95957
Task-number: QTBUG-100343
Pick-to: 6.3
Change-Id: Iaae6464b9b17f8bf3adc69007f6ef8d623bf2c80
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-03-02 13:58:10 +00:00
Andreas Buhr
5a8052f9c1 Activate tst_qxmlstream for Android
tst_qxmlstream was disabled because it crashed. It does not any more.
But it extracted an input zip archive in-place, which is not
possible on Android. To resolve this, input files are
copied to a temporary directory first.
Also, input directories were given to rcc. rcc has a problem
with recursive directories. To circumvent this,
the file list is created in CMake and then given to rcc.

Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: I88bb823b9e5c085404e263d4a648d65c9cd6024c
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2022-03-02 14:55:00 +01:00
Pasi Petäjäjärvi
f8f8c38ec7 CI: Blacklist systemFixedFont for QNX
QNX tests are run under QEMU so have the same problem as b2qt

Pick-to: 6.2 6.3
Task-number: QTBUG-100948
Change-Id: I2abc8a4bca9e8ba414197721301d493296e7ce0b
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-03-02 15:27:36 +02:00
Ivan Solovev
e5c23db60c Android: temporary skip tst_QDialog::dialogInGraphicsView
This test crashed and prevents other testcases from execution.
The test requires a proper fix, but that's not trivial, so skipping
to enable more tests in the CI for now.

Task-number: QTBUG-101321
Pick-to: 6.3 6.2
Change-Id: I1bd4b1182cc868a36391a718457eae647675fc17
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-03-02 12:14:26 +01:00
Ivan Solovev
ef22545184 Android: skip tst_QDialog::snapToDefaultButton
This test uses the cursor. However we have no cursor support on Android.
Skip the test instead of blacklisting it, because that is the correct
behavior.

Fixes: QTBUG-87389
Pick-to: 6.3 6.2
Change-Id: I1a2d2dd406b3d7da1bc70b51c2072a83d9a29ca5
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-03-02 12:14:26 +01:00
Ivan Solovev
6e9a3d4209 QSettings: support reading UTF-8 keys in INI files
[ChangeLog][QtCore][QSettings] The INI file reader now supports
keys encoded with UTF-8, as well as the %-encoded format. Writing
the keys back to the INI file is still done using %-encoded format.
This change does not touch the way the *values* are handled - they
are both read and written in UTF-8.

Drive-by: remove misleading comments from the reading algorithm.

Task-number: QTBUG-99401
Change-Id: I6a83cbf24d919a499540403688615f93cb195e93
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-03-02 11:13:33 +01:00
Fabian Kosmale
ef0e13257d QMetaObjectBuilder: Always set Data::metatypes
The array of metatypes should always contain at least one entry (for the
metatype of the current metaobject itself).
This prevents crashes in the case of a metaobject without meta-methods
and properties (as observed in Qt for Python).

Pick-to: 6.2 6.3
Change-Id: I7a6fb316eea48c4852b6f1c26e0a930aeba4c799
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2022-03-02 10:43:49 +01:00
Marc Mutz
e1b8257dee tst_qflags: compile with QT_TYPESAFE_FLAGS
In constExpr(), where code incorrectly assumed conversions to int or
uint were implicit, make them explicit.

In classEnum(), don't test bitwise operators between QFlags and
int/uint when QT_TYPESAFE_FLAGS is in effect.

Pick-to: 6.3
Fixes: QTBUG-101294
Change-Id: If119bf56dd12778f7231a9e76293c76e75354809
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-28 22:09:31 +00:00
Marc Mutz
6f50e54138 QFlags: fix missing bitwise xor operators in QT_TYPESAFE_FLAGS builds
Add tests that cover them.

Pick-to: 6.3
Fixes: QTBUG-101300
Change-Id: I5a8af4a91d796cc4d287b813bd5cc13da3d7e766
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-28 23:09:31 +01:00
Andreas Buhr
324887779d Activate tst_qmenu for Android
tst_qmenu was disabled because it crashed.
It does not any more.

Task-number: QTBUG-87671
Task-number: QTBUG-87424
Pick-to: 6.2 6.3
Change-Id: I1a3a1d2861b5a8f20d83fd8ba38fdcb3c88faee9
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-28 23:08:21 +01:00
Andreas Buhr
a1b90caad5 Activate tst_qfiledialog for Android
tst_qfiledialog was disabled because it crashed. It does not any more.

Task-number: QTBUG-87671
Task-number: QTBUG-101194
Pick-to: 6.2 6.3
Change-Id: Icfda2cd01677f3a076b74429fcf66a1de79d2aa9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-28 23:08:21 +01:00
Pasi Petäjäjärvi
d0d1d74033 Fix check for IPV6 support without certain features
Without features getifaddrs and ipv6ifname we cannot
get correct IPV6 information for interfaces.

Pick-to: 6.2 6.3
Change-Id: I7f8c4e68d345160d218fde8db640440f3324014e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-28 22:08:21 +00:00
Ivan Solovev
e37919b758 Android: fix tst_QFrame::testPainting
When we create a QPixmap using QWidget::grab(), a default system
image format is used for that.
On Android this format is ARGB32_Premultiplied, while on the desktop
systems it is RGB32.
The images that are saved in the resources and used as references, also
have the RGB32 format.
As a result, on Android we need to convert the pixmap to a proper format
before comparing it to the reference.

Fixes: QTBUG-69064
Pick-to: 6.3 6.2
Change-Id: I2d881e508d34e0b1a2a1a7bffcbc71ae2907d31d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2022-02-28 23:08:20 +01:00
Alexey Edelev
6ee4f4233d Do not use PUBLIC linking with plugins and tests
Change-Id: Idf182bbed68e2da27387d4fd4e3b0737aaa5049c
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-28 23:08:20 +01:00
CI Insignificant Platforms Monitor Bot
d3a297c0ab Blacklist: test cases blacklisted in tst_QXmlStream:
- initTestCase on qnx

Pick-to: 6.2
Pick-to: 6.3
Task-number: QTBUG-101332
Change-Id: Ie7c561f4c92ec08c1562becefc928c34bc0eed67
Reviewed-by: CI Insignificant Platforms Monitor Bot <ci_insignificant_platforms_monitor_bot@qt.io>
2022-02-28 14:50:28 +00:00
David Faure
74a4d88e9a QAbstractItemModel: fix persistent index corruption when moving columns
QHeaderView creates persistent indexes in
_q_sectionsAboutToBeChanged(), called by the slot connected to
rowsAboutToBeMoved/columnsAboutToBeMoved.

In the case of rows, QAbstractItemModel emits the signal *before*
preparing to update persistent indexes in itemsAboutToBeMoved(),
so it can see the ones newly created by QHeaderView, all is well.

In the case of columns, the emit was done *after* calling
itemsAboutToBeMoved(), so the additional persistent indexes created by
QHeaderView were ignored, and in endMoveRows() we could end up with:
ASSERT failure in QPersistentModelIndex::~QPersistentModelIndex: "persistent model indexes corrupted"

This bug has been there since the very beginning of beginMoveColumns(),
but was undetected because moving columns in a model is pretty rare
(in my case there's a QTransposeProxyModel that turns columns into
rows in the underlying model, and a proxy that handles dropMimeData...)

Pick-to: 6.3 6.2 5.15
Change-Id: I74bad137594019a04c2a19c2abb351ff3065c25a
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2022-02-28 09:43:37 +01:00
Timur Pocheptsov
af05f278ed QMacStyle: fix tool buttons (in checked mode)
While switching to the 'momentary push in' button type, the old code that
shows button as pressed/checked was removed. Since 'square' buttons
were sharing this part with rounded push buttons, the change broke
checked square buttons. So we retain the old code for this particular
case.

Also, add a minimal baseline test for this scenario: square button,
triggering 'toolbutton' style with/out 'checked' state.

Fixes: QTBUG-100802
Pick-to: 6.3 6.2
Change-Id: Ib7b15b13ead834c7bb2cd36de76ccd5bedb07810
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-28 08:46:21 +01:00
Pasi Petäjäjärvi
81c6f224c4 Fix test when accessing patched plugin too fast
At least one OS (QNX) can't dlopen() a library that is still
open for writing elsewhere

Pick-to: 6.2 6.3
Fixes: QTBUG-101020
Change-Id: I84ca709a65fc824ec4b3e3f1ea03704bf1cc0414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-25 14:52:34 +02:00
Ivan Solovev
3b82c2d167 Fix tst_qaccessibility on Android
On Android we had 10 failing unit-tests in tst_qaccessibility

One of them was failing because on Android QMdiSubWindow is created
maximized by default, so we need to explicitly call showNormal() on
it before doing all the checks.

Other 9 were failing because we didn't get A11Y events when expected.
This is a bit more tricky.
On Android a11y state is not explicitly set by calling
QPlatformAccessibility::setActive(), there is another flag that is
controller from the Java side. It is set to 'true' only when some
of the a11y services are enabled on the device. The state of this
flag is queried during event processing, so a11y state can be reset
to false while we do QTest::qWait().
This logic is absolutely correct for real applications, but it is
a problem for the test case, because we can't easily enable a11y
services in the CI.
To overcome the issue in unit-tests, re-enable a11y before each test.
A more precise fix will require re-enabling it after every qWait() or
processEvents() call, but the current tests pass with such condition.

Fixes: QTBUG-87674
Pick-to: 6.3 6.2
Change-Id: I6f765bc6d3aaeaa19aba3a64473ea25e9cbdb0f8
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-25 13:52:33 +01:00
Thiago Macieira
c9f6678fb4 tst_qstring: properly fix the build when LC_MEASUREMENTS is not defined
Instead of proxy-testing for the OS, test for the thing you're going to
use. Fixes the build on FreeBSD.

Pick-to: 6.3
Change-Id: Ibf4acec0f166495998f7fffd16d693df09871492
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2022-02-24 15:45:53 -08:00
Andreas Buhr
c57e2b5d51 Fix tst_qformlayout::wrapping on Android
The content of the window was intended to trigger wrapping.
On Android, the window is larger, so more content is
necessary. This patch adds more content.

Fixes: QTBUG-87401
Pick-to: 6.2 6.3
Change-Id: I33a2fe4560c358f2b0b83523ee4ab26bb5dd2513
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-24 23:41:14 +01:00
Volker Hilsheimer
4cca8ee527 QGuiApplication: use translation-based layout direction unless explicitly set
The stored layout direction used to get changed during initialization
to what was auto-detected based on the translation. Changing the
translation then overwrote that stored value, even if an explicit call
to setLayoutDirection was made by the application.

Calling QGuiApplication::setLayoutDirection(Auto) has so far been a
no-op.

Change this logic so that the stored layout direction continues to be
LayoutDirectionAuto also if it's set based on auto-detection, and only
overwrite it when explicitly called with a non-Auto value. This way,
applications can set a layout direction that stays unchanged even when
translators are installed.

Add test coverage that uses a QTranslator.

In practice, this is not a change of behavior, unless applications called
setLayoutDirection(Auto) (which is no longer a no-op), or called
setLayoutDirection() and then installed a translator and expected the
translator's layout direction to come into effect in spite of the explicit
setting.

[ChangeLog][Gui][QGuiApplication] Calling setLayoutDirection with a non-
auto value now disables the auto-detection based on installed
translators. Applications that explicitly set a layout direction and also
want translators installed afterwards to take effect should reset the
layout direction to Auto, which is now no longer a no-op.

Fixes: QTBUG-100632
Pick-to: 6.3
Change-Id: I1fdcebd43a9b1b468ff95bf15f53f441bb214e08
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-02-24 19:46:01 +01:00
Ievgenii Meshcheriakov
d0b22762be tst_qnetworkcookiejar: Remove tests that rely on public suffix database format
This format will be changed by the next commit. Also it is an
implimentation detail that can be changed at any time.

Task-number: QTBUG-95889
Change-Id: I00b1133078f1035e03e2cd6fae28192de54d2154
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 19:36:26 +01:00
Volker Hilsheimer
a74cdf778c Implement QFormLayout::set/isRowVisible
Hiding a row in a form layout is inconvenient to do as access to the
widgets in each row is cumbersome. In addition, a row might include a
layout for the label or the field column, and we can't hide layouts and
instead need to navigate to the widgets inside the layout. And even if
an application developer does all that, the spacing calculation doesn't
ignore hidden rows.

Add setRowVisible and isRowVisible APIs with the usual overloads.
Implement the logic to traverse a layout item to its contained widgets,
so that they are explicitly hidden when a row is hidden, and skip hidden
rows in the spacing calculation.

[ChangeLog][Widgets][QFormLayout] New APIs setRowVisible and isRowVisible
to hide and show rows in a form layout.

Fixes: QTBUG-6864
Change-Id: I6af98409802f331c4523e91d7dac8a97762c579d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2022-02-24 17:07:43 +01:00
Oliver Wolff
6b80de3915 Blacklist tst_qscreen::grabWindow for all Windows versions
The test is not only flaky on Windows 10 but also on Windows 11.

Pick-to: 6.2 6.3
Task-number: QTBUG-100412
Change-Id: I27e8179dafd4743c3eaf2c0dd8b70b804612c7c2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-24 13:34:33 +00:00
Andreas Buhr
4ed8e7949a Activate tst_qtextdocument for Android
tst_qtextdocument was disabled because it crashed.
It does not any more.

Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: Ie1bd75c21e481c2ecb8607c04ce9370fc6d7b00e
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Pekka Gehör <pekka.gehor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-24 14:34:33 +01:00
Andreas Buhr
fcb5e52228 Activate tst_qgraphicsview for Android
tst_qgraphicsview was disabled because it crashed.
It does not any more.

Task-number: QTBUG-87671
Task-number: QTBUG-87397
Pick-to: 6.2 6.3
Change-Id: Ib604274d098c271e22b010e6cb822fdf9553df1c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Samuel Mira <samuel.mira@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-24 14:34:32 +01:00
Andreas Buhr
2ff797689d Remove unused Qt4-compat test
There was a test for Qt4 compatibility in tst_qheaderview.
We don't run it since Qt 6.
This patch removes the unused code.

Change-Id: I751829ac5a142e79379e81e9e739107544cf7406
Reviewed-by: Arnaud Bienner <arnaud.bienner@gmail.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2022-02-24 13:51:22 +01:00
Pasi Petäjäjärvi
055fd403c4 CI: Add docker support for tst_platformsocketengine test
Currently test relies solely for external test server. This makes it
not possible to run test successfully with environment where docker is
used.

Pick-to: 6.2 6.3
Change-Id: Ie2974a0e2fec9b16d9d023730b76fa2a32f77e65
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-24 09:50:31 +02:00
Pasi Petäjäjärvi
30d55abbac Core: Fix tests that did break because QProcess security fix
Amends 29fceed2ff

Pick-to: 5.15 6.2 6.3
Change-Id: Ief3317a89f7be1dd1dc249297bd16e958b9e1ef2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-24 09:49:52 +02:00
Pasi Petäjäjärvi
3a151faec2 QNX: Fix support for abstract Unix-domain socket
As QNX claims to support abstract Unix-domain sockets, its getsockname
always returns for socket that has not been bound to local name
address_len of sun_path as maximum length (106) even when it does not
contain valid address.
https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.lib_ref/topic/u/unix_proto.html

Pick-to: 6.2 6.3
Change-Id: I0f0f5c05611c8db6af35377dde16450f58c83c56
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-24 07:49:37 +00:00
Giuseppe D'Angelo
8123a69e6e QRegularExpression: print the pattern when warning
Just as a minor debugging helper: when warning that an invalid
regular expression object is being used to match, also print
the used regular expression pattern.

Change-Id: I0f99bcf4ca87ec67d04ed91d9dc315814f56d392
Fixes: QTBUG-76670
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-22 21:15:31 +01:00
Andreas Buhr
1ba56134f5 Repair some of tst_qtableview tests on Android
The view.resize() command has no effect if the requested
size is smaller than the screen. So the view has space for
the whole model. It then won't scroll, so scrolling cannot
be tested.
This patch enlarges the model so that scrolling is always
necessary and thus possible.

Task-number: QTBUG-87407
Pick-to: 6.2 6.3
Change-Id: Ibff512158d9c16be120a69c7328b6d0ae2c3b551
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-22 17:22:59 +01:00
Andreas Buhr
b39d3cfe30 Activate all tst_qgridlayout tests on Android
Some tests were blacklisted, but the problems cannot be reproduced
any more. This patch activates them.

Fixes: QTBUG-87404
Pick-to: 6.2 6.3
Change-Id: I5944c750a5717daaf43a22d6d1fa51ae54fc3da2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-22 17:22:59 +01:00
Andreas Buhr
9e7a5bb513 Activate tst_qopenglwidget for Android
tst_qopenglwidget was disabled because it crashed.
It does not any more.

Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: I7ea55f262f362c098b52e1b1a319b26c31a7e067
Reviewed-by: Pekka Gehör <pekka.gehor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-22 17:22:58 +01:00
Andreas Buhr
1ae662cad0 Activate tst_qdom for Android
tst_qdom was disabled because it crashed. It does not any more.

Task-number: QTBUG-87671
Pick-to: 6.2 6.3
Change-Id: I41117938fe9d93b510c4a60beb4c2f5b20991434
Reviewed-by: Pekka Gehör <pekka.gehor@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2022-02-22 17:22:58 +01:00
Friedemann Kleint
9ddc020246 Stabilize tst_QTabBar::hoverTab()
Port the test to use the QWindow* based overloads of QTest::mouseMove()
and move the cursor away.

Pick-to: 6.3
Task-number: QTBUG-98489
Change-Id: Id1ac0ef176c6f9bf179f989ddd5775877525fc0d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2022-02-22 07:55:30 +01:00
Thiago Macieira
5731b83445 tst_qlogging (tst_qmessagehandler): use one line for output and expected
Makes it easier to interpret the output from the test, because of
embedded newlines.

Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f141e09537f4
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-20 23:32:26 -08:00
Thiago Macieira
43a171a7d6 tst_qlogging (tst_qmessagehandler): use QProcessEnvironment
Simplifies the code. And removes the unnecessary quote around the
pattern that was there, for some reason.

Pick-to: 6.3
Change-Id: Ic15405335d804bdea761fffd16d4f135edf6993b
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2022-02-20 23:32:20 -08:00
Mårten Nordheim
db5b8bbea3 Http2: Fix redirect-handling
The redirect handling for http2 was a little simple. E.g. not handling
relative URLs.
Fix this using the redirect response parsing function which the http1
protocol handler already uses.

Fixes: QTBUG-100651
Pick-to: 6.3 6.2 5.15
Change-Id: Ic0cec4cacc92707e7a7fde1f4665f80995a6057e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
2022-02-20 22:47:25 +01:00
Friedemann Kleint
05428d9b97 Polish tst_QAbstractSpinBox
Introduce modern C++, use static methods, nullptr, auto.

Pick-to: 6.3
Change-Id: I9025c94c063045329ae1a25b387cb2135d588b22
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-18 22:32:18 +01:00
Friedemann Kleint
1af068332b Fix test to pass with QT_FORCE_ASSERTS
Add QT_FORCE_ASSERTS to condition with standard comment.

Pick-to: 6.3 6.2
Change-Id: If493c7cdea8164f010228a755915a211c1cf1b39
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2022-02-18 18:55:38 +01:00
Volker Hilsheimer
72e1fc7c0b Simplify failure detection logic in QEventDispatcher test
The test always fails when either the Xcb or UNIX, one of the Windows
event dispatchers is used. So only test for the event dispatcher name,
which then covers all platforms, including QNX and INTEGRITY (which
use the UNIX event dispatcher).

Pick-to: 6.3 6.2
Change-Id: I2e315831b53f823c5496ad0319319df78f064cc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
2022-02-18 18:55:38 +01:00
Edward Welbourne
795c94658d Expand testing of QDateTime's isNull() and isValid()
Bring out the asymmetry between date and time more clearly; when date
is valid, an invalid time is ignored in favor of QTime(0, 0). At the
same time, eliminate an un-needed variable from the code that
implements this special handling. (Left over from when the QTime was
passed by const ref, rather than by value.)

Change-Id: I81d8a9026cbb7887a8c638a2761b3db54c088af7
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-18 17:44:53 +01:00
Edward Welbourne
a2236c7675 Tidy up tst_QTimeZone::specificTransition()
It can now use startOfDay()/endOfDay() for the end-points of its
search range; and it should check transit is not empty before
dereferencing transits.at(0).

Change-Id: Ib1568f4d8d6ce301d601071bb58185be906c631a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-18 17:44:53 +01:00
Tatiana Borisova
8875b5a9a3 Exclude autotest for INTEGRITY
- ICU is not supported by backend.
  System supports only a simple named UTC time zone implementation(see QUtcTimeZonePrivate)

Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: I4a87fc3d5484d75d55890bf88d012955e5048a0b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2022-02-18 13:19:45 +00:00
Fabian Kosmale
8079361852 typeNameForCast: use add_pointer instead of string manipulation
Relying on string manipulation leads to -Wredundant-parens warnings in
the best case, and to non-compiling code (when using typedefs) in the
worst case.
We can avoid both issues by simply generating code that uses
add_pointer, which takes care of reference types (even typedef'd ones),
and creates no warnings about parens (as we don't write any anymore).

Fixes: QTBUG-100915
Pick-to: 6.3 6.2
Change-Id: Ic5b1cbfda20d920d11f51beeb62e9479261d5f00
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2022-02-18 13:44:41 +01:00