summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-31 08:02:49 (GMT)
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2011-03-31 08:02:49 (GMT)
commitf25ea64306a53dae326b322dc40de6d09e347404 (patch)
tree6e7fcda3c81fcae6c3e25c319ef255a4cbea15f0 /tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
parent8f3cb10d9facc4d6b89c449c97e28a5221d2fabf (diff)
parent97902c7f81228fa669acc6e075681dc05b404b1a (diff)
downloadQt-f25ea64306a53dae326b322dc40de6d09e347404.zip
Qt-f25ea64306a53dae326b322dc40de6d09e347404.tar.gz
Qt-f25ea64306a53dae326b322dc40de6d09e347404.tar.bz2
Merge remote-tracking branch 'mainline/4.7' into 4.7
Diffstat (limited to 'tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp')
-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()