summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2011-03-22 17:15:21 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2011-03-22 17:15:21 (GMT)
commita5c3c11e3e2204da6c8be9af98b38929366fafb8 (patch)
treee4aa81a4cd1783875b3f77fb75afb6c151801365 /tests
parentb268977478477952a5067ca6389b73d00d1807d2 (diff)
parent265074001db00920abbb0defba69743ef71c4cc0 (diff)
downloadQt-a5c3c11e3e2204da6c8be9af98b38929366fafb8.zip
Qt-a5c3c11e3e2204da6c8be9af98b38929366fafb8.tar.gz
Qt-a5c3c11e3e2204da6c8be9af98b38929366fafb8.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 8841aa3..3d6641b 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -658,6 +658,24 @@ void tst_qdeclarativetext::verticalAlignment()
}
}
+ //confirm that bounding rect is correctly positioned.
+ QString componentStr = "import QtQuick 1.0\nText { height: 80; text: \"Hello\" }";
+ QDeclarativeComponent textComponent(&engine);
+ textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create());
+ QVERIFY(textObject != 0);
+ QRectF br = textObject->boundingRect();
+ QVERIFY(br.y() == 0);
+
+ textObject->setVAlign(QDeclarativeText::AlignVCenter);
+ br = textObject->boundingRect();
+ QCOMPARE(qFloor(br.y()), qFloor((80.0 - br.height())/2));
+
+ textObject->setVAlign(QDeclarativeText::AlignBottom);
+ br = textObject->boundingRect();
+ QCOMPARE(qFloor(br.y()), qFloor(80.0 - br.height()));
+
+ delete textObject;
}
void tst_qdeclarativetext::font()