summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2015-09-27 01:26:28 +0200
committerSamuel Gaist <samuel.gaist@edeltech.ch>2016-09-20 21:23:08 +0000
commit9f2c260f881b384ae719c60ea9833feb42251058 (patch)
treea4171351d6cbf7c6f47fe2b95211d2d677da7f46
parent8347b54b9738e29807c3c7913bda8fe7cf3f7dba (diff)
Add missing test for QReguarExpression for QTextDocument::findMultiple
Change-Id: Ia9b3eb21a178da4ae2844dba37b7e1cc669d6b50 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
-rw-r--r--tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
index bb20d99e30..3c9de9d211 100644
--- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
@@ -468,6 +468,24 @@ void tst_QTextDocument::findMultiple()
cursor = doc->find(expr, cursor);
QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+
+ QRegularExpression regularExpression("bar");
+
+ cursor.movePosition(QTextCursor::End);
+ cursor = doc->find(regularExpression, cursor, QTextDocument::FindBackward);
+ QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+ cursor = doc->find(regularExpression, cursor, QTextDocument::FindBackward);
+ QCOMPARE(cursor.selectionStart(), text.indexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+
+ cursor.movePosition(QTextCursor::Start);
+ cursor = doc->find(regularExpression, cursor);
+ QCOMPARE(cursor.selectionStart(), text.indexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
+ cursor = doc->find(regularExpression, cursor);
+ QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
+ QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3);
}
void tst_QTextDocument::basicIsModifiedChecks()