summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qfontmetrics/tst_qfontmetrics.cpp')
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index ee6d442..665107a 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -72,6 +72,7 @@ private slots:
void veryNarrowElidedText();
void averageCharWidth();
void elidedMultiLength();
+ void bearingIncludedInBoundingRect();
};
tst_QFontMetrics::tst_QFontMetrics()
@@ -214,7 +215,7 @@ void tst_QFontMetrics::elidedMultiLength()
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long + 1), text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long - 1), text1_short);
- int width_short = fm.width(text1_short);
+ int width_short = fm.boundingRect(text1_short).width();
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small);
@@ -226,5 +227,16 @@ void tst_QFontMetrics::elidedMultiLength()
}
+void tst_QFontMetrics::bearingIncludedInBoundingRect()
+{
+ QFont font;
+ font.setItalic(true);
+ QRect brectItalic = QFontMetrics(font).boundingRect("ITALIC");
+ font.setItalic(false);
+ QRect brectNormal = QFontMetrics(font).boundingRect("ITALIC");
+
+ QVERIFY(brectItalic.width() > brectNormal.width());
+}
+
QTEST_MAIN(tst_QFontMetrics)
#include "tst_qfontmetrics.moc"