diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index d15be52e413..f3d2594e348 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -432,6 +432,8 @@ private slots: void prepend_char_data() { prepend_data({EmptyIsNoop, Latin1Encoded}); } #endif + void prependEventuallyProducesFreeSpaceAtBegin(); + void append_qstring() { append_impl(); } void append_qstring_data() { append_data(); } void append_qstringview() { append_impl(); } @@ -3809,6 +3811,14 @@ void tst_QString::prepend_bytearray_special_cases() } #endif // !defined(QT_RESTRICTED_CAST_FROM_ASCII) && !defined(QT_NO_CAST_FROM_ASCII) +void tst_QString::prependEventuallyProducesFreeSpaceAtBegin() +{ + QString s; + for (int i = 0; i < 100 && !s.data_ptr().freeSpaceAtBegin(); ++i) + s.prepend(u'd'); + QCOMPARE_GT(s.data_ptr().freeSpaceAtBegin(), 1); +} + void tst_QString::replace_uint_uint() { QFETCH( QString, string );