summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-11-09 10:34:33 +0100
committerLiang Qi <liang.qi@qt.io>2018-11-09 10:34:33 +0100
commitbc07958f922519bca1acc5930498ee0273576699 (patch)
treed5fda8e4458c2543458dbaeb7f4830c6d4750954 /tests/auto
parentb01a53fe328b37324c6e3ab38c50f156c93c6afe (diff)
parentdec7961709c90f6977d2447f7fa6c6625af41cb2 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
Conflicts: .qmake.conf qmake/Makefile.unix src/gui/text/qtextdocument.cpp src/gui/text/qtextdocument.h Change-Id: Iba26da0ecbf2aa4ff4b956391cfb373f977f88c9
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
index 0a2e024701..9d6ce78b24 100644
--- a/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
+++ b/tests/auto/gui/text/qsyntaxhighlighter/tst_qsyntaxhighlighter.cpp
@@ -74,6 +74,7 @@ private slots:
void emptyBlocks();
void setCharFormat();
void highlightOnInit();
+ void highlightOnInitAndAppend();
void stopHighlightingWhenStateDoesNotChange();
void unindent();
void highlightToEndOfDocument();
@@ -265,6 +266,19 @@ void tst_QSyntaxHighlighter::highlightOnInit()
QTRY_VERIFY(hl->highlighted);
}
+void tst_QSyntaxHighlighter::highlightOnInitAndAppend()
+{
+ cursor.insertText("Hello");
+ cursor.insertBlock();
+ cursor.insertText("World");
+
+ TestHighlighter *hl = new TestHighlighter(doc);
+ cursor.insertBlock();
+ cursor.insertText("More text");
+ QTRY_VERIFY(hl->highlighted);
+ QVERIFY(hl->highlightedText.endsWith(doc->toPlainText().remove(QLatin1Char('\n'))));
+}
+
class StateTestHighlighter : public QSyntaxHighlighter
{
public:
@@ -330,6 +344,7 @@ void tst_QSyntaxHighlighter::unindent()
QCOMPARE(doc->toPlainText(), plainText);
TestHighlighter *hl = new TestHighlighter(doc);
+ QTRY_VERIFY(hl->highlighted);
hl->callCount = 0;
cursor.movePosition(QTextCursor::Start);