aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeqt/data
diff options
context:
space:
mode:
authorQt by Nokia <qt-info@nokia.com>2011-04-27 12:05:43 +0200
committeraxis <qt-info@nokia.com>2011-04-27 12:05:43 +0200
commit885735d011472bcfbb96e688d9e64553d7fe9d4b (patch)
tree734963625eba643bf11bc4870a4c407809a6400a /tests/auto/declarative/qdeclarativeqt/data
Initial import from the monolithic Qt.
This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/data')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/atob.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/btoa.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent.qml20
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js11
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml31
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/darker.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/enums.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/formatting.qml44
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/hsla.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/lighter.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/md5.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/point.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/quit.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/rect.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/rgba.qml10
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/size.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/tint.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/vector.qml8
26 files changed, 300 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/atob.qml b/tests/auto/declarative/qdeclarativeqt/data/atob.qml
new file mode 100644
index 0000000000..f74aae830a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/atob.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+QtObject {
+ property string test1: Qt.atob()
+ property string test2: Qt.atob("SGVsbG8gd29ybGQh")
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/btoa.qml b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml
new file mode 100644
index 0000000000..63b58c07b4
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/btoa.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+
+QtObject {
+ property string test1: Qt.btoa()
+ property string test2: Qt.btoa("Hello world!")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml
new file mode 100644
index 0000000000..fe47f3ff7c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+QtObject {
+ Component.onCompleted: {
+ console.log("completed", "ok")
+ console.log("completed ok")
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
new file mode 100644
index 0000000000..9d0dd345ce
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml
@@ -0,0 +1,20 @@
+import QtQuick 1.0
+
+QtObject {
+ property bool emptyArg: false
+
+ property string relativeUrl
+ property string absoluteUrl
+
+ property QtObject incorectArgCount1: Qt.createComponent()
+ property QtObject incorectArgCount2: Qt.createComponent("main.qml", 10)
+
+ Component.onCompleted: {
+ emptyArg = (Qt.createComponent("") == null);
+ var r = Qt.createComponent("createComponentData.qml");
+ relativeUrl = r.url;
+
+ var a = Qt.createComponent("http://www.example.com/test.qml");
+ absoluteUrl = a.url;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml
new file mode 100644
index 0000000000..6ac470ea8b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.0
+
+QtObject {
+ property int test: 1913
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
new file mode 100644
index 0000000000..30499e943e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js
@@ -0,0 +1,11 @@
+.pragma library
+
+function loadComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.status;
+}
+
+function createComponent() {
+ var component = Qt.createComponent("createComponentData.qml");
+ return component.createObject(null);
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
new file mode 100644
index 0000000000..5b8c1b1331
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml
@@ -0,0 +1,12 @@
+import QtQuick 1.0
+import "createComponent_lib.js" as Test
+
+Item {
+ property int status: Component.Null
+ property int readValue: 0
+
+ Component.onCompleted: {
+ status = Test.loadComponent()
+ readValue = Test.createComponent().test;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
new file mode 100644
index 0000000000..8c35ebf1a5
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml
@@ -0,0 +1,31 @@
+import QtQuick 1.0
+
+Item {
+ id: root
+
+ // errors resulting in exceptions
+ property QtObject incorrectArgCount1: Qt.createQmlObject()
+ property QtObject incorrectArgCount2: Qt.createQmlObject("import QtQuick 1.0\nQtObject{}", root, "main.qml", 10)
+ property QtObject noParent: Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13}", 0)
+ property QtObject notAvailable: Qt.createQmlObject("import QtQuick 1.0\nQtObject{Blah{}}", root)
+ property QtObject errors: Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13\nproperty int test: 13\n}", root, "main.qml")
+
+ property bool emptyArg: false
+
+ property bool success: false
+
+ Component.onCompleted: {
+ // errors resulting in nulls
+ emptyArg = (Qt.createQmlObject("", root) == null);
+ try {
+ Qt.createQmlObject("import QtQuick 1.0\nQtObject{property int test\nonTestChanged: QtObject{}\n}", root)
+ } catch (error) {
+ console.log("RunTimeError: ",error.message);
+ }
+
+ var o = Qt.createQmlObject("import QtQuick 1.0\nQtObject{\nproperty int test: 13\n}", root);
+ success = (o.test == 13);
+
+ Qt.createQmlObject("import QtQuick 1.0\nItem {}\n", root);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml
new file mode 100644
index 0000000000..d2ef866d59
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml
@@ -0,0 +1,12 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.darker(Qt.rgba(1, 0.8, 0.3))
+ property variant test2: Qt.darker()
+ property variant test3: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8)
+ property variant test4: Qt.darker("red");
+ property variant test5: Qt.darker("perfectred"); // Non-existant color
+ property variant test6: Qt.darker(10);
+ property variant test7: Qt.darker(Qt.rgba(1, 0.8, 0.3), 2.8, 10)
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/enums.qml b/tests/auto/declarative/qdeclarativeqt/data/enums.qml
new file mode 100644
index 0000000000..aec6f63c06
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/enums.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+
+QtObject {
+ property int test1: Qt.Key_Escape
+ property int test2: Qt.DescendingOrder
+ property int test3: Qt.ElideMiddle
+ property int test4: Qt.AlignRight
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml
new file mode 100644
index 0000000000..c9f50d4886
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.fontFamilies(10)
+ property variant test2: Qt.fontFamilies();
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/formatting.qml b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
new file mode 100644
index 0000000000..f520aeb40a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/formatting.qml
@@ -0,0 +1,44 @@
+import QtQuick 1.0
+
+QtObject {
+ property date dateFromString: "2008-12-24"
+ property variant jsdate: new Date(2008,11,24,14,15,38,200) // months are 0-based
+
+ function formatDate(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDate(v),
+ Qt.formatDate(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDate(v, "ddd MMMM d yy")
+ ]
+ }
+
+ function formatTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatTime(v),
+ Qt.formatTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatTime(v, "H:m:s a"),
+ Qt.formatTime(v, "hh:mm:ss.zzz")
+ ]
+ }
+
+ function formatDateTime(prop) {
+ var v = eval(prop)
+ return [
+ Qt.formatDateTime(v),
+ Qt.formatDateTime(v, Qt.DefaultLocaleLongDate),
+ Qt.formatDateTime(v, "M/d/yy H:m:s a")
+ ]
+ }
+
+ // Error cases
+ property string err_date1: Qt.formatDate()
+ property string err_date2: Qt.formatDate(new Date, new Object)
+
+ property string err_time1: Qt.formatTime()
+ property string err_time2: Qt.formatTime(new Date, new Object)
+
+ property string err_dateTime1: Qt.formatDateTime()
+ property string err_dateTime2: Qt.formatDateTime(new Date, new Object)
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/hsla.qml b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
new file mode 100644
index 0000000000..3bcc7912b1
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml
@@ -0,0 +1,11 @@
+import QtQuick 1.0
+
+QtObject {
+ property color test1: Qt.hsla(1, 0, 0, 0.8);
+ property color test2: Qt.hsla(1, 0.5, 0.3);
+ property color test3: Qt.hsla(1, 1);
+ property color test4: Qt.hsla(1, 1, 1, 1, 1);
+ property color test5: Qt.hsla(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.hsla(-0.1, -0.2, -0.3, -0.4);
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml
new file mode 100644
index 0000000000..37b952d448
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/isQtObject.qml
@@ -0,0 +1,14 @@
+import QtQuick 1.0
+
+QtObject {
+ id: root
+
+ property QtObject nullObject
+
+ property bool test1: Qt.isQtObject(root)
+ property bool test2: Qt.isQtObject(nullObject)
+ property bool test3: Qt.isQtObject(10)
+ property bool test4: Qt.isQtObject(null)
+ property bool test5: Qt.isQtObject({ a: 10, b: 11 })
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml
new file mode 100644
index 0000000000..67f0d0f30d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml
@@ -0,0 +1,11 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.lighter(Qt.rgba(1, 0.8, 0.3))
+ property variant test2: Qt.lighter()
+ property variant test3: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8)
+ property variant test4: Qt.lighter("red");
+ property variant test5: Qt.lighter("perfectred"); // Non-existant color
+ property variant test6: Qt.lighter(10);
+ property variant test7: Qt.lighter(Qt.rgba(1, 0.8, 0.3), 1.8, 5)
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/md5.qml b/tests/auto/declarative/qdeclarativeqt/data/md5.qml
new file mode 100644
index 0000000000..32e90c041e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/md5.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+
+QtObject {
+ property string test1: Qt.md5()
+ property string test2: Qt.md5("Hello World")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml
new file mode 100644
index 0000000000..dc4049c9a3
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+QtObject {
+ Component.onCompleted: Qt.openUrlExternally("test:url")
+
+ property bool testFile
+ onTestFileChanged: Qt.openUrlExternally("test.html")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js
new file mode 100644
index 0000000000..702357afbf
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js
@@ -0,0 +1,9 @@
+.pragma library
+
+function loadTest() {
+ Qt.openUrlExternally("test:url")
+}
+
+function loadFile() {
+ Qt.openUrlExternally("test.html")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml
new file mode 100644
index 0000000000..456653b81d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+import "openUrlExternally_lib.js" as Test
+
+Item {
+ Component.onCompleted: Test.loadTest();
+
+ property bool testFile
+ onTestFileChanged: Test.loadFile();
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/point.qml b/tests/auto/declarative/qdeclarativeqt/data/point.qml
new file mode 100644
index 0000000000..8b0188eaa7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/point.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.point(19, 34);
+ property variant test2: Qt.point(-3, 109.2);
+ property variant test3: Qt.point(-3);
+ property variant test4: Qt.point(-3, 109.2, 1);
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/quit.qml b/tests/auto/declarative/qdeclarativeqt/data/quit.qml
new file mode 100644
index 0000000000..62564a6492
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/quit.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.0
+
+QtObject {
+ Component.onCompleted: Qt.quit()
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/rect.qml b/tests/auto/declarative/qdeclarativeqt/data/rect.qml
new file mode 100644
index 0000000000..872bf50eb7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/rect.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.rect(10, 13, 100, 109)
+ property variant test2: Qt.rect(-10, 13, 100, 109.6)
+ property variant test3: Qt.rect(10, 13);
+ property variant test4: Qt.rect(10, 13, 100, 109, 10)
+ property variant test5: Qt.rect(10, 13, 100, -109)
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/rgba.qml b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
new file mode 100644
index 0000000000..bbafc6d98c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+QtObject {
+ property color test1: Qt.rgba(1, 0, 0, 0.8);
+ property color test2: Qt.rgba(1, 0.5, 0.3);
+ property color test3: Qt.rgba(1, 1);
+ property color test4: Qt.rgba(1, 1, 1, 1, 1);
+ property color test5: Qt.rgba(1.2, 1.3, 1.4, 1.5);
+ property color test6: Qt.rgba(-0.1, -0.2, -0.3, -0.4);
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/size.qml b/tests/auto/declarative/qdeclarativeqt/data/size.qml
new file mode 100644
index 0000000000..8e102eb6cb
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/size.qml
@@ -0,0 +1,11 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.size(19, 34);
+ property variant test2: Qt.size(3, 109.2);
+ property variant test3: Qt.size(-3, 10);
+ property variant test4: Qt.size(3);
+ property variant test5: Qt.size(3, 109.2, 1);
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativeqt/data/tint.qml b/tests/auto/declarative/qdeclarativeqt/data/tint.qml
new file mode 100644
index 0000000000..f8738865f2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/tint.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+
+QtObject {
+ property color test1: Qt.tint("red", "blue");
+ property color test2: Qt.tint(Qt.rgba(1, 0, 0), Qt.rgba(0, 0, 0, 0));
+ property color test3: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5));
+ property color test4: Qt.tint("red", Qt.rgba(0, 0, 1, 0.5), 10);
+ property color test5: Qt.tint("red")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/vector.qml b/tests/auto/declarative/qdeclarativeqt/data/vector.qml
new file mode 100644
index 0000000000..f494fe0531
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/vector.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+QtObject {
+ property variant test1: Qt.vector3d(1, 0, 0.9);
+ property variant test2: Qt.vector3d(102, -10, -982.1);
+ property variant test3: Qt.vector3d(102, -10);
+ property variant test4: Qt.vector3d(102, -10, -982.1, 10);
+}