diff options
-rw-r--r-- | tests/auto/declarative/qmldom/qmldom.pro | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qmldom/tst_qmldom.cpp | 16 |
2 files changed, 17 insertions, 1 deletions
diff --git a/tests/auto/declarative/qmldom/qmldom.pro b/tests/auto/declarative/qmldom/qmldom.pro index 5294cb4..d566354 100644 --- a/tests/auto/declarative/qmldom/qmldom.pro +++ b/tests/auto/declarative/qmldom/qmldom.pro @@ -1,3 +1,5 @@ load(qttest_p4) contains(QT_CONFIG,declarative): QT += declarative SOURCES += tst_qmldom.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" 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); }}"; |