From da4bfa273c955574d68dde1b44681de31a478ee0 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 7 Sep 2009 10:37:01 +0200 Subject: 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 --- tests/auto/qfontmetrics/tst_qfontmetrics.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp index 3a2d90f681..5d4c52080f 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 -- cgit v1.2.3