summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeanchors
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-05-26 04:28:23 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-05-26 05:16:05 (GMT)
commitef2bc487ab9b66e052920b671e947abc4a6d8ef4 (patch)
tree79b04e4a434ce146426e8127e865c08699f44b07 /tests/auto/declarative/qdeclarativeanchors
parentdc08c8bc7aba55ff4762d70b193a053ad210fb60 (diff)
downloadQt-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/declarative/qdeclarativeanchors')
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp14
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"));