summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2020-05-26 08:36:59 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-08 15:53:29 +0000
commit20a2528eea93af87616175caae5af59146eb9f82 (patch)
tree51ddd805d1a5ba732ac82173ae592fcaf5428cbe /tests/auto/gui
parent6a32de85419af224c512cb912cc6709563ad80e8 (diff)
Win: Choose a suitable font in tst_QTextLayout::textWidthVsWIdth
The default font on Windows 10 (Segoe UI) will return the wrong minimum right bearing at some sizes, which will cause us to skip the textWidthVsWIdth() test at some scale factors, since we cannot trust the layout to be perfect in this case. Based on experiment, Arial is more accurate, so in order to avoid skipping the test, we default to this on Windows instead. (Note: The problem has not been observed with the default fonts on Linux or macOS, so we only do this for Windows specifically.) Task-number: QTBUG-84415 Change-Id: I8cdb5d0d9922915a6ed1574d62a561dda0e1dc5d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 18e8519dcdf36b211b39c131c0d6e08b5921a03c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
index cb71f91a7a..afcae2f4b7 100644
--- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp
@@ -2000,6 +2000,9 @@ void tst_QTextLayout::textWidthVsWIdth()
layout.setCacheEnabled(true);
QTextOption opt;
opt.setWrapMode(QTextOption::WrapAnywhere);
+#if defined(Q_OS_WIN)
+ layout.setFont(QFont(QString::fromLatin1("Arial")));
+#endif
layout.setTextOption(opt);
layout.setText(QString::fromLatin1(
"g++ -c -m64 -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -D_REENTRANT -fPIC -DCORE_LIBRARY -DIDE_LIBRARY_BASENAME=\"lib\" -DWITH_TESTS "