diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2009-05-07 09:33:30 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2009-05-07 09:33:30 (GMT) |
commit | 495150413916a9a41cdffc5879f36a6e16e7866c (patch) | |
tree | c390a023b505c4fef479580b89e17491657d6d8c /tests/auto/declarative/qmldom | |
parent | 02b0285ba6c2382d801be8d9259f91d1bfbc94d7 (diff) | |
download | Qt-495150413916a9a41cdffc5879f36a6e16e7866c.zip Qt-495150413916a9a41cdffc5879f36a6e16e7866c.tar.gz Qt-495150413916a9a41cdffc5879f36a6e16e7866c.tar.bz2 |
Fix loading of components containing sub components through QmlDom
Pass a (optional) url to QmlDomDocument::load so that the compiler can
find referenced components
Diffstat (limited to 'tests/auto/declarative/qmldom')
-rw-r--r-- | tests/auto/declarative/qmldom/tst_qmldom.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp index 8df1829..ca8929d 100644 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp @@ -95,10 +95,19 @@ void tst_qmldom::loadComposite() QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); QmlDomDocument document; - QVERIFY(document.load(&engine, file.readAll())); + QVERIFY(document.load(&engine, file.readAll(), QUrl::fromLocalFile(file.fileName()))); QVERIFY(document.errors().isEmpty()); - // TODO: How should sub components be represented? + QmlDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QCOMPARE(rootItem.objectType(), QByteArray("MyComponent")); + QCOMPARE(rootItem.properties().size(), 2); + + QmlDomProperty widthProperty = rootItem.property("width"); + QVERIFY(widthProperty.value().isLiteral()); + + QmlDomProperty heightProperty = rootItem.property("height"); + QVERIFY(heightProperty.value().isLiteral()); } void tst_qmldom::testValueSource() |