summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-22 13:03:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-22 13:03:23 (GMT)
commit265074001db00920abbb0defba69743ef71c4cc0 (patch)
treeffb246ba3fdb8c987e602d030a3bf066b8d8d91d /tests
parentbf95c0ed87bf8a2ccd0a3d57ed81b8ae8fb8c4f2 (diff)
parentb888c9cca5ba2994344533c7602d22e1bc8e5db3 (diff)
downloadQt-265074001db00920abbb0defba69743ef71c4cc0.zip
Qt-265074001db00920abbb0defba69743ef71c4cc0.tar.gz
Qt-265074001db00920abbb0defba69743ef71c4cc0.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Text bounding rect calculated incorrectly if non-top aligned.
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 581b58c..ca6e87a 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()