summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-07 08:37:01 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-07 08:38:47 (GMT)
commitda4bfa273c955574d68dde1b44681de31a478ee0 (patch)
tree1a9869e5749a65c0e80177c70549259c66fac6d2 /tests/auto
parentc2fccced314dbbafdda965602a71f1ef13c749d2 (diff)
downloadQt-da4bfa273c955574d68dde1b44681de31a478ee0.zip
Qt-da4bfa273c955574d68dde1b44681de31a478ee0.tar.gz
Qt-da4bfa273c955574d68dde1b44681de31a478ee0.tar.bz2
Stabilize QFontMetrics test
On Mac, the text may be elided if we give the exact length as the size. Giving one pixel bigger makes sure the text is not elided
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 3a2d90f..5d4c520 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -180,7 +180,7 @@ void tst_QFontMetrics::elidedText()
QFETCH(QString, text);
QFontMetrics fm(font);
int w = fm.width(text);
- QString newtext = fm.elidedText(text,Qt::ElideRight,w, 0);
+ QString newtext = fm.elidedText(text,Qt::ElideRight,w+1, 0);
QCOMPARE(text,newtext); // should not elide
newtext = fm.elidedText(text,Qt::ElideRight,w-1, 0);
QVERIFY(text != newtext); // should elide
@@ -212,10 +212,10 @@ void tst_QFontMetrics::elidedMultiLength()
QFontMetrics fm = QFontMetrics(QFont());
int width_long = fm.width(text1_long);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, 8000), text1_long);
- QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_long), 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);
- QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short), text1_short);
+ QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short + 1), text1_short);
QCOMPARE(fm.elidedText(text1,Qt::ElideRight, width_short - 1), text1_small);
// Not even wide enough for "small" - should use ellipsis