diff options
author | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-19 16:35:06 (GMT) |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@nokia.com> | 2009-11-19 16:35:06 (GMT) |
commit | 901b0391d15ab72830fcfd73048eeff03fb9ed07 (patch) | |
tree | cf5f2f2eab83301bf08952426f25eb54a90e9ac4 /tests/auto/qfontmetrics/tst_qfontmetrics.cpp | |
parent | bb4e301ce6762ab300618c579bd65ea1ee17dc2d (diff) | |
parent | 34044853d4315309920a481a585f96ba7b3fb140 (diff) | |
download | Qt-901b0391d15ab72830fcfd73048eeff03fb9ed07.zip Qt-901b0391d15ab72830fcfd73048eeff03fb9ed07.tar.gz Qt-901b0391d15ab72830fcfd73048eeff03fb9ed07.tar.bz2 |
Merge remote branch 'mainline/4.6' into 4.6
Diffstat (limited to 'tests/auto/qfontmetrics/tst_qfontmetrics.cpp')
-rw-r--r-- | tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index e80f8e0..efb1b56 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 elidedMultiLengthF(); void bearingIncludedInBoundingRect(); }; @@ -218,13 +219,13 @@ void tst_QFontMetrics::averageCharWidth() QVERIFY(fmf.averageCharWidth() != 0); } -void tst_QFontMetrics::elidedMultiLength() +template<class FontMetrics> void elidedMultiLength_helper() { QString text1 = "Long Text 1\x9cShorter\x9csmall"; QString text1_long = "Long Text 1"; QString text1_short = "Shorter"; QString text1_small = "small"; - QFontMetrics fm = QFontMetrics(QFont()); + FontMetrics fm = FontMetrics(QFont()); 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); @@ -238,7 +239,16 @@ void tst_QFontMetrics::elidedMultiLength() QString text1_el = QString::fromLatin1("s") + ellipsisChar; int width_small = fm.width(text1_el); QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_small + 1), text1_el); +} +void tst_QFontMetrics::elidedMultiLength() +{ + elidedMultiLength_helper<QFontMetrics>(); +} + +void tst_QFontMetrics::elidedMultiLengthF() +{ + elidedMultiLength_helper<QFontMetricsF>(); } void tst_QFontMetrics::bearingIncludedInBoundingRect() |