summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeloader
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-19 02:44:07 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-19 02:44:07 (GMT)
commita0973fe3b88dbef39e42da584e63a210693342ee (patch)
treef3edf45c2c9dff62a3f5f1cf9fb3c5762ce7e887 /tests/auto/declarative/qdeclarativeloader
parentcd707a865625c7ee0ec836d2a1bdcda847ab0517 (diff)
parente007505d8f35c1194caf80ffc4f1e46561ff7be3 (diff)
downloadQt-a0973fe3b88dbef39e42da584e63a210693342ee.zip
Qt-a0973fe3b88dbef39e42da584e63a210693342ee.tar.gz
Qt-a0973fe3b88dbef39e42da584e63a210693342ee.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Conflicts: src/imports/folderlistmodel/qdeclarativefolderlistmodel.cpp src/imports/folderlistmodel/qdeclarativefolderlistmodel.h
Diffstat (limited to 'tests/auto/declarative/qdeclarativeloader')
-rw-r--r--tests/auto/declarative/qdeclarativeloader/data/AnchoredLoader.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp22
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"));