diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2009-05-07 07:44:51 (GMT) |
---|---|---|
committer | Kai Koehne <kai.koehne@nokia.com> | 2009-05-07 07:46:51 (GMT) |
commit | 02b0285ba6c2382d801be8d9259f91d1bfbc94d7 (patch) | |
tree | 6b842ef8095ec158a8cc1b5c411acfceb2b08d34 /tests/auto/declarative/qmldom/tst_qmldom.cpp | |
parent | 50576620bc00151674f58c7712cc38a5b97b74c7 (diff) | |
download | Qt-02b0285ba6c2382d801be8d9259f91d1bfbc94d7.zip Qt-02b0285ba6c2382d801be8d9259f91d1bfbc94d7.tar.gz Qt-02b0285ba6c2382d801be8d9259f91d1bfbc94d7.tar.bz2 |
Add test case for QmlDom - loading a component with sub components
Right now QmlDomDocument::load returns false with error message
"QmlDomDocument supports local types only"
Diffstat (limited to 'tests/auto/declarative/qmldom/tst_qmldom.cpp')
-rw-r--r-- | tests/auto/declarative/qmldom/tst_qmldom.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp index 36d37f6..8df1829 100644 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp @@ -4,6 +4,7 @@ #include <QtDeclarative/qmldom.h> #include <QtCore/QDebug> +#include <QtCore/QFile> class tst_qmldom : public QObject { @@ -15,6 +16,7 @@ private slots: void loadSimple(); void loadProperties(); void loadChildObject(); + void loadComposite(); void testValueSource(); @@ -30,7 +32,7 @@ void tst_qmldom::loadSimple() QmlDomDocument document; QVERIFY(document.load(&engine, qml)); - QVERIFY(document.loadError().isEmpty()); + QVERIFY(document.errors().isEmpty()); QmlDomObject rootObject = document.rootObject(); QVERIFY(rootObject.isValid()); @@ -87,6 +89,18 @@ void tst_qmldom::loadChildObject() QVERIFY(childItem.objectType() == "Item"); } +void tst_qmldom::loadComposite() +{ + QFile file(SRCDIR "/top.qml"); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + + QmlDomDocument document; + QVERIFY(document.load(&engine, file.readAll())); + QVERIFY(document.errors().isEmpty()); + + // TODO: How should sub components be represented? +} + void tst_qmldom::testValueSource() { QByteArray qml = "Rect { height: Follow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; |