diff options
author | Liang Qi <liang.qi@qt.io> | 2017-02-10 21:10:21 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-02-10 22:35:04 +0100 |
commit | 364b161122b567e3a6f7343d438fb540b9fb7e5c (patch) | |
tree | 3d49953be9a58295a8c956cf5fdb00f581020605 /tests/auto/corelib/tools | |
parent | e58401a75b29beb38d37a40072106d5ef7cb0336 (diff) | |
parent | 8a410f60ae39b06555d807581caf7cb8bfab4fac (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/widgets/widgets/qmainwindowlayout_p.h
Change-Id: Id406a67606b885052ed405b0fbc8eea7d9d03224
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r-- | tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp index 0c098cb1c3..8a55f54449 100644 --- a/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp +++ b/tests/auto/corelib/tools/qstringmatcher/tst_qstringmatcher.cpp @@ -54,12 +54,21 @@ void tst_QStringMatcher::qstringmatcher() // public Qt::CaseSensitivity caseSensitivity() const void tst_QStringMatcher::caseSensitivity() { - QStringMatcher matcher; + const QString haystack = QStringLiteral("foobarFoo"); + const QStringRef needle = haystack.rightRef(3); // "Foo" + QStringMatcher matcher(needle.data(), needle.size()); - matcher.setCaseSensitivity(Qt::CaseSensitive); QCOMPARE(matcher.caseSensitivity(), Qt::CaseSensitive); + QCOMPARE(matcher.indexIn(haystack), 6); + matcher.setCaseSensitivity(Qt::CaseInsensitive); + QCOMPARE(matcher.caseSensitivity(), Qt::CaseInsensitive); + QCOMPARE(matcher.indexIn(haystack), 0); + + matcher.setCaseSensitivity(Qt::CaseSensitive); + QCOMPARE(matcher.caseSensitivity(), Qt::CaseSensitive); + QCOMPARE(matcher.indexIn(haystack), 6); } void tst_QStringMatcher::indexIn_data() |