qt5base-lts/tests/auto/corelib/text/qstringbuilder
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
..
qstringbuilder1 QStringBuilder: handle freeSpaceAtBegin() in op+= 2021-12-21 18:14:17 +01:00
qstringbuilder2 Remove the qmake project files 2021-01-07 15:32:28 +01:00
qstringbuilder3 Remove the qmake project files 2021-01-07 15:32:28 +01:00
qstringbuilder4 Remove the qmake project files 2021-01-07 15:32:28 +01:00
CMakeLists.txt Port qtbase/tests/auto/corelib/text tests to CMake 2020-04-27 14:34:51 +02:00