diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-07 23:03:13 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-07 23:03:13 (GMT) |
commit | b7ac7f5b4d4c8e08b4ded43c9720c712a3663810 (patch) | |
tree | 569180e571372fe89255f80a28597acf4fdf3408 /tests | |
parent | d8606497762f569807001954ff6b670b957c5049 (diff) | |
parent | 495150413916a9a41cdffc5879f36a6e16e7866c (diff) | |
download | Qt-b7ac7f5b4d4c8e08b4ded43c9720c712a3663810.zip Qt-b7ac7f5b4d4c8e08b4ded43c9720c712a3663810.tar.gz Qt-b7ac7f5b4d4c8e08b4ded43c9720c712a3663810.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qmldom/qmldom.pro | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qmldom/tst_qmldom.cpp | 25 |
2 files changed, 26 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..ca8929d 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,27 @@ 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(), QUrl::fromLocalFile(file.fileName()))); + QVERIFY(document.errors().isEmpty()); + + 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() { QByteArray qml = "Rect { height: Follow { spring: 1.4; damping: .15; source: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; |