summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-10 08:17:26 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-10 09:05:13 (GMT)
commitb8d44332bbbca1d065a07cba79ad179bd9c0197c (patch)
tree03bfe563238dc13cba07efb67f4f83594cdfe86d /tests/auto
parent53b4b458982fd9520ac710843fd5b68780adf159 (diff)
downloadQt-b8d44332bbbca1d065a07cba79ad179bd9c0197c.zip
Qt-b8d44332bbbca1d065a07cba79ad179bd9c0197c.tar.gz
Qt-b8d44332bbbca1d065a07cba79ad179bd9c0197c.tar.bz2
Stabilize some tests.
For the QFontMetrics test, the different way of computing the with of a text returs different value (1 to 2 pixel difference). So we need to make sure to use the same way to compute the with that the one used to ellide.
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp4
-rw-r--r--tests/auto/qbuttongroup/tst_qbuttongroup.cpp4
-rw-r--r--tests/auto/qfontmetrics/tst_qfontmetrics.cpp4
3 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index 022778b..be2d882 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -1200,13 +1200,13 @@ void tst_QAbstractItemView::task250754_fontChange()
tree.setFont(font);
QTest::qWait(30);
- QVERIFY(!tree.verticalScrollBar()->isVisible());
+ QTRY_VERIFY(!tree.verticalScrollBar()->isVisible());
font.setPointSize(45);
tree.setFont(font);
QTest::qWait(30);
//now with the huge items, the scrollbar must be visible
- QVERIFY(tree.verticalScrollBar()->isVisible());
+ QTRY_VERIFY(tree.verticalScrollBar()->isVisible());
qApp->setStyleSheet(app_css);
}
diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
index 3530eb9..502c2d1 100644
--- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
+++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
@@ -57,6 +57,8 @@
#include <qsettings.h>
#endif
+#include "../../shared/util.h"
+
class SpecialRadioButton: public QRadioButton
{
public:
@@ -402,6 +404,8 @@ void tst_QButtonGroup::task106609()
QSignalSpy spy2(buttons, SIGNAL(buttonClicked(int)));
QTestEventLoop::instance().enterLoop(1);
+ QApplication::setActiveWindow(&dlg);
+ QTRY_COMPARE(QApplication::activeWindow(), &dlg);
//qDebug() << "int:" << spy2.count() << "QAbstractButton*:" << spy1.count();
QCOMPARE(spy2.count(), 2);
diff --git a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
index 665107a..6b2f0fe 100644
--- a/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
+++ b/tests/auto/qfontmetrics/tst_qfontmetrics.cpp
@@ -211,11 +211,11 @@ void tst_QFontMetrics::elidedMultiLength()
QString text1_short = "Shorter";
QString text1_small = "small";
QFontMetrics fm = QFontMetrics(QFont());
- int width_long = fm.boundingRect(text1_long).width();
+ 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.boundingRect(text1_short).width();
+ 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);