Add missing test for QReguarExpression for QTextDocument::findMultiple

Change-Id: Ia9b3eb21a178da4ae2844dba37b7e1cc669d6b50
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Samuel Gaist 2015-09-27 01:26:28 +02:00
parent 8347b54b97
commit 9f2c260f88

View File

@ -468,6 +468,24 @@ void tst_QTextDocument::findMultiple()
cursor = doc->find(expr, cursor); cursor = doc->find(expr, cursor);
QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar")); QCOMPARE(cursor.selectionStart(), text.lastIndexOf("bar"));
QCOMPARE(cursor.selectionEnd(), cursor.selectionStart() + 3); 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() void tst_QTextDocument::basicIsModifiedChecks()