summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfontmetrics
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-25 09:22:53 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-03-25 09:22:53 (GMT)
commit76267b3608836e1cc46171921caf725cfbd2ecf7 (patch)
tree33d1b19832a7613b6704b7f8b16103ad9b622d2d /tests/auto/qfontmetrics
parentbbf096c7ba589d05df8b8bce724e9393deb8f3b4 (diff)
downloadQt-76267b3608836e1cc46171921caf725cfbd2ecf7.zip
Qt-76267b3608836e1cc46171921caf725cfbd2ecf7.tar.gz
Qt-76267b3608836e1cc46171921caf725cfbd2ecf7.tar.bz2
Fix QFontMetrics::height() and QFontMetrics autotest
Since the Mac font engine has been fixed to support fractional metrics, we can no longer expect qRound(A + B) to be equal to qRound(A) + qRound(B). The documentation states that height = ascent + descent + 1. To honor this contract, we need to rewrite the implementation of height() to round each metric separately. Same with lineSpacing. The bearingIncludedInBoundingrect() test was wrong. We can guarantee that the italic text is not more narrow than the normal text, but we cannot guarantee that they are never the same width. Reviewed-by: Olivier
Diffstat (limited to 'tests/auto/qfontmetrics')
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 46f2b15..5d73764 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -259,7 +259,7 @@ void tst_QFontMetrics::bearingIncludedInBoundingRect()
font.setItalic(false);
QRect brectNormal = QFontMetrics(font).boundingRect("ITALIC");
- QVERIFY(brectItalic.width() > brectNormal.width());
+ QVERIFY(brectItalic.width() >= brectNormal.width());
}
QTEST_MAIN(tst_QFontMetrics)