[ChangeLog][QtCore][QByteArray] QByteArray::toInt(),
QByteArray::toDouble() and the other number conversion functions
now ignore leading and trailing whitespaces, as their QString
counterparts already did. For consistency reasons, the same
behavior was added to qEnvironmentVariableIntValue() also.
Task-number: QTBUG-66187
Change-Id: I8b5e478ea8577b811d969286ea9e269f539c1ea4
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Similar to commit cd64a96b31 we also need
to normalize the strings before comparison in order to be compliant with
the ECMAScript test suite.
This patch also adds the remaining test cases from
built-ins/String/prototype/localeCompare/15.5.4.9_CE.
Since the same tests are also failing with strcoll/qt_compare_strings,
this simplifies the code to always normalize except when using ICU
(which gets it right by default).
Change-Id: I16b32da7fc70dc7e6725c49f66fe9941d0bf3a47
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This makes QCborValue more future compatible, as code written today for
tags that QCborValue does not recognize will continue to work if
QCborValue gains support for it in the future.
This change also obviates the need for reinterpretAsTag(), which I had
not written unit tests for as I knew this change was coming.
Change-Id: I052407b777ec43f78378fffd15302bdc34f66755
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
The compiler was generating some vectorized code for qresource.cpp but
it wasn't very efficient. So improve upon it and make use in other
places where we read UTF-16BE strings.
[ChangeLog][QtCore] Added an overload of q{To,From}{Big,Little}Endian
that operates on a memory region.
Change-Id: I6a540578e810472bb455fffd1531fa2f1d724dfc
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Questions:
1) should QCborMap::extract return value_type (a pair) instead of just
the value?
2) should the both return the iterator to the next element too, like
erase()?
Change-Id: I052407b777ec43f78378fffd15302a9c14468db3
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This change only adds them to the registry and reserves the IDs. The
next commit will handle conversions.
Change-Id: I56b444f9d6274221a3b7fffd150d2d49f40940c2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Fixes ambiguous template instantiation for types that derive from both
a QObject and Q_GADGET. For such types we treat them only as QObjects
as they extend the functionality of the gadget.
Task-number: QTBUG-68803
Change-Id: Ic42766034e14e5df43c4e6f7811e2c0be1dc7e74
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
To make the minimum amount of changes:
- Extract the library files into the expected hierarchy.
- Introduce a variable with the path to the directory.
- Make the static function a member function so it can use the variable
Change-Id: Ibf3106c3606d198a8deb8cb2a5cbde57207221c7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The existence of the helper application confuses Coin which will
result in an error.
Change-Id: I3edf3f27acbe133b180d41a8ae950991e9a5b5da
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Not putting executables into debug/release subdirectories leads to the
WinRT AppxManifest being overwritten by the wrong configuration. When Qt
is configured with -release for example, it was possible that the debug
manifest (Manifest files are always created next to the target) is
written last and thus contains debug VCLibs as a dependency.
Additionally the test was changed in that way, that the resulting file
system structure (having helper and test application in a "top level"
debug and release folder) is the same structure as in tst_qobject.
Change-Id: I53d5238ff36706eb9c6f8eb04b954ec595ca30de
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Not putting executables into debug/release subdirectories leads to the
WinRT AppxManifest being overwritten by the wrong configuration. When Qt
is configured with -release for example, it was possible that the debug
manifest (Manifest files are always created next to the target) is
written last and thus contains debug VCLibs as a dependency.
Additionally the test was changed in that way, that the resulting file
system structure (having helper and test application in a "top level"
debug and release folder) is the same structure as in tst_qobject.
Change-Id: I55078563304959c41e0dd9bb7bb91a6fc51e005a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
By disabling the "stdinprocess"-related tests/code...
... but differently. After fixing my earlier mistakes I'm getting
segmentation faults when it executes a couple different library calls
after the QProcess object has started.
Task-number: QTBUG-68596
Change-Id: Id42a1f939c000754a187dee90c4a4cdfec816232
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
The "app" subfolder was already excluded in the .pro-file but Android
supports QProcess, so lets include it in the build. Unfortunately it
currently has trouble and crashes (the child process or both processes).
So we skip those tests.
Task-number: QTBUG-68596
Change-Id: I2e6d0869c408bf08b22c02145db8ce522c64c617
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
To make it run we make sure it finds the syslocaleapp, however since it
causes a crash we skip the test that uses it...
"formatTimeZone" was failing, but it is the exact same issue as in
e08ba34f26, so we solve it the exact same
way.
Change-Id: Ifd5c796735775dad94acf55210cf18c0f4d375ca
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Same issue as has been seen a few other places: path to executable being
wrong, and then a crash when the paths are fixed.
Change-Id: I77a596c6e52d2a02a69a6b9dfe91f878b3ffe07c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
The row names for this test were very unspecific.
After reverse-engineering what they are testing, I gave them proper
descriptive names, which allowed me to notice that there were tests
for "filtered in after sourceModel->setData" but not for
"filtered out after sourceModel->setData".
Change-Id: Ib79108db803ae77fb65d29cf0c0ef96c26655980
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
QTest::addRow expects a format specifier; this usage makes GCC complain
with -Wformat-security. Use the "old" newRow call instead.
Change-Id: Ieed8e4f64ff5e3d0d4e87325629d20ed6839ff9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
If you're on a Unix platform which don't have the necessary defines then
the thread will never be launched due to an error. Skip the test
instead.
Change-Id: I83159988b8f330a750c7aa328a8805e4fa478070
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Using SSE 4.1 because of the need for PMINUB.
Change-Id: Ib48364abee9f464c96c6fffd152ebd3f8ea7fe94
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
With ICU and on macOS it appears that the comparison is done on a
canonical form, while CompareString(Ex) does not do that, as the added
test verifies. Explicit normalization fixes that.
As a bonus, this also unifies the code path between regular Windows
and UWP by unconditionally using CompareStringEx (which requires
Vista or later).
This issue surfaced while running the ECMASCript 6 Conformance Test
Suite in QtQml.
This re-uses the existing test for localeAwareCompare, which was
disabled on Windows, macOS and Linux with ICU (the common case).
Change-Id: I52440fce60b54745ead1eff005ec51e98e2a79ec
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Not putting executables into debug/release subdirectories leads to the
WinRT AppxManifest being overwritten by the wrong configuration. When Qt
is configured with -release for example, it was possible that the debug
manifest (Manifest files are always created next to the target) is
written last and thus contains debug VCLibs as a dependency.
Additionally the test was changed in that way, that the resulting file
system structure (having helper and test application in a "top level"
debug and release folder) is the same structure as in tst_qobject.
Change-Id: I034752b4e5d22b98f6def95fb53c2b1947dded03
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
When removing rows, the tester is looking at the data of the row
"just before" and the row "just after" the removed rows, to see if
they are still the same at the end of the removal operation.
Guard this with bounds check, in case there is no row just before
or just after.
This is the opportunity to use modeltester in tst_qidentityproxymodel,
which was already a testcase for removing the only row in a given parent.
Change-Id: Iec8228c16b9c670b794e2665356d153679178494
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
When testing zones "America/Mazatlan" and "Mexico/BajaSur" the test
crashes from an assert. Skip testing the zones for now.
Task-number: QTBUG-69132
Change-Id: I595089647792e9a2c094d63cb837584b8cdc9cb9
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
The previous approach of having the signalbug helper in a subdirectory did
not work for shadow builds, as QFINDTESTDATA would not find that dir. By
putting both test and helper into the same directory, the helper will be
found in the test's current working directory.
The second problem was that not putting executables into debug/release
subdirectories might have lead to the WinRT AppxManifest being overwritten
by the wrong configuration. When Qt is configured with -release for
example, it was possible that the debug manifest (Manifest files are
always created next to the target) is written last and thus contains
debug VCLibs as a dependency.
Change-Id: Ia39315432860405642542449296c16dd2ae9fa9f
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Skip a few tests that Android's time-zone information doesn't suffice
to get right.
Task-number: QTBUG-68835
Change-Id: Ibf8d213c96b29d74fc478a0ede686ae52b5200fb
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Where possible. Sometimes the replacement is QTRY_COMPARE instead.
Also don't use QTestEventLoop directly when it can also be replaced with
QSignalSpy use.
Remove the TimerHelper class, since its uses can be done with QSignalSpy (and a
lambda when remainingTime is checked). Although checking static single-shot
timers still needs a target object, so use a stripped down version in those
tests.
remainingTimeDuringActivation() was not actually testing the repeating case, but
single-shot case twice, so fix that. In the repeating case the remaining time is
exactly 20 ms on my machine, but QEMU emulation seems to be slow enough for time
to advance before the lambda is executed, so relax the conditions.
Task-number: QTBUG-63992
Change-Id: Iae92ff7862a13d36e695eec63b54403ec872f2b4
Reviewed-by: Sami Nurmenniemi <sami.nurmenniemi@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
This only enables compilation, it doesn't fix any test.
Qt on Android supports process, but not TEST_HELPER_INSTALLS. See also
acdd57cb for winrt.
android-ndk-r10e is used to compile, see
http://doc-snapshots.qt.io/qt5-5.11/androidgs.html .
corelib/io/{qdir,qresourceengine} need to be fixed later.
Done-with: Frederik Gladhorn <frederik.gladhorn@qt.io>
Done-with: Mårten Nordheim <marten.nordheim@qt.io>
Change-Id: I34b924c8ae5d46d6835b8f0a6606450920f4423b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Need to do the same for startsWith() and endsWith(). indexOf() is a lot
harder.
[ChangeLog][QtCore][QByteArray] Added compare(), which takes
Qt::CaseSensitivity as one of the parameters. This function is more
efficient than using toLower() or toUpper() and then comparing.
Change-Id: Ib48364abee9f464c96c6fffd152e69bde4194df7
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
After the move to PCRE2, optimizing patterns has been a thorn in the
side due to the fact that PCRE2's JIT compiler modifies the pattern
object itself (instead of returning a new set of data, like PCRE1
did). To make this fit with the existing behavior, a read/write
lock was introduced, with the read part locking when matching and
the write when compiling (or JIT-compiling) the pattern.
This locking strategy however introduced a performance issue,
as we needed:
* to acquire a write lock to compile/optimize the pattern (incl. the
common case where the pattern was already compiled, so bailing out
immediately);
* to acquire a read lock during the actual match, to prevent
some other thread from optimizing the pattern under our nose.
This was due to the "lazy" optimization policy of QRegularExpression
-- optimize a pattern after a certain number of usages. The
excessive amount of locking effectively limited scalability.
Simplify the code, and drop that policy altogether: since JIT
compiling in PCRE2 is faster and pretty much "always recommended",
just always do it for any pattern (unless it gets disabled via
env variables) when compiling it.
This allows to go back to a plain QMutex, and now the actual
matching doesn't require acquiring any locks any longer. Of course,
there is still a mutex acquired just before matching for checking
whether the pattern needs recompiling in the first place; this can
probably be further optimized via double-checked locking (using
atomics), but not doing it right now.
This shift makes a couple of pattern options controlling
optimization useless, and allows to centralize the 3
QRegularExpression tests (which were actually the very same test,
just setting slightly different optimizations strategies).
While at it, install a stress-test for threading, with the idea
of running it under TSAN or helgrind to catch bugs in
QRegularExpression's locking.
[ChangeLog][Important Behavior Changes][QRegularExpression] Regular
expressions are now automatically optimized (including JIT
compiling) on their first usage. The pattern options
OptimizeOnFirstUsageOption and DontAutomaticallyOptimizeOption no
longer have any effect, and will get removed in a future version of
Qt. QRegularExpression::optimize() can be still used to compile and
optimize the regular expression in advance (before any match), if
needed.
Task-number: QTBUG-66781
Change-Id: Ia0e97208ae78255fe811b78029ed01c204e47bd2
Reviewed-by: David Faure <david.faure@kdab.com>
A change between 5.11 and dev has modified the position of testqrc
inside the resource list. Adapt accordingly.
Change-Id: I697103f4b8c9e93bb613e814c47a4e68e9a997ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
... by adding a prefix to the resource.
On android there is a resource ("qpdf") which gets included in the root
in all applications, included from "src/gui/painting/painting.pri".
So we move the test data to a sub-folder.
Task-number: QTBUG-68596
Change-Id: I67f2ed79a32c68d9a76cafba8ef23fe0da7c0fe8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
"terminate" and "terminated" both fail on Android since
QThread::terminate not supported on Android. So we should skip them.
Task-number: QTBUG-68596
Change-Id: Id0d1dde2cfa02bb2978e5dd16087bf8f3bf112b0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
In tst_QDateTime::springForward(), we test correct handling of times
in the gap; these are formally invalid and a mktime() implementation
may reasonably reject them causing our date-time code to produce an
invalid result. So handle that case gracefully in the tests, only
insisting on consistency between the two ways of preparing the date.
In one test, package the repeated code I was going to adapt into a
macro to save repeitition.
Task-number: QTBUG-68832
Task-number: QTBUG-68839
Change-Id: Ib8a16ff007f4e75ab2ccff05b1ccf00a45e50dc8
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Android doesn't use the proper zone-abbreviation, so just check it
starts with the right date-time. Revised the way the #if-ery for that
is handled, to avoid repetition of the (now more complex) condition in
the two tests affected.
Task-number: QTBUG-68833
Change-Id: Iceb5469f46c69ba5cdbaf7ca050ad70f2bb74f44
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Have a test expect what it does produce rather than fail what we can't
fix.
Task-number: QTBUG-68837
Change-Id: Icda7bd9968682daf97d46d597f8bb0433560cde2
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
They used different messages for the same excuse, which weren't well
worded in any case; and their #if-ery was differently decorated.
Change-Id: I28f5032693aff1036cb086ac4032c669110a5cb5
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This autotest fails on QEMU armv7 builds.
Task-number: QTBUG-68866
Change-Id: Idb4bf39712a22c40f6d779a46ad2dd1f456ef48b
Reviewed-by: Tony Sarajärvi <tony.sarajarvi@qt.io>
QString::sprintf(), like the C printf-family, always includes two
digits in any exponent it outputs. Up to 5.6, number() and arg()
taking a double did the same; but changes at 5.7 to enable opting out
of the leading zero this implies for a single-digit exponent
accidentally opted out of it in args() and number(). This commit
fixes number() and arg() to include QLocaleData::ZeroPadExponent in
the flags they pass down to the C locale's doubleToString(), restoring
the prior behavior, including consistency with sprintf().
[ChangeLog][QtCore][QString] Formatting of doubles with single-digit
exponent, by number() or args(), now includes a leading zero in that
exponent, consistently with sprintf(), as it did up to 5.6.
Task-number: QTBUG-63620
Change-Id: I10c491902b8556e9f19e605177ead8d9fd32abd9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This is very similar to QJsonDocument, but there's no QCborDocument.
QCborValue is that.
[ChangeLog][QtCore] Added QCborValue, QCborArray and QCborMap, classes
that permit DOM-like access to CBOR data. The API is similar to
QJsonValue, QJsonArray and QJsonObject, respectively.
Change-Id: I9741f017961b410c910dfffd14ffca50dd8ef3ba
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
QIODevice represents considreable overhead, even with just QBuffer, for
parsing simple things. Benchmarking showed it was spending 25% of the
parsing time inside one QIODevice function or another. So this commit
accomplishes two things:
1) it increases the buffer size from 9 bytes to up to 256, which should
reduce the number of calls into the QIODevice
2) if the source data is a QByteArray, then use it directly and bypass
the QIODevice, thus increasing performance considerably
Change-Id: I56b444f9d6274221a3b7fffd150c531c9d28e54b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Avoids an unused function warning.
Change-Id: Id221595920e9a34eb83b66fe123d664f60fcae05
Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
qFuzzyIsNull has a fixed range, where qFuzzyCompare can tell if numbers
are different in a more relative range. Without it QPointFs that are
heavily scaled will be interpreted as identical, when they are quite
different at their own scale.
Task-number: QTBUG-60359
Task-number: QTBUG-62161
Change-Id: Ic4ba90e9e994aedff5548d690f053eb309b0a60b
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
It happens because our filesystemwatcher thinks it is subdirectory and not
two different paths
Task-number: QTBUG-60676
Change-Id: Ic753e9481cb26303a030044e0a5ab4d703bc529f
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>