diff options
author | Yann Bodson <yann.bodson@nokia.com> | 2010-05-26 04:28:23 (GMT) |
---|---|---|
committer | Yann Bodson <yann.bodson@nokia.com> | 2010-05-26 05:16:05 (GMT) |
commit | ef2bc487ab9b66e052920b671e947abc4a6d8ef4 (patch) | |
tree | 79b04e4a434ce146426e8127e865c08699f44b07 /tests/auto | |
parent | dc08c8bc7aba55ff4762d70b193a053ad210fb60 (diff) | |
download | Qt-ef2bc487ab9b66e052920b671e947abc4a6d8ef4.zip Qt-ef2bc487ab9b66e052920b671e947abc4a6d8ef4.tar.gz Qt-ef2bc487ab9b66e052920b671e947abc4a6d8ef4.tar.bz2 |
Fix horizontal/verticalCenter anchors bug.
Task-number: QTBUG-10999
Reviewed-by: Michael Brasser
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml | 11 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml new file mode 100644 index 0000000..7cd4f26 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml @@ -0,0 +1,11 @@ +import Qt 4.7 + +Rectangle { + width: 77; height: 95 + Rectangle { + objectName: "centered" + width: 57; height: 57; color: "blue" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index e169fa2..22f7966 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -77,6 +77,7 @@ private slots: void nullItem_data(); void crash1(); void centerIn(); + void hvCenter(); void fill(); void margins(); }; @@ -526,6 +527,19 @@ void tst_qdeclarativeanchors::centerIn() delete view; } +void tst_qdeclarativeanchors::hvCenter() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/hvCenter.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + // test QTBUG-10999 + QCOMPARE(rect->x(), 10.0); + QCOMPARE(rect->y(), 19.0); + delete view; +} + void tst_qdeclarativeanchors::margins() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); |