Commit Graph

16131 Commits (f45dffa8b4e5a3ddc3473203e27ebdeebfde10da)

Author SHA1 Message Date
Piotr Wierciński d2862a8f02 wasm: Refractor Selenium manual test into auto test
Using Selenium for WebAssembly testing enables us
to test user interactions, which is very valuable.
Turning this test into automated allows us to run
it in CI pipeline. This will help with detecting
regressions.
Two of these tests are currently failing on CI
machine and they have been temporarily disabled.

Change-Id: I754dd05955e55eb031070f5328ef715b7826c2b5
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-02-07 13:15:09 +01:00
Christian Ehrlicher c6af5b9c12 Q(Plain)TextEdit: don't crash when using a style sheet
When using a style sheet, Q(Plain)TextEdit::isReadOnly() might get
called during the initialization before d->control is properly
initialized which lead to a crash.
This amends 43ce457cbd.

Fixes: QTBUG-121697
Fixes: QTBUG-121790
Task-number: QTBUG-1857
Pick-to: 6.7 6.6.2 6.6 6.5 6.2
Change-Id: I15c357c9eef7f6559bcc2ad89033a3d8e7fcbfef
Reviewed-by: David Faure <david.faure@kdab.com>
2024-02-07 02:17:37 +01:00
Alexey Edelev 75d83d5a65 Add plugins of imported QtModules to the _qt_plugins property
This covers the following use case:
QtModuleX is pre-built and installed, it's imported. The plugin has
a PLUGIN_TYPE that is associated with QtModuleX and is built with
application that links QtModuleX. When deploying the application
it's expected that the plugin is deployed, as the one that belongs
to the linked QtModuleX.

This ensures that we udpate the internal _qt_plugins property that
is used in the __qt_internal_collect_plugin_targets_from_dependencies
function.

Pick-to: 6.5 6.6 6.7
Change-Id: I9824351ebab5a24509800da4db69f1e282a35884
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2024-02-06 20:23:18 +01:00
Juha Vuolle cdfeca26cf Remove HTTP 1XX status test from tst_qrestaccessmanager
1XX statuses are not final statuses, and testing 'error' on it is not
necessarily very meaningful. Furthermore the internal handling of
these statuses changes in Qt 6.8.

Fixes: QTBUG-108068
Pick-to: 6.7
Change-Id: I9c18c579cd310266273eccd2aee2e032f60538e0
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-06 19:10:45 +02:00
Mate Barany bb34c6fa6b Make QNAM handle all informational HTTP replies
Make QNetworkAccessManager to discard all informational (1xx) replies
from HTTP servers with the exception of 101.

According to RFC 9110:

"A client MUST be able to parse one or more 1xx responses received
prior to a final response, even if the client does not expect one.
A user agent MAY ignore unexpected 1xx responses."

Status code 101 is an exception because we use it to upgrade to http2
cleartext when it is enabled.

Fixes: QTBUG-108068
Change-Id: I415ff053180a43f0c7ff1b4b2a60fd114ce08ac9
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-02-06 19:10:45 +02:00
Tasuku Suzuki bd6d7d4d74 Remove extra semi-colons
Change-Id: I92fddb36cd136fd1bd627955f15d0559b9942d7e
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-06 20:17:18 +09:00
Edward Welbourne 46c1936e17 Rework tst_QTimeZone::windowsId() to use initializer-lists
Instead of clearing a list repeatedly to then repopulate it by
appending entries.

Change-Id: I82594d69c1cb145defff43d84f92f8410d8997aa
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-05 23:12:59 +01:00
Jarek Kobus 0d0810e2dc QObject: fix installEventFilterOrder() test flakiness
Don't rely on timer precision and use int counter instead.

Amends 1fe88bf4cd

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I057b4dd51014784ec9b244301b43583f3de6ddd1
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
2024-02-04 18:33:37 +01:00
Ahmad Samir d887e34b49 tst_qdiriterator: add a test for QFsFileEngineIterator
As a baseline for subsequent commits.

Change-Id: Ifac026848e92817b08a75ceafee6d06e0a8f399d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-04 14:04:18 +02:00
Lucie Gérard ff1039c217 Change license for tests files
According to QUIP-18 [1], all tests file should be
LicenseRef-Qt-Commercial OR GPL-3.0-only

[1]: https://contribute.qt-project.org/quips/18

Pick-to: 6.7
Task-number: QTBUG-121787
Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
2024-02-04 09:56:42 +01:00
Thiago Macieira c5f22c54cb qHash: provide the long double overload on Darwin systems
Commit c0791ac76e didn't explain why it
was #ifdef'ed out. It's just an alias for double. Maybe compilers at the
time used to complain if you used it, but I can't make Apple's clang
produce a warning now.

Pick-to: 6.7
Change-Id: I664b9f014ffc48cbb49bfffd17b02293403e9571
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2024-02-03 07:33:00 -08:00
Marc Mutz 6504496c64 QBitArray: use QDataStream::SizeLimitExeeded where applicable
[ChangeLog][QtCore][QBitArray] Uses new
QDataStream::Status::SizeLimitExceeded now, where applicable (was:
WriteFailed, ReadCorruptData).

Pick-to: 6.7
Change-Id: If5a8db9c6b2f104b40266784d88cf7cad0b0ce73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-03 08:33:14 +01:00
Shawn Rutledge 9fa471b72d Fix frontMatter tests: fixed fonts and testdata
When the main font is a fixed-width font, QTextMarkdownWriter generates
backticks around plain text; so QEXPECT_FAIL if we detect that.

tst_QTextMarkdownWriter::frontMatter() Compared values are not the same
   Actual   (output)                  : "---\nfoo\n---\n`bar`\n\n"
   Expected ("---\nfoo\n---\nbar\n\n")

Also, include all test data as resources for platforms that need it
(such as Android).

Task-number: QTBUG-103484
Change-Id: If18ca493c402b128cdc0fb1910b2e822512af6e8
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-02-02 20:14:45 -07:00
Shawn Rutledge bffddc6a99 Extract and re-write "front matter" in markdown documents
It's increasingly common for YAML to be used as metadata in front of
markdown documents. md4c does not handle this, so we need to remove
it ahead of time, lest md4c misinterpret it as heading text or so.

The --- fences are expected to be consistent regardless of the format of
what's between them, and the yaml (or whatever) parser does not need to
see them. So we remove them while reading, and QTextMarkdownWriter
writes them around the front matter if there is any.

If your application needs to parse this "front matter", just call
qtd->metaInformation(QTextDocument::FrontMatter).toUtf8() and feed that
to some parser that you've linked in, such as yaml-cpp.

Since YAML is used with GitHub Docs, we consider this feature to be part
of the GitHub dialect:
https://docs.github.com/en/contributing/writing-for-github-docs/using-yaml-frontmatter

[ChangeLog][QtGui][Text] Markdown "front matter" (usually YAML) is now
extracted during parsing (GitHub dialect) and can be retrieved from
QTextDocument::metaInformation(FrontMatter). QTextMarkdownWriter also
writes front matter (if any) to the output.

Fixes: QTBUG-120722
Change-Id: I220ddcd2b94c99453853643516ca7a36bb2bcd6f
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-02 20:14:28 -07:00
Wladimir Leuschner a1f12273b2 QWindows11Style: Draw MDI SubWindows in Windows 11 style
Fixes: QTBUG-120633
Pick-to: 6.7
Change-Id: I6ad4052ca45f7c90cd52a9d2440b508730d3685d
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2024-02-02 22:07:08 +01:00
Eskil Abrahamsen Blomfeldt 0916415ef7 Implement missing features in DirectWrite font backend
The DirectWrite font backend is an optional backend which
is planned to take over as the default on Windows. In order
to do this, though, a few gaps need to be filled in order
for it to pass all autotests.

The following things are covered by this:

1. Bitmap fonts are unsupported in DirectWrite. We enumerate
   these using GDI and fall back to the GDI font engine when
   loading them. As part of this, we introduce a new handle
   type for fonts on Windows which can represent both
   the DirectWrite and GDI engines.
2. "Legacy font names" where sub-family is embedded in the
   family name is now enumerated together with the
   typographic font name.
3. The DirectWrite font engine was not loading kerning pairs
   from the font, like the other engines (omission which was
   detected by the test)
4. Turning off antialiasing does not work with DirectWrite, so
   we fall back to GDI for this.
5. Loading supported writing systems from application fonts
   was not supported.

Task-number: QTBUG-119420
Change-Id: Icf6c351afb0d7487b2f4634199088d701a324aae
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-02-02 18:01:52 +01:00
Shawn Rutledge 7c313f1865 QMovie non-anim: use QImageReader::imageCount but not nextImageDelay
Since 3f4d6279c4b0d04422efff478a5e2fb36259dbaa (khansen 2005) QMovie
calls QImageReader::read() until QImageReader::canRead() returns false.
That's apparently to support animated image formats in which the
frame count is not known at the beginnning (i.e. not specified in
the image format's metadata). But non-animated multi-frame formats
are expected to return valid values from QImageReader::imageCount();
and those also tend to keep returning true from canRead() regardless
of how many frames have been read (the interpretation of canRead()
is "does the file have the expected format?" rather than "are we
about to read too many frames?"). So, when a multi-frame image is abused
as an animation, QMovie was able to keep reading the same frame
repeatedly and pretend that the frame sequence goes on forever.
It also tended to read frames as fast as they could be decoded,
because nextImageDelay() is not usually provided, because multi-frame
image formats don't specify a frame rate in their metadata.

So now we change QMovie's behavior for image formats where
QImageIOHandler::supportsOption(Animation) returns false:
trust imageCount(), but not do not trust nextImageDelay().

But to actually jump to the next frame in this case, we also need to
call QImageReader::jumpToNextImage().

Altogether, this makes QMovie support "flipbook" animation for
multi-frame image formats, such as tiff and pdf.

Added "read frame x of c" logging in qt.gui.imageio category.

For testing, we use a pre-existing multi-frame Obj_N2_Internal_Mem.ico
file, to avoid depending on the tiff plugin.

[ChangeLog][QtGui][QMovie] QMovie now handles non-animated multi-frame
image formats (such as tiff): QImageIOHandler::imageCount() is observed,
and the default frame rate is 1 FPS.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-117429
Change-Id: I6dad2a684e12c78a68288402e223a59427bf649e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-02 09:57:00 -07:00
Frédéric Lefebvre 4b60b6d845 tst_QWidget::scroll() remove QApplicationPrivate::setActiveWindow()
2f6fe3a268 has made calls to
QApplicationPrivate::setActiveWindow() redundant.

Remove redundant calls.

Task-number: QTBUG-121488
Change-Id: I13ea8c0994eaeb764462af23ef66ea1a37659b77
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-02 16:23:02 +01:00
Marc Mutz 9219e8ff1d QBitArray: don't create invalid Qt 5 streams
Qt 5 streams cannot handle QBitArrays with more than INT_MAX bits,
even on 64-bit platforms, because of interface constraints (size_type
int).

Qt 6 can, so make sure to refuse serialization of oversized QBitArrays
to Qt-5-compatible streams.

[ChangeLog][QtCore][QBitArray] Now refuses to stream a QBitArray with
size() > INT_MAX to a Qt-5-compatible QDataStream.

Pick-to: 6.7 6.6 6.5 6.2
Change-Id: I263e27bd366757c8e0360dfd337948c44d00647a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-02 15:35:51 +01:00
Edward Welbourne b0cb4a80e5 Modernize comparisons in tst_QLocale
QCOMPARE() can report enum values by name just fine, no need to
laboriously convert them to strings. While comparing all tags in one
go did allow a more comprehensive report, it's enough to know we
failed; this is testing cross-platform code, so a debugger can tell us
all those extra details if we get a failure.

Testing qHash() doesn't distinguish equal things is fairly low value;
at least avoid duplicating the construction of the reference value.

Replace a bunch of other QVERIFY()s with the new cousins of QCOMPARE()
for ordered and different comparisons.

In the process, mark some of the QLocale objects as const.

Change-Id: Ic93b8ed60c6f2cc846fbba428983778896d61291
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-02-02 08:26:14 +01:00
Edward Welbourne 5d451d514c Make TEST_CTOR macros use the "do { ... } while (false)" pattern
They were expanding as simple blocks, so their uses didn't end in
semicolon, which looks wrong when reading the code.

Pick-to: 6.7 6.6 6.5
Change-Id: Ibea7b01ac165045604b6eb7a838765b2061c368a
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-02-02 08:26:09 +01:00
Edward Welbourne 063026cc50 Update QLocale and calendar data to CLDR v44.1
(This turns out to be identical to v44, for our purposes.)

The CLDR license has been revised at v44 to "UNICODE LICENSE V3",
which is now included (as LICENSES/UNICODE-3.0.txt) in addition to the
old license (still in use, presumably, by UCD - at least until its
next update). Some new QLocale::Language entries are needed. There is
no change to the time-zone data.

Some tests needed changes:
* Various Arabic locales now use U+0623 (Arabic letter aleph with
  hamza above) in exponent separator, replacing plain U+0627 (Arabic
  letter aleph); it is still followed by U+0633 (Arabic letter seen).
* Where likely sub-tags used to fill in world, 001, as territory for a
  language, they now (e.g. for Prussian and Yiddish) give specific
  countries.
* Tamil locales now have something of a mix of inherited and localized
  forms for AM/PM, which looks a lot like a mistake in CLDR.
* New likely sub-tag rules fix ctor(und_US) and ctor(und_GB), which
  previously failed.

[ChangeLog][Third-Party Code] Updated QLocale's data extracted from
the Unicode Common Locale Data Repository (CLDR) to v44.1. The license
changed to Unicode License V3.

Pick-to: 6.7 6.6 6.5
Fixes: QTBUG-121485
Task-number: QTBUG-121325
Change-Id: Ide1a68016129526d7a5aa3fc67f1a674858696bc
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-02-02 08:26:03 +01:00
Ahmad Samir 2a8b27bf6c QFileSystemModel: don't crash with setIconProvider(nullptr)
The method takes a pointer, so the code shouldn't crash when passed a
nullptr.

QFileInfoGatherer::getInfo() still needs to generate a descriptive
string for the file, so we refactor QAbstractFileIconProvider::type()
to put the implementation into a reusable static function
QAbstractFileIconProviderPrivate::getFileType(const QFileInfo &info).
This unfortunately involves constructing a QMimeDatabase on the fly,
but the docs say that is fine.

Drive-by change: use nullptr instead of `0` for pointers.

Pick-to: 6.5 6.6 6.7
Fixes: QTBUG-99178
Change-Id: Ia32ea0a26701d593e74fbecced7be8d9e0aa0f52
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2024-02-01 22:06:12 +00:00
Ahmad Samir 1fe88bf4cd QObject: add unittest to check the order of eventFilter() calls
installEventFilter() prepends new objects to the eventList, so that
events that are posted while processing events are left to the next
round of event processing.

This is a baseline test to check that subsequent commits preserve the
current behavior.

QCOMPARE_GT is available since Qt6.4, so make the check backportable to
older releases too.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Task-number: QTBUG-120779
Change-Id: I5ed5e9c2917a9be62de4af19c3b72889399b4fe6
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2024-02-01 23:42:56 +02:00
Piotr Wierciński c23d3ca1f0 wasm: Disable problematic qlocal test for time being
Upgrading emscripten to 3.1.50 breaks this test, so we disable the time
for time being. After emscripten update this test is to be enabled
and fixed.

Change-Id: Ic48d81e2285ed8f7639bf20c6c29b2b9e402a591
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2024-02-01 19:25:43 +00:00
Tor Arne Vestbø 5ba0982b28 Don't set ExplicitShowHide on children when showing parent widget
As a result of using QWidget::setVisible to show the child widgets we
would end up also setting ExplicitShowHide. This is not in line with
the intent of ExplicitShowHide, which is to flag a widget as explicitly
shown/hidden by the developer, which in turn prevents Qt Widgets from
toggling WState_Hidden when the widget is reparented.

By using QWidgetPrivate::setVisible instead, we can show the child
without setting ExplicitShowHide.

As side effect of this is that we no longer reset WA_WState_Hidden
from QWidgetWindowPrivate::setVisible(). This is an issue when the
setVisible call comes as a result of destroying the QWidgetWindow,
as that is an implicit hide, and should not result in the widget
having WA_WState_Hidden. QWidget handles this case in hideChildren
by not calling QWidgetPrivate::setVisible -- instead doing its own
reset of WA_WState_Visible. We don't want to untangle this just yet,
so as a workaround we detect that the widget is already !isVisible(),
thanks to hideChildren having hidden it, and then skip the call
to QWidgetPrivate::setVisible that results from QWindow::destroy().

Task-number: QTBUG-121398
Pick-to: 6.7
Change-Id: Ib5b4d9c84f0569124c5f3ca2169cabff18934e2d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-01 15:28:56 +01:00
Tor Arne Vestbø f85c988980 Simplify tst_QWidget::closeAndShowWithNativeChild
The nativeHiddenChild is not used for anything, and shouldn't be
needed to trigger the failure condition.

That said, I was not able to reproduce the test failure on macOS
14 with the test neither pre or post patch, nor with any of the
test cases mentioned in 51300566ff,
nor with 51300566ff itself, so this
has seemingly been fixed or worked around some other way in the
meantime.

Task-number: QTBUG-121398
Pick-to: 6.7
Change-Id: I299e7f4b71ebdb17870348a3d5b0c49a93228c8b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-01 15:28:56 +01:00
Tor Arne Vestbø b393b26c70 Add logging, clarifications, and tests for QWidget show/hide behavior
Task-number: QTBUG-121398
Pick-to: 6.7
Change-Id: I94b4c90c3bd515279417c88497d7b9bd5a362eae
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2024-02-01 15:28:56 +01:00
Ahmad Samir 986b5b4f47 QDirIterator: don't create test dirs/files in the source dir
This is cleaner as the test dirs/files are created in a QTemporaryDir
that is cleaned up automatically, so less manual cleanup in the
unittest.

This also fixes issues for build environments where the source dir is
read-only.

entrylist dir in the source dir is only needed for the construction of
the QResource in the CMakeLists.txt.

Task-number: QTBUG-117449
Change-Id: I3e6389ff730c3a617854e85318f80838e012f2c8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-02-01 16:28:55 +02:00
Volker Hilsheimer cfcd56a78f JNI: Fix QJniObject::callback test case
Don't call the native function directly, call the Java function that
calls the native function.

Pick-to: 6.7
Change-Id: Icdcf250313a38f6e4bc2b90fb7b0adbfa5a890fb
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
2024-02-01 14:22:35 +01:00
Alexey Edelev 31b75303d7 Introduce QTP0003 which controls the BUILD_SHARED_LIBS impact on user projects
Since 6.7 we consider the BUILD_SHARED_LIBS when creating libraries
using Qt CMake API. This change may affect the user projects that rely
on the old strategy of selecting the default library type. To preserve
the old behavior this change introduces the QTP0003 policy that allows
user to control whether the BUILD_SHARED_LIBS should or shouldn't be
considered in library creation process.

The policy doesn't affect Qt repos, we assume that we want the NEW
behavior by default.

Fixes: QTBUG-121707
Pick-to: 6.7
Change-Id: I4bcfbd8966839731624e3f7ef9e0d6bb2782ac50
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2024-02-01 09:46:51 +01:00
Mårten Nordheim 000cb2dadc Bench QSet::unite
It was shown to have poor performance compared to contains() and
insert().

Pick-to: 6.7 6.6 6.5
Change-Id: I61cfbc8c34e325d677d7954118ef68057df640cb
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-02-01 00:43:23 +01:00
Volker Hilsheimer 72f5b35b3d Stabilize tst_QFileSystemModel::showFilesOnly test case
Amends 83e5d74864.

A model index returned by QFileSystemModel might become invalid when
events get processed, so don't store the result of setRootPath to re-use
it in a QTRY_COMPARE function. Instead, always ask for a fresh model
index.

Also, use std::chrono::duration::count correctly; it returns the "tick",
not the corresponding milliseconds, so (10s).count() returns 10 instead
of 10000. Explicitly use 10000ms here.

Un-blacklist the test on macOS again.

Task-number: QTBUG-74471
Pick-to: 6.7 6.6 6.5
Change-Id: Ic98bb53c696441131bbc1055b64822faf2aec96f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
2024-01-31 21:18:48 +01:00
Marc Mutz 2188ca2c5d QVersionNumber: make iterable
Since QVersionNumber doesn't have an existing way to modify individual
segments, provide only const_iterator.

[ChangeLog][QtCore][QVersionNumber] Added (const) iterators over
segments (begin()/end(), incl. c- and r- variants).

Change-Id: Ia9af70c2a9c59f630123894ad2c9f38031ef5b8f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 20:18:48 +00:00
Marc Mutz 0808beace3 QBitArray: fix potential truncation in QDataStream op>>()
In Qt 5, a QBitArray could not contain more than INT_MAX bits, because
the then-size_type, int, cannot represent more, even if the underlying
storage could hold 8x as much, and the serialisation format, using
unsigned int, could represent 2x.

Therefore, reject old formats with sizes that exceed INT_MAX elements
as corrupt.

Likewise, the Qt 6 serialisation format unconditionally uses 64-bit
sizes, but 32-bit platforms still cannot represent more than
numeric_limits<qsizetype>::max() (= INT_MAX) bits in memory. This is a
valid stream for 64-bit platforms, though, so ideally, this should be
using SizeLimitsExeeded, which, however, is only available from Qt
6.7. So, for now, and until we have SizeLimitsExeeded, mark the stream
as corrupt here, too.

[ChangeLog][QtCore][QBitArray] Fixed undetected overflows in the
deserialisation (opertor>>()) from QDataStream.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: Ib24cf9218c06a3a05185723c77d4313611c2dd40
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 21:18:47 +01:00
Ahmad Samir 4488dad13b tst_qdiriterator: cleanup
- Match QCOMPARE logic when printing stringlists that don't match, it's
  "actual" then "expected"
- Use row tag names that don't interfere with the shell; e.g. using
  `tst_qdiriterator iterateResouce:':/testdata'` doesn't work for some
  reason, so just add a qrc prefix

Change-Id: I3d556b83ec34f2dab15ea3178273af10fb2c62e6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 17:55:33 +02:00
Krzysztof Sommerfeld 6efc95b699 Exclude test from compilation without qprocess
Change-Id: Iea3a28b25bdb828b0eb2ae0381489aa207f348fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 13:21:55 +01:00
Krzysztof Sommerfeld e566447e6b Exclude VxWorks from cxx 23 mode compilation of qcomparehelpers
Change-Id: Ia217a76ad96851a3ad9dedae4ab3ff1c2b3b92c6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 13:21:55 +01:00
Krzysztof Sommerfeld ac6a9f9bfa Add cxx11_future in QPromise tests and disable it for VxWorks
cxx11_future flag should be disabled for VxWorks. VxWorks still does
have some bugs related to this std features and some parts of code needs
to be excluded. At least till the 24.03 VxWorks release as for now this
is the expected release that should contain fixes.

Task-number: QTBUG-115777
Change-Id: Ic652403697d727f4ae05ae7287ff8285075d3802
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 12:21:55 +00:00
Łukasz Matysiak 4b4a6f6d8e Skip compilation of tst_QLocalSocket::verifyListenWithDescriptor on VxWorks
This test uses socketpair which is not available on vxworks, so it fails
to compile.

Task-number: QTBUG-115777
Pick-to: 6.7
Change-Id: I46f3b4ebd937dc4ca2511381dd58451434e6a2fc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-31 07:04:37 +01:00
Ahmad Samir 23d2aaa4f8 QFileSystemModel: blacklist a flaky unittest on macos
Task-number: QTBUG-74471
Pick-to: 6.7 6.6 6.5
Change-Id: I4cda7794300c1a9d941e1543ee66b37efb0dea15
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2024-01-30 21:28:19 +00:00
Noah Davis a4f44e0698 QPainterPath: Fix boundingRect and controlPointRect ignoring start point
The boundingRect and controlPointRect did not use the start point from
the `QPainterPath(const QPointF &startPoint)` constructor until the
`dirtyBounds` or `dirtyControlBounds` member variables were set to true.
Those two are false on construction. This bug was fixed by adding a new
constructor for QPainterPathPrivate that initializes the `elements`,
`bounds` and `controlBounds` member variables with the start point from
the constructor.

There is also an autotest to verify that the top left of the
boundingRect and controlPointRect are at the same position as
elementAt(0) when the start point constructor is used.

[ChangeLog][QtGui][QPainterPath] boundingRect() and controlPointRect()
now use the start point from QPainterPath(const QPointF &startPoint).

Pick-to: 6.7 6.6 6.5
Change-Id: I7bf30364406c14ed60f75d24b78a9a5535f75d93
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2024-01-30 21:28:19 +00:00
Marc Mutz c6aa399d06 QBitArray: avoid overflow in size-to-storage calculations
Unlike other containers, a QBitArray's size() is not limited by
storage, but, esp. on 32-bit platforms, its size_type: A INT_MAX
size() QBitArray only requires 256MiB of storage.

So we can't rely on "won't happen in practice" here and need to avoid
the potential UB (signed overflow) in the (size + 7) / 8
logical-to-storage-size calculation by using unsigned arithmetic.

Use the opportunity to Extract Methods storage_size() and
allocation_size(), which differ by one (d[[0] contains the size() mod
8), making it clear what's what.

[ChangeLog][QtCore][QBitArray] Fixed a bug with QBitArrays whose
size() came within 7 of the size_type's maximum.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I5d94bae9c9c210ba1e36f8cf03609125c81bd15d
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2024-01-30 22:28:19 +01:00
Thiago Macieira 4d7b64cd2f tst_QHostInfo: enable the IPv6 reverse lookups in more systems
I've noticed that on some Windows systems, the resolver refuses to
resolve IPv6-only addresses. But it can still do reverse resolution from
IPv6.

Change-Id: I5dd50a1a7ca5424d9e7afffd17adfe739ded932e
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 13:28:19 -08:00
Thiago Macieira 7b981a4f1a tst_QHostInfo: remove QProcess dependency
Our ideal scenario was to run python to run its getnameinfo()... so just
use getnameinfo() directly. This also avoids the problem of Python not
being present and our falling back to nslookup.

Pick-to: 6.7
Change-Id: I5dd50a1a7ca5424d9e7afffd17adfc830386306f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 13:28:19 -08:00
Thiago Macieira 133c918650 tst_QHostInfo: reorganize the #includes
Pick-to: 6.7
Change-Id: I5dd50a1a7ca5424d9e7afffd17adfb5d0bb9a54c
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 13:28:19 -08:00
Edward Welbourne f4f35fe84a Add expect-fail test-cases for und_US, und_GB to tst_QLocale::ctor()
These exhibit the problem described by a recent bug report.

Task-number: QTBUG-121485
Change-Id: Ia09acfa22e687ba096091a73f30df1ffd22a6e32
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
2024-01-30 14:48:17 +01:00
Edward Welbourne 4fe7e8e51a Rework tst_QLocale::ctor() - split up and make data-driven
There were three things going on in this test (itself a sufficient
reason to split it up):
* Some reporting and checking of the default locale; the reporting is
  duplicated in defaulted_ctor() and the check fitted more naturally
  there.
* Checks that various combinations of language, script and territory
  got resolved according to likely-subtag rules. These were handled
  via a macro and natural candidates to become data-driven.
* A test that territory is preserved when it's the only given tag
  (with a few known exceptions); broken out as a steparate test.

In the process, give the data-rows of the likely-subtag parts names
that let me extend their testing to also test construction from
string. The territory-only cases can't support that, as QLocale
doesn't support und_* forms of tags for unspecified language.

Change-Id: Id9f0fc46f30eb887b47931bad1619255acb44266
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2024-01-30 14:48:17 +01:00
Edward Welbourne 23602b04ba QTEST()-ify QLocale tests
Replace various QFETCH()/QCOMPARE() pairs with QTEST().
Just because it's terser.

Change-Id: I8496a293e3634991dcb33b8c7939f1c3028a63c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 14:48:17 +01:00
Juha Vuolle 2699304628 Take QJsonDocument as a parameter
Instead of separate QJsonObject and QJsonArray types.

Resulted from API-review

Pick-to: 6.7
Change-Id: I977d692d3709a8c3aa872683ddda54a143c25e67
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
2024-01-30 03:39:46 +00:00