diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-18 06:26:20 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-05-18 06:39:36 (GMT) |
commit | 633a5cf6d8197105d6392dbf56bf0f29f9c84da1 (patch) | |
tree | 2a65110eca09fe61b79fe163eb785f9e1e9fcbb8 /tests/auto | |
parent | ffccebed9af217cc5bf2f3e4eba00df754eb7ac9 (diff) | |
download | Qt-633a5cf6d8197105d6392dbf56bf0f29f9c84da1.zip Qt-633a5cf6d8197105d6392dbf56bf0f29f9c84da1.tar.gz Qt-633a5cf6d8197105d6392dbf56bf0f29f9c84da1.tar.bz2 |
Regression fix for Loader anchors not working
Task-number: QTBUG-10766
Reviewed-by: Yann Bodson
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 22 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml new file mode 100644 index 0000000..5d02dae --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +Rectangle { + width: 300 + height: 200 + color: "blue" + Loader { + objectName: "loader" + anchors.fill: parent + sourceComponent: Component { + Rectangle { color: "red"; objectName: "sourceElement" } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 59580ea..11cc61b 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -78,6 +78,7 @@ private slots: void clear(); void urlToComponent(); void componentToUrl(); + void anchoredLoader(); void sizeLoaderToItem(); void sizeItemToLoader(); void noResize(); @@ -266,6 +267,27 @@ void tst_QDeclarativeLoader::componentToUrl() delete item; } +void tst_QDeclarativeLoader::anchoredLoader() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/AnchoredLoader.qml")); + QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(rootItem != 0); + QDeclarativeItem *loader = rootItem->findChild<QDeclarativeItem*>("loader"); + QDeclarativeItem *sourceElement = rootItem->findChild<QDeclarativeItem*>("sourceElement"); + + QVERIFY(loader != 0); + QVERIFY(sourceElement != 0); + + QCOMPARE(rootItem->width(), 300.0); + QCOMPARE(rootItem->height(), 200.0); + + QCOMPARE(loader->width(), 300.0); + QCOMPARE(loader->height(), 200.0); + + QCOMPARE(sourceElement->width(), 300.0); + QCOMPARE(sourceElement->height(), 200.0); +} + void tst_QDeclarativeLoader::sizeLoaderToItem() { QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml")); |