summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qstringlist
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-10-03 00:01:46 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-10-22 14:37:57 +0300
commitf2e19d37de36a2dd7bea8710d4582414f3fa175b (patch)
tree666dc93988780d4029191263294ef22ae396bb2d /tests/auto/corelib/text/qstringlist
parentc205f051282e78e9d2608b5863d14c6d0725b77c (diff)
QStringList: add lastIndexOf() overloads
[ChangeLog][QtCore][QStringList] Added lastIndexOf() overloads that take a QString/QStringView/QLatin1StringView and a Qt::CaseSenitivity parameters. Prior to this calling lastIndexOf() would call the methods inherited from the base class. This change is source compatible and existing code should continue to work. Task-number: QTBUG-116918 Change-Id: Ia50c884c00021bf581c23c12e0e0c22700dae446 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qstringlist')
-rw-r--r--tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp
index e511d63be1..712d306dca 100644
--- a/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp
+++ b/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp
@@ -159,6 +159,15 @@ void tst_QStringList::lastIndexOf()
QCOMPARE(list.lastIndexOf(QStringView(search), from), expectedResult);
QCOMPARE(list.lastIndexOf(QLatin1String(search.toLatin1()), from), expectedResult);
QCOMPARE(list.lastIndexOf(QRegularExpression(QRegularExpression::escape(search)), from), expectedResult);
+
+ const QString searchUpper = search.toUpper();
+ QCOMPARE(list.lastIndexOf(searchUpper, from, Qt::CaseInsensitive), expectedResult);
+ QCOMPARE(list.lastIndexOf(QStringView(searchUpper), from, Qt::CaseInsensitive), expectedResult);
+ QCOMPARE(list.lastIndexOf(QLatin1String(searchUpper.toLatin1()), from, Qt::CaseInsensitive),
+ expectedResult);
+ const QRegularExpression re(QRegularExpression::escape(searchUpper),
+ QRegularExpression::CaseInsensitiveOption);
+ QCOMPARE(list.lastIndexOf(re, from), expectedResult);
}
void tst_QStringList::filter()