summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-09-23 03:02:57 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-09-23 03:02:57 (GMT)
commitecfe2b1cb35a8779bea5d23c0bb2c1b31939c01d (patch)
tree2ba3fea7bd3748f44dce82f82b274b21c5078c45 /tests
parent267ab0cd6a1d7070a7139eda24eb372590603c01 (diff)
downloadQt-ecfe2b1cb35a8779bea5d23c0bb2c1b31939c01d.zip
Qt-ecfe2b1cb35a8779bea5d23c0bb2c1b31939c01d.tar.gz
Qt-ecfe2b1cb35a8779bea5d23c0bb2c1b31939c01d.tar.bz2
Merge qmlengine and qmlbindengine tests
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qmlbindengine/data/valueTypeFunctions.qml (renamed from tests/auto/declarative/qmlengine/functions.qml)2
-rw-r--r--tests/auto/declarative/qmlbindengine/testtypes.cpp1
-rw-r--r--tests/auto/declarative/qmlbindengine/testtypes.h67
-rw-r--r--tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp11
-rw-r--r--tests/auto/declarative/qmlengine/qmlengine.pro5
-rw-r--r--tests/auto/declarative/qmlengine/tst_qmlengine.cpp98
6 files changed, 80 insertions, 104 deletions
diff --git a/tests/auto/declarative/qmlengine/functions.qml b/tests/auto/declarative/qmlbindengine/data/valueTypeFunctions.qml
index 28e8ed4..33b4a68 100644
--- a/tests/auto/declarative/qmlengine/functions.qml
+++ b/tests/auto/declarative/qmlbindengine/data/valueTypeFunctions.qml
@@ -1,4 +1,4 @@
-import Test 1.0
+import Qt.test 1.0
MyTypeObject {
rectProperty: Qt.rect(0,0,100,100)
diff --git a/tests/auto/declarative/qmlbindengine/testtypes.cpp b/tests/auto/declarative/qmlbindengine/testtypes.cpp
index 3ff05d7..22e3071 100644
--- a/tests/auto/declarative/qmlbindengine/testtypes.cpp
+++ b/tests/auto/declarative/qmlbindengine/testtypes.cpp
@@ -37,5 +37,6 @@ QML_DEFINE_TYPE(Qt.test, 1, 0, 0, MyDeferredObject,MyDeferredObject);
QML_DEFINE_TYPE(Qt.test, 1, 0, 0, MyQmlContainer,MyQmlContainer);
QML_DEFINE_EXTENDED_TYPE(Qt.test, 1, 0, 0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject);
QML_DEFINE_EXTENDED_TYPE(Qt.test, 1, 0, 0, MyExtendedObject,MyExtendedObject,ExtensionObject);
+QML_DEFINE_TYPE(Qt.test, 1, 0, 0, MyTypeObject, MyTypeObject);
#include "testtypes.moc"
diff --git a/tests/auto/declarative/qmlbindengine/testtypes.h b/tests/auto/declarative/qmlbindengine/testtypes.h
index f27c0b0..f0302aa 100644
--- a/tests/auto/declarative/qmlbindengine/testtypes.h
+++ b/tests/auto/declarative/qmlbindengine/testtypes.h
@@ -4,6 +4,9 @@
#include <QtCore/qobject.h>
#include <QtDeclarative/qml.h>
#include <QtDeclarative/qmlexpression.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qrect.h>
class MyQmlAttachedObject : public QObject
{
@@ -197,5 +200,69 @@ private:
};
QML_DECLARE_TYPE(MyExtendedObject);
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty);
+ Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty);
+ Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty);
+ Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty);
+ Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged);
+ Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty);
+
+public:
+ MyTypeObject() {}
+
+ QPoint pointPropertyValue;
+ QPoint pointProperty() const {
+ return pointPropertyValue;
+ }
+ void setPointProperty(const QPoint &v) {
+ pointPropertyValue = v;
+ }
+
+ QPointF pointFPropertyValue;
+ QPointF pointFProperty() const {
+ return pointFPropertyValue;
+ }
+ void setPointFProperty(const QPointF &v) {
+ pointFPropertyValue = v;
+ }
+
+ QSize sizePropertyValue;
+ QSize sizeProperty() const {
+ return sizePropertyValue;
+ }
+ void setSizeProperty(const QSize &v) {
+ sizePropertyValue = v;
+ }
+
+ QSizeF sizeFPropertyValue;
+ QSizeF sizeFProperty() const {
+ return sizeFPropertyValue;
+ }
+ void setSizeFProperty(const QSizeF &v) {
+ sizeFPropertyValue = v;
+ }
+
+ QRect rectPropertyValue;
+ QRect rectProperty() const {
+ return rectPropertyValue;
+ }
+ void setRectProperty(const QRect &v) {
+ rectPropertyValue = v;
+ }
+
+ QRectF rectFPropertyValue;
+ QRectF rectFProperty() const {
+ return rectFPropertyValue;
+ }
+ void setRectFProperty(const QRectF &v) {
+ rectFPropertyValue = v;
+ }
+
+};
+QML_DECLARE_TYPE(MyTypeObject);
+
#endif // TESTTYPES_H
diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
index c7d6a87..612220a 100644
--- a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
+++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
@@ -39,6 +39,7 @@ private slots:
void deferredProperties();
void extensionObjects();
void enums();
+ void valueTypeFunctions();
private:
QmlEngine engine;
@@ -385,6 +386,16 @@ void tst_qmlbindengine::enums()
QCOMPARE(object->property("j").toInt(), 19);
}
+void tst_qmlbindengine::valueTypeFunctions()
+{
+ QmlComponent component(&engine, TEST_FILE("valueTypeFunctions.qml"));
+ MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->rectProperty(), QRect(0,0,100,100));
+ QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5));
+}
+
+
QTEST_MAIN(tst_qmlbindengine)
#include "tst_qmlbindengine.moc"
diff --git a/tests/auto/declarative/qmlengine/qmlengine.pro b/tests/auto/declarative/qmlengine/qmlengine.pro
deleted file mode 100644
index 4ac81e9..0000000
--- a/tests/auto/declarative/qmlengine/qmlengine.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-load(qttest_p4)
-contains(QT_CONFIG,declarative): QT += declarative
-SOURCES += tst_qmlengine.cpp
-
-DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
deleted file mode 100644
index 8c050cb..0000000
--- a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-#include <qtest.h>
-#include <QtDeclarative/qml.h>
-#include <QtDeclarative/QmlComponent>
-#include <QtDeclarative/QmlEngine>
-
-#include <QtCore/QDebug>
-#include <QtCore/QFile>
-#include <QtCore/QUrl>
-
-class tst_qmlengine : public QObject
-{
- Q_OBJECT
-public:
- tst_qmlengine() {}
-
-private slots:
- void valueTypeFunctions();
-
-private:
- QmlEngine engine;
-};
-
-class MyTypeObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty);
- Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty);
- Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty);
- Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty);
- Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged);
- Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty);
-
-public:
- MyTypeObject() {}
-
- QPoint pointPropertyValue;
- QPoint pointProperty() const {
- return pointPropertyValue;
- }
- void setPointProperty(const QPoint &v) {
- pointPropertyValue = v;
- }
-
- QPointF pointFPropertyValue;
- QPointF pointFProperty() const {
- return pointFPropertyValue;
- }
- void setPointFProperty(const QPointF &v) {
- pointFPropertyValue = v;
- }
-
- QSize sizePropertyValue;
- QSize sizeProperty() const {
- return sizePropertyValue;
- }
- void setSizeProperty(const QSize &v) {
- sizePropertyValue = v;
- }
-
- QSizeF sizeFPropertyValue;
- QSizeF sizeFProperty() const {
- return sizeFPropertyValue;
- }
- void setSizeFProperty(const QSizeF &v) {
- sizeFPropertyValue = v;
- }
-
- QRect rectPropertyValue;
- QRect rectProperty() const {
- return rectPropertyValue;
- }
- void setRectProperty(const QRect &v) {
- rectPropertyValue = v;
- }
-
- QRectF rectFPropertyValue;
- QRectF rectFProperty() const {
- return rectFPropertyValue;
- }
- void setRectFProperty(const QRectF &v) {
- rectFPropertyValue = v;
- }
-
-};
-QML_DECLARE_TYPE(MyTypeObject);
-QML_DEFINE_TYPE(Test, 1, 0, 0, MyTypeObject, MyTypeObject);
-
-void tst_qmlengine::valueTypeFunctions()
-{
- QmlComponent component(&engine, SRCDIR "/functions.qml");
- MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create());
- QCOMPARE(obj->rectProperty(), QRect(0,0,100,100));
- QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5));
-}
-
-QTEST_MAIN(tst_qmlengine)
-
-#include "tst_qmlengine.moc"