diff options
author | Andy Shaw <andy.shaw@qt.io> | 2020-01-03 09:13:34 +0100 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2020-01-06 12:01:08 +0100 |
commit | 6b835d5e51bafe93090286fa2acb36f3d5d8f719 (patch) | |
tree | 656602ddb34cf427006ffeb105c142ba8aaea3a3 /tests/auto | |
parent | 5b22d1719881b5f061be6b832a96a1e4305d981f (diff) |
QTextDocument: Set the font family to be after the families set
This amends a1f4321bbba2f3bff24d753ce766be738dbfa61a as the font
families should take precedence over the font family set. If the font
family is already included in the families then it should keep its
placement. Otherwise it should be appended.
Task-number: QTBUG-80475
Change-Id: I0049189c88b6879e57619815ec780960e9c0a300
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index e075c107b7..2944e88d70 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -3597,7 +3597,18 @@ void tst_QTextDocument::mergeFontFamilies() cursor.setPosition(QByteArray("Hello World").length(), QTextCursor::KeepAnchor); cursor.mergeCharFormat(newFormat); - QVERIFY(td.toHtml().contains(QLatin1String("font-family:'Jokerman','MS Shell Dlg 2';"))); + QVERIFY(td.toHtml().contains(QLatin1String("font-family:'MS Shell Dlg 2','Jokerman';"))); + + QTextCharFormat newFormatFamilies; + newFormatFamilies.setFontFamilies({ QLatin1String("Arial"), QLatin1String("Helvetica") }); + cursor.mergeCharFormat(newFormatFamilies); + + QVERIFY(td.toHtml().contains(QLatin1String("font-family:'Arial','Helvetica','Jokerman'"))); + + newFormatFamilies.setFontFamilies({ QLatin1String("Arial"), QLatin1String("Jokerman"), QLatin1String("Helvetica") }); + cursor.mergeCharFormat(newFormatFamilies); + + QVERIFY(td.toHtml().contains(QLatin1String("font-family:'Arial','Jokerman','Helvetica'"))); } void tst_QTextDocument::clearUndoRedoStacks() |