summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfontmetrics
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qfontmetrics')
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index e33c938..6b2f0fe 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()
@@ -210,11 +211,11 @@ void tst_QFontMetrics::elidedMultiLength()
QString text1_short = "Shorter";
QString text1_small = "small";
QFontMetrics fm = QFontMetrics(QFont());
- int width_long = fm.width(text1_long);
+ int width_long = fm.size(0, text1_long).width();
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.size(0, 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"