From 4cb21ded95a6fcb4b7accd9c43aa6ace40f8d02c Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Thu, 19 Nov 2020 13:07:17 +0100 Subject: Add unit test for QString::insert(negativeint, QChar) QString::insert(qsizetype, QChar) can insert at negative positions, then counting from the end of the string. Coverage analysis revealed we do not have a unit test for this. This patch adds a unit test. Change-Id: I8d41b38df964c07fe2d2e7be444f8236c9e19b5d Reviewed-by: Sona Kurazyan (cherry picked from commit 7b0fd207756d367db768c3cb546fa439c15bbac8) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/text/qstring/tst_qstring.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/corelib/text/qstring/tst_qstring.cpp') diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index ab118deb90..04a4469a7d 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -2384,6 +2384,7 @@ void tst_QString::insert_special_cases() QCOMPARE(a.insert(1,'e'), QString("Yes")); QCOMPARE(a.insert(3,'!'), QString("Yes!")); QCOMPARE(a.insert(5,'?'), QString("Yes! ?")); + QCOMPARE(a.insert(-1,'a'), QString("Yes! a?")); a = "ABC"; QCOMPARE(a.insert(5,"DEF"), QString("ABC DEF")); -- cgit v1.2.3