summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-05-07 07:44:51 (GMT)
committerKai Koehne <kai.koehne@nokia.com>2009-05-07 07:46:51 (GMT)
commit02b0285ba6c2382d801be8d9259f91d1bfbc94d7 (patch)
tree6b842ef8095ec158a8cc1b5c411acfceb2b08d34 /tests/auto/declarative
parent50576620bc00151674f58c7712cc38a5b97b74c7 (diff)
downloadQt-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')
-rw-r--r--tests/auto/declarative/qmldom/qmldom.pro2
-rw-r--r--tests/auto/declarative/qmldom/tst_qmldom.cpp16
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); }}";