diff options
Diffstat (limited to 'tests/auto/declarative')
4 files changed, 16 insertions, 6 deletions
diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp index b8f87b7..5575ace 100644 --- a/tests/auto/declarative/listview/tst_listview.cpp +++ b/tests/auto/declarative/listview/tst_listview.cpp @@ -671,6 +671,7 @@ void tst_QmlGraphicsListView::spacing() } listview->setSpacing(10); + QVERIFY(listview->spacing() == 10); // Confirm items positioned correctly itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); @@ -723,6 +724,11 @@ void tst_QmlGraphicsListView::sections() QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); } + QVERIFY(listview->currentSection() == "0"); + + listview->setViewportY(140); + QVERIFY(listview->currentSection() == "1"); + delete canvas; } diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp index 7bc6121..19d5998 100644 --- a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp +++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qtest.h> #include "../../../shared/util.h" +#include <math.h> #include <QFile> #include <QTextDocument> #include <QtDeclarative/qmlengine.h> @@ -183,8 +184,9 @@ void tst_qfxtextedit::width() for (int i = 0; i < standard.size(); i++) { QFont f; - QFontMetrics fm(f); - int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl()); diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp index 2dc096d..8eeb22d 100644 --- a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp +++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp @@ -132,8 +132,8 @@ void tst_qfxtextinput::width() for (int i = 0; i < standard.size(); i++) { QFont f; - QFontMetrics fm(f); - int metricWidth = fm.width(standard.at(i)); + QFontMetricsF fm(f); + qreal metricWidth = fm.width(standard.at(i)); QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl()); diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp index ba5c835..2a3cdde 100644 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp @@ -45,6 +45,7 @@ #include <private/qmlgraphicstext_p.h> #include <private/qmlvaluetype_p.h> #include <QFontMetrics> +#include <math.h> class tst_qmlgraphicstext : public QObject @@ -201,8 +202,9 @@ void tst_qmlgraphicstext::width() QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test QFont f; - QFontMetrics fm(f); - int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = floor(metricWidth); QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://")); |