diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:43:23 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-01-27 06:43:23 (GMT) |
commit | b427b69a8efc0502cb06c388c70c8877a13db2f4 (patch) | |
tree | 0154e9173a49e85e34638c5b1503fdb592ae3c03 /tests/auto/declarative/qdeclarativeloader | |
parent | d9e4393ef212dba9eeba68277b270d68bcdbc733 (diff) | |
download | Qt-b427b69a8efc0502cb06c388c70c8877a13db2f4.zip Qt-b427b69a8efc0502cb06c388c70c8877a13db2f4.tar.gz Qt-b427b69a8efc0502cb06c388c70c8877a13db2f4.tar.bz2 |
Setting the size of a loader overwrote its implict size.
If the created item does not have a valid width/height then our
implictWidth/Height should be the same as the items implict size.
Task-number: QTBUG-16928
Reviewed-by: Bea Lam
Diffstat (limited to 'tests/auto/declarative/qdeclarativeloader')
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml | 23 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 13 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml new file mode 100644 index 0000000..9949e34 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/QTBUG_16928.qml @@ -0,0 +1,23 @@ +import QtQuick 1.1 + +Rectangle { + color: "green" + width: loader.implicitWidth+50 + height: loader.implicitHeight+50 + + Loader { + id: loader + sourceComponent: Item { + anchors.centerIn: parent + + implicitWidth: 200 + implicitHeight: 200 + Rectangle { + color: "red" + anchors.fill: parent + } + } + anchors.fill: parent + anchors.margins: 15 + } +} diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 358822e..ea8ea16 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -89,6 +89,7 @@ private slots: void nonItem(); void vmeErrors(); void creationContext(); + void QTBUG_16928(); private: QDeclarativeEngine engine; @@ -590,6 +591,18 @@ void tst_QDeclarativeLoader::creationContext() delete o; } +void tst_QDeclarativeLoader::QTBUG_16928() +{ + QDeclarativeComponent component(&engine, TEST_FILE("QTBUG_16928.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + + QCOMPARE(item->width(), 250.); + QCOMPARE(item->height(), 250.); + + delete item; +} + QTEST_MAIN(tst_QDeclarativeLoader) #include "tst_qdeclarativeloader.moc" |