summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-05-18 06:09:53 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-05-18 06:11:34 (GMT)
commitffccebed9af217cc5bf2f3e4eba00df754eb7ac9 (patch)
tree79fb7c62e5e695d0d3c1a65932a4b91187e7c7f1 /tests
parent711a9a8294d354c1a745b0f6a550672403b7e6fd (diff)
downloadQt-ffccebed9af217cc5bf2f3e4eba00df754eb7ac9.zip
Qt-ffccebed9af217cc5bf2f3e4eba00df754eb7ac9.tar.gz
Qt-ffccebed9af217cc5bf2f3e4eba00df754eb7ac9.tar.bz2
Make Qt.include() work for js files that have '.pragma library'
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp11
4 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
new file mode 100644
index 0000000..67b8cfd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma.qml
@@ -0,0 +1,11 @@
+import Qt 4.7
+import "include_pragma_outer.js" as Script
+
+Item {
+ property int test1
+
+ Component.onCompleted: {
+ test1 = Script.callFunction()
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
new file mode 100644
index 0000000..a0380a2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_inner.js
@@ -0,0 +1,5 @@
+.pragma library
+
+function getValue() {
+ return 100;
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
new file mode 100644
index 0000000..d87bafc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/include_pragma_outer.js
@@ -0,0 +1,6 @@
+Qt.include("include_pragma_inner.js")
+
+function callFunction() {
+ return getValue();
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 0710e15..9a88237 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2424,6 +2424,17 @@ void tst_qdeclarativeecmascript::include()
delete o;
}
+ // Including file with ".pragma library"
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml"));
+ qDebug() << "errors:" << component.errorsString();
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test1").toInt(), 100);
+
+ delete o;
+ }
+
// Remote - success
{
TestHTTPServer server(8111);