qt5base-lts/tests/auto/corelib
Marc Mutz 11409f4c02 QStringBuilder: handle freeSpaceAtBegin() in op+=
Amends 9b320edb53.

The above commit made the mistake of relying on the 30yr+ old
fundamental relation

    size() - capacity() == freeSpaceAtEnd()

which, however, Qt 6's prepend()-optimization (freeSpaceAtBegin())
broke. Because of that, while size() - capacity() may be large enough
to hold the new data, if freeSpaceAtBegin() > 0, then freeSpaceAtEnd()
may not.

Fix by inspecting freeSpaceAtEnd() instead of capacity(). The
following reserve() call is unaffected, since it internally already
adds freeSpaceAtBegin() to the requested size, which is why the
unconditional reserve() in 9b320edb535a0fbe118933d2e983b73f90c32685^
worked while 9b320edb535a0fbe118933d2e983b73f90c32685's capacity()
check did not.

Fixes: QTBUG-99330
Pick-to: 6.2 6.3
Change-Id: I520f36216011423f97a24484263acd40d8b1fa43
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
2021-12-21 18:14:17 +01:00
..
animation tst_QPropertyAnimation: fix leaks occurring under normal operation 2021-12-18 10:38:21 +01:00
global tst_qglobalstatic is halted on INTEGRITY device 2021-12-20 10:14:38 +02:00
io tst_QIODevice: fix UB (precondition violation) in SequentialReadBuffer::readData() 2021-12-16 23:25:47 +01:00
itemmodels Use QAbstractItemModelTester in all QSortFilterProxyModel tests 2021-12-14 14:11:26 +01:00
kernel Fix autotest runtime failures on INTEGRITY 2021-12-16 19:45:08 +02:00
mimetypes Compile autotests for Integrity 2021-09-20 17:29:04 +03:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin QNX: check and use elf.h from alternative location 2021-11-30 14:37:52 +02:00
serialization QXmlStreamReader: update test distribution 2021-12-19 18:58:44 +01:00
text QStringBuilder: handle freeSpaceAtBegin() in op+= 2021-12-21 18:14:17 +01:00
thread QtFuture::connect: exclude QPrivateSignal from the resulting future type 2021-12-11 21:47:17 +00:00
time Skip QTimeZone::checkOffset() if there are no valid zones to test 2021-11-26 02:14:52 +01:00
tools tst_QHash: Update the erase_edge_case test 2021-12-17 16:37:49 +00:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00