summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2013-09-24 20:51:22 +0200
committerAndré Hartmann <aha_1980@gmx.de>2013-09-25 07:11:46 +0200
commit30ddaad191b3c9459ca57e8aad9fa73b24c3ff36 (patch)
tree0bf4218d1f36c739e8c98e058047a285ea1d245e /tests
parent3c6ee449e647cbded43058c32c14818e185fb7c9 (diff)
downloadqt-creator-30ddaad191b3c9459ca57e8aad9fa73b24c3ff36.tar.gz
ANSI: Test line-overlapping formats.
Until endFormatScope() is called, continuation lines keep the last format. Change-Id: Ic68ae6d716519f537189ebae763da4dc2c30978d Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Petar Perisin <petar.perisin@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp b/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
index f07fd85c62..0f1381416d 100644
--- a/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
+++ b/tests/auto/utils/ansiescapecodehandler/tst_ansiescapecodehandler.cpp
@@ -55,6 +55,7 @@ public:
private Q_SLOTS:
void testCase1();
void testCase1_data();
+ void testLineOverlappingFormat();
private:
const QString red;
@@ -128,6 +129,33 @@ void tst_AnsiEscapeCodeHandler::testCase1_data()
<< StringFormatPair(" text", defaultFormat));
}
+void tst_AnsiEscapeCodeHandler::testLineOverlappingFormat()
+{
+ // Test line-overlapping formats
+ const QString line1 = "A line of " + bold + "bold text";
+ const QString line2 = "A line of " + normal + "normal text";
+
+ QTextCharFormat defaultFormat;
+
+ AnsiEscapeCodeHandler handler;
+ ResultList result;
+ result.append(handler.parseText(line1, defaultFormat));
+ result.append(handler.parseText(line2, defaultFormat));
+
+ QTextCharFormat boldFormat;
+ boldFormat.setFontWeight(QFont::Bold);
+
+ QCOMPARE(result.size(), 4);
+ QCOMPARE(result[0].first, QLatin1String("A line of "));
+ QCOMPARE(result[0].second, defaultFormat);
+ QCOMPARE(result[1].first, QLatin1String("bold text"));
+ QCOMPARE(result[1].second, boldFormat);
+ QCOMPARE(result[2].first, QLatin1String("A line of "));
+ QCOMPARE(result[2].second, boldFormat);
+ QCOMPARE(result[3].first, QLatin1String("normal text"));
+ QCOMPARE(result[3].second, defaultFormat);
+}
+
QTEST_APPLESS_MAIN(tst_AnsiEscapeCodeHandler)
#include "tst_ansiescapecodehandler.moc"