Test runner was not properly handling tests which
return the control back to browser event loop.
It was treating such tests as if they exited with
code 0, marking them as succesfull even if they were
eventually failing or hanging.
This commit adds a callback to TestCase so the runner
is notified when a test truly has finished.
As a side effect, two tests need to be disabled for now
as they are failing for wasm, which was not properly
detected previously.
Change-Id: I0eb9383e5bb9cd660431c18747b9e94413629d1e
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The format is changed from 6.7 to support more than UINT32_MAX - 1
elements. The format used to have a quint32 size. Now if the size is
larger or equal to 0xfffffffe (2^32 -2) the old size is an extend
value 0xfffffffe followed by one quint64 with the actual value. The
32 bit size with all bits set is still used as null value.
Fixes: QTBUG-105034
Change-Id: I62188be170fe779022ad58ab84a54b1eaf46e5d9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The XML stream writer previously added namespace declarations with the
same URL as existing ones, but new names, and renamed the XML elements
to use the new namespaces instead of the existing ones.
[ChangeLog] Fix renamed and duplicated namespaces in QXmlStreamWriter.
Pick-to: 6.5 6.6
Fixes: QTBUG-75456
Change-Id: I90706e067ac9991e9e6cd79ccb2373e4c6210b7b
Done-With: Philip Allgaier <philip.allgaier@bpcompass.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Accent color role has been renamed according to name rule of other
color roles in QPalette.
Fixes: QTBUG-116107
Pick-to: 6.6
Change-Id: I70ac98a1e97afbdc7ea5f8d79f808c307e170712
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
The method reads the next element in a loop, as long as valid elements
exist. Within the loop, it returns
- false if the end of an element has been reached
- true if a new element has started
When the document end has been reached, the loop continues, until
readNext() returns Invalid. Then, PrematureEndOfDocumentError is launched.
This is wrong, because reading beyond the document end is caused by a
missing return condition in the loop.
=> Treat document end like element end and return false without
reading beyond it.
=> Test correct behavior in tst_QXmlStream::readNextStartElement()
Fixes: QTBUG-25944
Pick-to: 6.6 6.5 6.2
Change-Id: I0160b65880756a2be541e9f55dc79557fcb1f09f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Add more tests on WebAssembly platform for better tests coverage.
Change-Id: Iaaaa824ae6058a9ae5dba4c4038a7f687bfc17e0
Reviewed-by: Mikołaj Boc <Mikolaj.Boc@qt.io>
Remove stray comment at the end of tst_qxmlstream.cpp
Pick-to: 6.6
Change-Id: I88550e2b75194e7895d8578ca0e8350af59d4dfe
Reviewed-by: Santhosh Kumar <santhosh.kumar.selvaraj@qt.io>
Register the directory tokenError in the build system to expose it to
embedded devices / for cross compiling.
Do not fail the test function, when a test file isn't found. The tested
functionality is platform independent and will be tested on other
platforms.
Task-number: QTBUG-92113
Task-number: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
QXmlStreamReader accepted multiple DOCTYPE elements, containing DTD
fragments in the XML prolog, and in the XML body.
Well-formed but invalid XML files - with multiple DTD fragments in
prolog and body, combined with recursive entity expansions - have
caused infinite loops in QXmlStreamReader.
This patch implements a token check in QXmlStreamReader.
A stream is allowed to start with an XML prolog. StartDocument
and DOCTYPE elements are only allowed in this prolog, which
may also contain ProcessingInstruction and Comment elements.
As soon as anything else is seen, the prolog ends.
After that, the prolog-specific elements are treated as unexpected.
Furthermore, the prolog can contain at most one DOCTYPE element.
Update the documentation to reflect the new behavior.
Add an autotest that checks the new error cases are correctly detected,
and no error is raised for legitimate input.
The original OSS-Fuzz files (see bug reports) are not included in this
patch for file size reasons. They have been tested manually. Each of
them has more than one DOCTYPE element, causing infinite loops in
recursive entity expansions. The newly implemented functionality
detects those invalid DTD fragments. By raising an error, it aborts
stream reading before an infinite loop occurs.
Thanks to OSS-Fuzz for finding this.
Fixes: QTBUG-92113
Fixes: QTBUG-95188
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I0a082b9188b2eee50b396c4d5b1c9e1fd237bbdd
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Add the boilerplate standalone test prelude to each test, so that they
can be opened with an IDE without the qt-cmake-standalone-test script,
but directly with qt-cmake or cmake.
Boilerplate was added using the following scripts:
https://git.qt.io/alcroito/cmake_refactor
Manual adjustments were made where the code was inserted in the wrong
location.
Task-number: QTBUG-93020
Change-Id: I28b6d3815c5f43d2c33ea65764f6f3f8f129eaf3
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They're already suppressed for clang.
-Wself-move was added in GCC 13.1, the CI still doesn't have that so
wrap it in an "#if Q_CC_GNU >= 1301".
Change-Id: I5c2ec78a5003485261b4e3125f85c5b78dd0db22
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
... and collapse adjacent C string literals.
Both QStringBuilder and non-QStringBuilder builds have no problem
resolving an operator+ for char[] and QByteArray, so there's no need
to turn the char[] into a QByteArray using the _ba UDL first.
It just causes pain because not all active branches support this UDL,
so remove, to bring this code in line with what the cherry-picks to
6.2 and 5.15 must needs had to use.
Amends 6326bec46a.
Pick-to: 6.6 6.5 6.5.2
Change-Id: Id3d61483729c51c82f58b826efcc8fc7960c3ccd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
This fixes a crash while parsing an XML file with garbage data, the file
starts with '<' then garbage data:
- The loop in the parse() keeps iterating until it hits "case 262:",
which calls fastScanName()
- fastScanName() iterates over the text buffer scanning for the
attribute name (e.g. "xml:lang"), until it finds ':'
- Consider a Value val, fastScanName() is called on it, it would set
val.prefix to a number > val.len, then it would hit the 4096 condition
and return (returned 0, now it returns the equivalent of
std::null_opt), which means that val.len doesn't get modified, making
it smaller than val.prefix
- The code would try constructing an XmlStringRef with negative length,
which would hit an assert in one of QStringView's constructors
Add an assert to the XmlStringRef constructor.
Add unittest based on the file from the bug report.
Later on I will replace FastScanNameResult with std::optional<qsizetype>
(std::optional is C++17, which isn't required by Qt 5.15, and we want to
backport this fix).
Credit to OSS-Fuzz.
Fixes: QTBUG-109781
Fixes: QTBUG-114829
Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I455a5eeb47870c2ac9ffd0cbcdcd99c1ae2dd374
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
It is necessary to add an AccentColor role to QPalette.
QPalette currently has 21 color roles and 3 color groups, which
require 63 bits to resolve. The resolve mask is implemented with a
qint64, which doesn't provide spare bits for another color role.
The color role NoRole is used as a default value, marking that a role
has not (yet) been defined. The enum value does not represent a valid
brush, even though it can theoretically be stored in QPalette's shared
data.
This patch adds the enum value AccentColor to QPalette::ColorRole,
increasing the available color roles to 22.
To keep the resolve mask at 63 bits, AccentColor is mapped to NoRole
in static constexpr bitPosition.
As the enum range would exceed 64 bits without this tweak, 3 additional
bits are substracted in the respective static assertion.
With NoRole having no bit in the resolve mask, the following adaptions
have been implemented:
- QPalette::resolve() is adapted to explicitly ignore NoRole.
- QPalette::isBrushSet() always returns false for NoRole.
- tst_QPalette::setAllPossibleBrushes() to verify the latter
- operator== ignores NoRole (documentation updated)
AccentColor is added in tst_QPalette::roleValues and enum documentation
is adapted.
In QPalette's default constructor, the AccentColor brush is defaulting
to the Highlight brush, it this is available. Otherwise it is made 30%
darker or lighter than the Base brush, depending on dark/light mode
heuristics.
QPalette's data stram functions have been extended from QDataStream
Version Qt_6_6. If earlier versions are de-serialised, the AccentColor
defaults to Highlight. An autotest function dataStream() has been added
to tst_QPalette.
The QDataStream Version Qt_6_6 has been bumped to 21.
tst_QDataStream has been adapted to the new version and the new
color Role.
Change-Id: I98bbf9de95fb83bda921e9614a0db3a3c0ebdf75
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
- Add missing includes
- Use std::all_of, that also fixes a narrowing conversion warning
(qsizetype).
Change-Id: I0f7f4b91bda4c187b8f8094e3039079c43fbf478
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
These classes depend only on Core, not Gui.
This allows dropping the dependency of tst_qxmlstream and tst_qzip on
QtGui, and prevents a tst_qxmlstream FTBFS when building with
QT_NO_TEXTODFWRITER.
Symbols move from QtGui to QtCore, but the classes are private API, so
not under BC constraints.
The classes are not used outside qtbase, so no other in-tree users
need porting.
Task-number: QTBUG-3897
Change-Id: Ifa148f43ec139d7f9ac1f3893e2fcf4640e3c60c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QtXml is only DOM and SAX, not QXmlStreamReader/Writer (those are in
QtCore).
Pick-to: 6.5 6.2
Change-Id: I8454d7db90303d347d5b4be94c9f21401d1e273f
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Only unzip the test suite in initTestCase(), but run the tests from
runTestSuite(). This is mainly useful when running specific a unittest
locally, no need to wait for the whole zipped test suite to run.
Change-Id: I518a2de716d3d07fb5a78298f1bd3ab2759e744b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
One each of L1 and non-L1.
Will help porting that API to QAnyStringView.
Pick-to: 6.5
Change-Id: I51afc07c5b2384409c2627164e95265265fbb544
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Check for state.remainingChars to signal an encoding error only after
the last chunk has been processed. Splitting surrogates at chunk
boundaries is normal operation, not an error. Only if this happens at
the end of the whole input should we raise an error.
Amends fa2153bd10.
Pick-to: 6.5
Change-Id: Id92e37becaed25bbc11e0c22dedc4d41fb23f92a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
... not just those in the BMP.
The use of char32_t makes the isValid helper function easier to
read. Its passing to write() is enabled by the recent port to
QAnyStringView, which has a char32_t ctor.
Split into per-plane executions of the test function to avoid
running into timeouts on asan builds down the road.
As a drive-by, replace use of QPair with a proper struct, and
make the intervals symmetrically inclusive the bounds.
Pick-to: 6.5
Change-Id: I2c6858d7e6a88f448eac1b1e124d7d7b82828d4c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
WHEN writing an invalid character, THEN we expect the writer to report
an error.
The old code had it the wrong way around. It checked that WHEN the
writer reports an error, THEN the character was invalid.
The formulations are equivalent, but the latter is mixing up cause and
effect, making it less clear what's being checked (QXmlStreamWriter,
not isValidSingleTextChar()), so swap.
Pick-to: 6.5 6.4 6.2
Change-Id: I703de9ddde98d9913977a913f671472930735900
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Mate Barany <mate.barany@qt.io>
This improves the runtime of this particular test function by
almost 17% on my machine.
Pick-to: 6.5 6.4 6.2 5.15
Change-Id: Icd77cdda92374b92121988c99e56787d405fa2d9
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This saves (mostly in corelib/time/) some complications that used to
arise from needing different code-paths for different time-specs.
Task-number: QTBUG-108199
Change-Id: I5dbd09859fce7599f1ba761f8a0bfc4633d0bef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that the on() matcher has been replaced by one that doesn't
ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Added two NOLINTNEXTLINEs in tst_qbitarray and tst_qcontiguouscache,
to avoid porting calls that explicitly test count().
Change-Id: Icfb8808c2ff4a30187e9935a51cad26987451c22
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
For some reason the QTest::ignoreMessage() was conditioned on the type
being tested being Array; however, the warning is in fact produced for
all types. So anticipate it for all and make the test log less noisy.
Change-Id: I78681624252ff8a71f080204f8b031609ddac468
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.
Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace, with manual
unstaging of the actual definition and documentation in dist/,
src/corelib/doc/ and src/corelib/global/.
Task-number: QTBUG-99313
Change-Id: I4c7114444a325ad4e62d0fcbfd347d2bbfb21541
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
The addCommonCborData() helper had two identical rows named simple255.
It only needs one.
Change-Id: Ie934c31f373069788c3ef774fde8956b54814e67
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Two rows named "hex" were a collision we should avoid.
The two "showpos" rows could be better distinguished.
Change-Id: I43727041eb00e6883ce8b34b346de5e2a63f1a34
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Now I can read it and work out how to rename the duplicated data tag.
Change-Id: I78f2b3f38f955fa6e6a88cb87cfca6e4f755a177
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
We only want to enable writing BOM if we have _not_ started
writing.
Fixes: QTBUG-106279
Pick-to: 6.2 6.3.2 6.4 6.4.0
Change-Id: Ibcbc101b931615fddb2507f01307bf9619772d7b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
CMakeLists.txt and .cmake files of significant size
(more than 2 lines according to our check in tst_license.pl)
now have the copyright and license header.
Existing copyright statements remain intact
Task-number: QTBUG-88621
Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
When the method is wrapped into
if QT_DEPRECATED_SINCE(MAJ, MIN)
we also need to add QT_DEPRECATED_VERSION_[X_]_MAJ_MIN macro right in
front of the method declaraion, to actually trigger a deprecation
warning.
This patch does that for QCursor's deprecated methods, and fixes all
related compilation warnings in QtBase.
Task-number: QTBUG-104857
Pick-to: 6.4 6.3 6.2
Change-Id: Ic8d059e8c852d4b2dee55e7ea94f4fc7a402cdf4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Port the constructor and addData() method to QAnyStringView, but keep
the overloads taking a QByteArray to avoid extra copies when actual
QByteArray is passed. These overlaods need to be Q_WEAK_OVERLOADs, to
avoid ambiguities (e.g. for const char * arguments).
Additionally, add a test to make sure the patch doesn't break parsing
from a QLatin1StringView input.
[ChangeLog][QtCore][QXmlStremReader] Added constructor and addData()
overloads taking QAnyStringView.
Change-Id: I0efaab82a2123271c88407e380f3c67d1099a4a6
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This is a repeat of commit de6ced6692
"QCborValue: fix incorrect to{Array,Map} when the value is empty" (6.4),
which fixed the same thing for QCborValue. I've just copied the exact
same implementation onto the QJsonValue functions.
Pick-to: 6.2 6.3 6.4 5.15
Fixes: QTBUG-104085
Change-Id: I175efddd75f24ae59057fffd16f6b257bf7ed36d
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.
Task-number: QTBUG-67283
Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
... by providing also op>> for char16_t.
[ChangeLog][QtCore][QTextStream] Added op>>(char16_t&).
Change-Id: I2f6cc2b2cdacd5190d364f94c1830f6de62d3b7e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Clazy complains about all uses of QLatin1Char these days, but if one
actually applies the fixit to turn
out << QLatin1Char(' ');
into
out << u' ';
the space is now streamed as an int (20), not as a space.
Fix by providing an explicit char16_t overload.
[ChangeLog][QtCore][QTextStream] Added op<<(char16_t).
[ChangeLog][Important Behavior Changes] QTextStream streams char16_t's
as QChars now instead of outputting the numeric value. If you want to
preserve the old behavior, cast the char16_t to a numeric type, such
as ushort or int, and stream that. This is backwards-compatible.
Pick-to: 6.3
Change-Id: I42d422cdebb27d38ac1714b22ef186642ec407e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
These particular testcases request huge buffers from malloc() .This is
intentional and the test expects malloc() to return NULL. Address
sanitizer catches this and considers it a problem.
Could also be skipped in runtime by setting the environment variable:
ASAN_OPTIONS=allocator_may_return_null=1
Task-number: QTBUG-89400
Change-Id: Id3a9b586be9c0bad4a007e1731f2bc1a879cc76e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Use of QSKIP() means the whole test is skipped; when all applicable
parts of a test have passed and some part of the test is inapplicable,
merely report that it is skipped, rather than discarding the PASS for
all the parts that do work.
In the process, eliminate a spurious layer of indentation; the earlier
test only needed a scope to contain its declaration, a goal adequately
achieved by the scope of the if constexpr block.
Task-number: QTBUG-99123
Pick-to: 6.2 6.3
Change-Id: Ie4790a24ebf49a7f3035ffad42d78450e1560832
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>