summaryrefslogtreecommitdiffstats
path: root/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-10 09:07:19 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-10 09:07:19 (GMT)
commita3256014d6adb31c89b0e5de5b0decc393649b70 (patch)
treecd315ffdb3e35f4040b268e9dc083244da084b2a /tests/auto/qfontmetrics/tst_qfontmetrics.cpp
parentb17cc4918bfc4b250293000bdabcb8f2dbdec787 (diff)
parent2c232cdbce3eba095da26362b964f411a9d3ba80 (diff)
downloadQt-a3256014d6adb31c89b0e5de5b0decc393649b70.zip
Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.gz
Qt-a3256014d6adb31c89b0e5de5b0decc393649b70.tar.bz2
Merge branch '4.6'
Diffstat (limited to 'tests/auto/qfontmetrics/tst_qfontmetrics.cpp')
-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"