summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/itemmodels
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-17 01:01:01 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-17 01:01:01 +0200
commit6f27bb135246b7fe9d11ba58e05d2b7661bc2080 (patch)
tree9704e1c4ffb775472a9984872c3bd292faa999a5 /tests/auto/corelib/itemmodels
parentdc4212b3a694e143595968419ae5ad695ab2aa03 (diff)
parentc222a9283d94ad1e29334bb2fba0beef7cc716c7 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'tests/auto/corelib/itemmodels')
-rw-r--r--tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
index f305edb2c5..9fab36deaa 100644
--- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp
@@ -458,6 +458,34 @@ void tst_QAbstractItemModel::match()
res = model.match(start, Qt::DisplayRole, QVariant("bat"), -1,
Qt::MatchFixedString | Qt::MatchCaseSensitive);
QCOMPARE(res.count(), 1);
+
+ res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1,
+ Qt::MatchRegularExpression);
+ QCOMPARE(res.count(), 2);
+ res = model.match(start, Qt::DisplayRole, QVariant(".*O.*"), -1,
+ Qt::MatchRegularExpression | Qt::MatchCaseSensitive);
+ QCOMPARE(res.count(), 0);
+
+ res = model.match(start, Qt::DisplayRole, QVariant(QRegularExpression(".*O.*")),
+ -1, Qt::MatchRegularExpression);
+ QCOMPARE(res.count(), 0);
+ res = model.match(start,
+ Qt::DisplayRole,
+ QVariant(QRegularExpression(".*O.*",
+ QRegularExpression::CaseInsensitiveOption)),
+ -1,
+ Qt::MatchRegularExpression);
+ QCOMPARE(res.count(), 2);
+
+ // Ensure that the case sensitivity is properly ignored when passing a
+ // QRegularExpression object.
+ res = model.match(start,
+ Qt::DisplayRole,
+ QVariant(QRegularExpression(".*O.*",
+ QRegularExpression::CaseInsensitiveOption)),
+ -1,
+ Qt::MatchRegularExpression | Qt::MatchCaseSensitive);
+ QCOMPARE(res.count(), 2);
}
typedef QPair<int, int> Position;