summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeqt
diff options
context:
space:
mode:
authorMatthew Vogt <matthew.vogt@nokia.com>2012-01-30 14:16:15 +1000
committerMatthew Vogt <matthew.vogt@nokia.com>2012-01-30 14:16:15 +1000
commit12a5ddf456ba8549645a8cb28a8b4ed6197a14da (patch)
tree63ee2c88af936e0609a3a194f5bcc304c4c0b707 /tests/auto/declarative/qdeclarativeqt
Import relevant source from Qt 4.8
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt')
-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
-rw-r--r--tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro18
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp608
28 files changed, 926 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 00000000..f74aae83
--- /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 00000000..63b58c07
--- /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 00000000..fe47f3ff
--- /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 00000000..9d0dd345
--- /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 00000000..6ac470ea
--- /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 00000000..30499e94
--- /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 00000000..5b8c1b13
--- /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 00000000..8c35ebf1
--- /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 00000000..d2ef866d
--- /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 00000000..aec6f63c
--- /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 00000000..c9f50d48
--- /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 00000000..f520aeb4
--- /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 00000000..3bcc7912
--- /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 00000000..37b952d4
--- /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 00000000..67f0d0f3
--- /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 00000000..32e90c04
--- /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 00000000..dc4049c9
--- /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 00000000..702357af
--- /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 00000000..456653b8
--- /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 00000000..8b0188ea
--- /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 00000000..62564a64
--- /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 00000000..872bf50e
--- /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 00000000..bbafc6d9
--- /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 00000000..8e102eb6
--- /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 00000000..f8738865
--- /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 00000000..f494fe05
--- /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);
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
new file mode 100644
index 00000000..4b197ebf
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro
@@ -0,0 +1,18 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative script
+SOURCES += tst_qdeclarativeqt.cpp
+macx:CONFIG -= app_bundle
+
+symbian: {
+ importFiles.files = data
+ importFiles.path = .
+ DEPLOYMENT += importFiles
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD\\\"
+}
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
+
+CONFIG += parallel_test
+
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
new file mode 100644
index 00000000..9a5e4600
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -0,0 +1,608 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <private/qdeclarativeengine_p.h>
+
+#include <qtest.h>
+#include <QDebug>
+#include <QDeclarativeEngine>
+#include <QFontDatabase>
+#include <QFileInfo>
+#include <QDeclarativeComponent>
+#include <QDesktopServices>
+#include <QDir>
+#include <QVector3D>
+#include <QCryptographicHash>
+#include <QDeclarativeItem>
+#include <QSignalSpy>
+
+#ifdef Q_OS_SYMBIAN
+// In Symbian OS test data is located in applications private dir
+#define SRCDIR "."
+#endif
+
+class tst_qdeclarativeqt : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qdeclarativeqt() {}
+
+private slots:
+ void enums();
+ void rgba();
+ void hsla();
+ void rect();
+ void point();
+ void size();
+ void vector();
+ void lighter();
+ void darker();
+ void tint();
+ void openUrlExternally();
+ void openUrlExternally_pragmaLibrary();
+ void md5();
+ void createComponent();
+ void createComponent_pragmaLibrary();
+ void createQmlObject();
+ void consoleLog();
+ void dateTimeFormatting();
+ void dateTimeFormatting_data();
+ void isQtObject();
+ void btoa();
+ void atob();
+ void fontFamilies();
+ void quit();
+
+private:
+ QDeclarativeEngine engine;
+};
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename);
+}
+
+void tst_qdeclarativeqt::enums()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("enums.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape);
+ QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder);
+ QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle);
+ QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight);
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::rgba()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rgba(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rgba(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromRgbF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromRgbF(0, 0, 0, 0));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::hsla()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.hsla(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.hsla(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor::fromHslF(1, 1, 1, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor::fromHslF(0, 0, 0, 0));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::rect()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("rect.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.rect(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.rect(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6));
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF());
+ QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF(10, 13, 100, -109));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::point()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("point.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.point(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.point(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2));
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF());
+ QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::size()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("size.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.size(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.size(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10));
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF());
+ QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::vector()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("vector.qml"));
+
+ QString warning1 = component.url().toString() + ":6: Error: Qt.vector(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":7: Error: Qt.vector(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1));
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D());
+ QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::lighter()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: Qt.lighter(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.lighter(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).lighter(180));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::darker()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("darker.qml"));
+
+ QString warning1 = component.url().toString() + ":5: Error: Qt.darker(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.darker(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0.8, 0.3).darker(280));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::tint()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("tint.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.tint(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":8: Error: Qt.tint(): Invalid arguments";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1));
+ QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0));
+ QColor test3 = qvariant_cast<QColor>(object->property("test3"));
+ QCOMPARE(test3.rgba(), 0xFF7F0080);
+ QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor());
+ QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor());
+
+ delete object;
+}
+
+class MyUrlHandler : public QObject
+{
+ Q_OBJECT
+public:
+ MyUrlHandler() : called(0) { }
+ int called;
+ QUrl last;
+
+public slots:
+ void noteCall(const QUrl &url) { called++; last = url; }
+};
+
+void tst_qdeclarativeqt::openUrlExternally()
+{
+ MyUrlHandler handler;
+
+ QDesktopServices::setUrlHandler("test", &handler, "noteCall");
+ QDesktopServices::setUrlHandler("file", &handler, "noteCall");
+
+ QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(handler.called,1);
+ QCOMPARE(handler.last, QUrl("test:url"));
+
+ object->setProperty("testFile", true);
+
+ QCOMPARE(handler.called,2);
+ QCOMPARE(handler.last, TEST_FILE("test.html"));
+
+ QDesktopServices::unsetUrlHandler("test");
+ QDesktopServices::unsetUrlHandler("file");
+}
+
+void tst_qdeclarativeqt::openUrlExternally_pragmaLibrary()
+{
+ MyUrlHandler handler;
+
+ QDesktopServices::setUrlHandler("test", &handler, "noteCall");
+ QDesktopServices::setUrlHandler("file", &handler, "noteCall");
+
+ QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(handler.called,1);
+ QCOMPARE(handler.last, QUrl("test:url"));
+
+ object->setProperty("testFile", true);
+
+ QCOMPARE(handler.called,2);
+ QCOMPARE(handler.last, TEST_FILE("test.html"));
+
+ QDesktopServices::unsetUrlHandler("test");
+ QDesktopServices::unsetUrlHandler("file");
+}
+
+void tst_qdeclarativeqt::md5()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("md5.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.md5(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex()));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::createComponent()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml"));
+
+ QString warning1 = component.url().toString() + ":9: Error: Qt.createComponent(): Invalid arguments";
+ QString warning2 = component.url().toString() + ":10: Error: Qt.createComponent(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml"));
+ QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString());
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::createComponent_pragmaLibrary()
+{
+ // Currently, just loading createComponent_lib.qml causes crash on some platforms
+ QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready));
+ QCOMPARE(object->property("readValue").toInt(), int(1913));
+ delete object;
+}
+
+void tst_qdeclarativeqt::createQmlObject()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml"));
+
+ QString warning1 = component.url().toString() + ":7: Error: Qt.createQmlObject(): Invalid arguments";
+ QString warning2 = component.url().toString()+ ":10: Error: Qt.createQmlObject() failed to create object: " + TEST_FILE("inline").toString() + ":2:10: Blah is not a type\n";
+ QString warning3 = component.url().toString()+ ":11: Error: Qt.createQmlObject() failed to create object: " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name\n";
+ QString warning4 = component.url().toString()+ ":9: Error: Qt.createQmlObject(): Missing parent object";
+ QString warning5 = component.url().toString()+ ":8: Error: Qt.createQmlObject(): Invalid arguments";
+ QString warning6 = "RunTimeError: Qt.createQmlObject() failed to create object: " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method\n";
+
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4));
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5));
+ QTest::ignoreMessage(QtDebugMsg, qPrintable(warning6));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("emptyArg").toBool(), true);
+ QCOMPARE(object->property("success").toBool(), true);
+
+ QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(object);
+ QVERIFY(item != 0);
+ QVERIFY(item->childItems().count() == 1);
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::consoleLog()
+{
+ QTest::ignoreMessage(QtDebugMsg, "completed ok");
+ QTest::ignoreMessage(QtDebugMsg, "completed ok");
+ QDeclarativeComponent component(&engine, TEST_FILE("consoleLog.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qdeclarativeqt::dateTimeFormatting()
+{
+ QFETCH(QString, method);
+ QFETCH(QStringList, inputProperties);
+ QFETCH(QStringList, expectedResults);
+
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+
+ QDeclarativeEngine eng;
+
+ eng.rootContext()->setContextProperty("qdate", date);
+ eng.rootContext()->setContextProperty("qtime", time);
+ eng.rootContext()->setContextProperty("qdatetime", dateTime);
+
+ QDeclarativeComponent component(&eng, TEST_FILE("formatting.qml"));
+
+ QStringList warnings;
+ warnings << component.url().toString() + ":37: Error: Qt.formatDate(): Invalid date format"
+ << component.url().toString() + ":36: Error: Qt.formatDate(): Invalid arguments"
+ << component.url().toString() + ":40: Error: Qt.formatTime(): Invalid time format"
+ << component.url().toString() + ":39: Error: Qt.formatTime(): Invalid arguments"
+ << component.url().toString() + ":43: Error: Qt.formatDateTime(): Invalid datetime format"
+ << component.url().toString() + ":42: Error: Qt.formatDateTime(): Invalid arguments";
+
+ foreach (const QString &warning, warnings)
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
+
+ QObject *object = component.create();
+ QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString()));
+ QVERIFY(object != 0);
+
+ QVERIFY(inputProperties.count() > 0);
+
+ QVariant result;
+ foreach(const QString &prop, inputProperties) {
+ QVERIFY(QMetaObject::invokeMethod(object, method.toUtf8().constData(),
+ Q_RETURN_ARG(QVariant, result),
+ Q_ARG(QVariant, prop)));
+
+ QStringList output = result.toStringList();
+ for (int i=0; i<output.count(); i++)
+ QCOMPARE(output[i], expectedResults[i]);
+ }
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::dateTimeFormatting_data()
+{
+ QTest::addColumn<QString>("method");
+ QTest::addColumn<QStringList>("inputProperties");
+ QTest::addColumn<QStringList>("expectedResults");
+
+ QDate date(2008,12,24);
+ QTime time(14,15,38,200);
+ QDateTime dateTime(date, time);
+
+ QTest::newRow("formatDate")
+ << "formatDate"
+ << (QStringList() << "dateFromString" << "jsdate" << "qdate" << "qdatetime")
+ << (QStringList() << date.toString(Qt::DefaultLocaleShortDate)
+ << date.toString(Qt::DefaultLocaleLongDate)
+ << date.toString("ddd MMMM d yy"));
+
+ QTest::newRow("formatTime")
+ << "formatTime"
+ << (QStringList() << "jsdate" << "qtime" << "qdatetime")
+ << (QStringList() << time.toString(Qt::DefaultLocaleShortDate)
+ << time.toString(Qt::DefaultLocaleLongDate)
+ << time.toString("H:m:s a")
+ << time.toString("hh:mm:ss.zzz"));
+
+ QTest::newRow("formatDateTime")
+ << "formatDateTime"
+ << (QStringList() << "jsdate" << "qdatetime")
+ << (QStringList() << dateTime.toString(Qt::DefaultLocaleShortDate)
+ << dateTime.toString(Qt::DefaultLocaleLongDate)
+ << dateTime.toString("M/d/yy H:m:s a"));
+}
+
+void tst_qdeclarativeqt::isQtObject()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("isQtObject.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test1").toBool(), true);
+ QCOMPARE(object->property("test2").toBool(), false);
+ QCOMPARE(object->property("test3").toBool(), false);
+ QCOMPARE(object->property("test4").toBool(), false);
+ QCOMPARE(object->property("test5").toBool(), false);
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::btoa()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("btoa.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.btoa(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("SGVsbG8gd29ybGQh"));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::atob()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("atob.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.atob(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test2").toString(), QString("Hello world!"));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::fontFamilies()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("fontFamilies.qml"));
+
+ QString warning1 = component.url().toString() + ":4: Error: Qt.fontFamilies(): Invalid arguments";
+ QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QFontDatabase database;
+ QCOMPARE(object->property("test2"), QVariant::fromValue(database.families()));
+
+ delete object;
+}
+
+void tst_qdeclarativeqt::quit()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("quit.qml"));
+
+ QSignalSpy spy(&engine, SIGNAL(quit()));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ QCOMPARE(spy.count(), 1);
+
+ delete object;
+}
+
+QTEST_MAIN(tst_qdeclarativeqt)
+
+#include "tst_qdeclarativeqt.moc"