summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-30 07:21:31 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-30 07:21:31 (GMT)
commitd8683cd18c852569672e43237c06dc619f193eba (patch)
tree32dfe36ba1d99aa2817dc3bdb91f0ec01b1d4c67 /tests
parent85db980578cb9f1b95be160a4386d9822c6ec6d0 (diff)
parent5d34515465d143d08d198b799489f472741a340f (diff)
downloadQt-d8683cd18c852569672e43237c06dc619f193eba.zip
Qt-d8683cd18c852569672e43237c06dc619f193eba.tar.gz
Qt-d8683cd18c852569672e43237c06dc619f193eba.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp18
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml14
-rw-r--r--tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp14
4 files changed, 52 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml
new file mode 100644
index 0000000..e66c7be
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/fontFamilies.qml
@@ -0,0 +1,6 @@
+import Qt 4.7
+
+QtObject {
+ property variant test1: Qt.fontFamilies(10)
+ property variant test2: Qt.fontFamilies();
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index 17b7925..5095be8 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -42,6 +42,7 @@
#include <qtest.h>
#include <QDebug>
#include <QDeclarativeEngine>
+#include <QFontDatabase>
#include <QFileInfo>
#include <QDeclarativeComponent>
#include <QDesktopServices>
@@ -76,6 +77,7 @@ private slots:
void isQtObject();
void btoa();
void atob();
+ void fontFamilies();
private:
QDeclarativeEngine engine;
@@ -483,6 +485,22 @@ void tst_qdeclarativeqt::atob()
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;
+}
+
QTEST_MAIN(tst_qdeclarativeqt)
#include "tst_qdeclarativeqt.moc"
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml
new file mode 100644
index 0000000..e4715ab
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+QtObject {
+ property int x;
+ property int y;
+ property int z;
+
+ Component.onCompleted: {
+ var vec3 = Qt.vector3d(1, 2, 3);
+ x = vec3.x;
+ y = vec3.y;
+ z = vec3.z;
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
index c18fbf5..95b9baa 100644
--- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
+++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp
@@ -84,6 +84,7 @@ private slots:
void enums();
void conflictingBindings();
void returnValues();
+ void varAssignment();
private:
QDeclarativeEngine engine;
@@ -911,6 +912,19 @@ void tst_qdeclarativevaluetypes::returnValues()
delete object;
}
+void tst_qdeclarativevaluetypes::varAssignment()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("varAssignment.qml"));
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("x").toInt(), 1);
+ QCOMPARE(object->property("y").toInt(), 2);
+ QCOMPARE(object->property("z").toInt(), 3);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativevaluetypes)
#include "tst_qdeclarativevaluetypes.moc"