summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeloader
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-01-28 00:24:20 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-01-28 00:24:20 (GMT)
commit547e2162c872ca5707f5bc54d06b3c39c9bd6477 (patch)
treeaf7e698052848d15389d557ab9cf17feb12974b5 /tests/auto/declarative/qdeclarativeloader
parenteb55d07febf858474d8755e31cb554a4b8fabcdc (diff)
downloadQt-547e2162c872ca5707f5bc54d06b3c39c9bd6477.zip
Qt-547e2162c872ca5707f5bc54d06b3c39c9bd6477.tar.gz
Qt-547e2162c872ca5707f5bc54d06b3c39c9bd6477.tar.bz2
Add test for Loader implicitWidth/implicitHeight
Diffstat (limited to 'tests/auto/declarative/qdeclarativeloader')
-rw-r--r--tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml28
-rw-r--r--tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp18
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml b/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml
new file mode 100644
index 0000000..53aad97
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeloader/data/implicitSize.qml
@@ -0,0 +1,28 @@
+import QtQuick 1.1
+
+Rectangle {
+ property real implWidth: 0
+ property real implHeight: 0
+ color: "green"
+ width: loader.implicitWidth+50
+ height: loader.implicitHeight+50
+
+ Loader {
+ id: loader
+ sourceComponent: Item {
+ anchors.centerIn: parent
+
+ implicitWidth: 100
+ implicitHeight: 100
+ Rectangle {
+ color: "red"
+ anchors.fill: parent
+ }
+ }
+
+ anchors.fill: parent
+ anchors.margins: 50
+ onImplicitWidthChanged: implWidth = implicitWidth
+ onImplicitHeightChanged: implHeight = loader.implicitHeight
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
index ea8ea16..a5e708b 100644
--- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
+++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp
@@ -90,6 +90,7 @@ private slots:
void vmeErrors();
void creationContext();
void QTBUG_16928();
+ void implicitSize();
private:
QDeclarativeEngine engine;
@@ -603,6 +604,23 @@ void tst_QDeclarativeLoader::QTBUG_16928()
delete item;
}
+void tst_QDeclarativeLoader::implicitSize()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("implicitSize.qml"));
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create());
+ QVERIFY(item);
+
+ QCOMPARE(item->width(), 150.);
+ QCOMPARE(item->height(), 150.);
+
+ QCOMPARE(item->property("implHeight").toReal(), 100.);
+
+ QEXPECT_FAIL("", "versioned property implicit object reference", Continue);
+ QCOMPARE(item->property("implWidth").toReal(), 100.);
+
+ delete item;
+}
+
QTEST_MAIN(tst_QDeclarativeLoader)
#include "tst_qdeclarativeloader.moc"