diff options
author | Daniel Engelke <daniel.engelke@basyskom.com> | 2018-11-28 18:02:43 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2018-12-10 19:40:25 +0000 |
commit | c352ca4a3dc2e6e3a4c039589849cf502911ba95 (patch) | |
tree | 1c346fc6dc6b238cb91593dc7ced5f2e9160d400 /tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp | |
parent | 0b586e5b504f66c5ba2b690eda1c89e3e5dfdca3 (diff) |
Fix missing strike out
Added <s></s> and <del></del> tag aka strike out to QQuickStyledText.
QQuickStyledText covers the essential text decorations, apart from
strike out. In order to use it, one had to switch to RichText,
which comes with its own overhead and limitations.
<s> for no longer accurate or no longer relevant content
<del> for removed content
Fixes: QTBUG-72376
Change-Id: I3c191d91d57afcc48090facc49d643f8ad708fb4
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp')
-rw-r--r-- | tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 6ca5ad2653..88b0e95e0a 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -44,7 +44,8 @@ public: Bold = 0x01, Underline = 0x02, Italic = 0x04, - Anchor = 0x08 + Anchor = 0x08, + StrikeOut = 0x10 }; Format(int t, int s, int l) : type(t), start(s), length(l) {} @@ -92,6 +93,10 @@ void tst_qquickstyledtext::textOutput_data() QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; QTest::newRow("strong") << "<strong>strong</strong>" << "strong" << (FormatList() << Format(Format::Bold, 0, 6)) << false; QTest::newRow("underline") << "<u>underline</u>" << "underline" << (FormatList() << Format(Format::Underline, 0, 9)) << false; + QTest::newRow("strike out s") << "<s>strike out</s>" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false; + QTest::newRow("strike out del") << "<del>strike out</del>" << "strike out" << (FormatList() << Format(Format::StrikeOut, 0, 10)) << false; + QTest::newRow("strike out not s") << "this is <s>not</s> a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false; + QTest::newRow("strike out not del") << "this is <del>not</del> a test" << "this is not a test" << (FormatList() << Format(Format::StrikeOut, 8, 3)) << false; QTest::newRow("missing >") << "<b>text</b" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; QTest::newRow("missing b>") << "<b>text</" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; QTest::newRow("missing /b>") << "<b>text<" << "text" << (FormatList() << Format(Format::Bold, 0, 4)) << false; @@ -178,6 +183,7 @@ void tst_qquickstyledtext::textOutput() QCOMPARE(layoutFormats.at(i).format.fontWeight(), int(QFont::Normal)); QVERIFY(layoutFormats.at(i).format.fontItalic() == bool(formats.at(i).type & Format::Italic)); QVERIFY(layoutFormats.at(i).format.fontUnderline() == bool(formats.at(i).type & Format::Underline)); + QVERIFY(layoutFormats.at(i).format.fontStrikeOut() == bool(formats.at(i).type & Format::StrikeOut)); } QCOMPARE(fontSizeModified, modifiesFontSize); } |