summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-03 03:34:58 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-03 03:34:58 (GMT)
commit41f9b733cc256bd33b467171ec26502f1f8c03e9 (patch)
tree369fefdd0b849ec386276c75de72ef6c816cf1e0 /tests/auto
parent9c726c2f2791f82de52f54ffc1f580630d10c61d (diff)
parentd758910f3d8d5eb64f7c7d94e5c9ef9ae259230b (diff)
downloadQt-41f9b733cc256bd33b467171ec26502f1f8c03e9.zip
Qt-41f9b733cc256bd33b467171ec26502f1f8c03e9.tar.gz
Qt-41f9b733cc256bd33b467171ec26502f1f8c03e9.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Don't modify the signal order on the second dynamic meta object pass Doc Support passing QObject derived types to QML methods
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h6
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp27
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp12
5 files changed, 64 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml
new file mode 100644
index 0000000..d5d3329
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml
@@ -0,0 +1,9 @@
+import Qt.test 1.0
+import Qt 4.7
+
+MyQmlObject {
+ id: root
+ Component.onCompleted: {
+ root.myinvokable(root);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml
new file mode 100644
index 0000000..29d7d01
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml
@@ -0,0 +1,11 @@
+import Qt.test 1.0
+import Qt 4.7
+
+MyQmlObject {
+ id: root
+ property bool test: false
+ Component.onCompleted: {
+ test = (root.returnme() == root)
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 7d7e3d9..220318d 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -95,7 +95,7 @@ class MyQmlObject : public QObject
Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false);
public:
- MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {}
+ MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {}
enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 };
enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 };
@@ -149,6 +149,9 @@ public:
int nonscriptable() const { return 0; }
void setNonscriptable(int) {}
+ MyQmlObject *myinvokableObject;
+ Q_INVOKABLE MyQmlObject *returnme() { return this; }
+
signals:
void basicSignal();
void argumentSignal(int a, QString b, qreal c);
@@ -162,6 +165,7 @@ public slots:
void methodNoArgs() { m_methodCalled = true; }
void method(int a) { if(a == 163) m_methodIntCalled = true; }
void setString(const QString &s) { m_string = s; }
+ void myinvokable(MyQmlObject *o) { myinvokableObject = o; }
private:
friend class tst_qdeclarativeecmascript;
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 76ca964..33bf7ea 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -164,6 +164,8 @@ private slots:
void include();
void callQtInvokables();
+ void invokableObjectArg();
+ void invokableObjectRet();
private:
QDeclarativeEngine engine;
};
@@ -1733,6 +1735,31 @@ void tst_qdeclarativeecmascript::callQtInvokables()
QCOMPARE(o.actuals().at(0), QVariant(9));
}
+// QTBUG-13047 (check that you can pass registered object types as args)
+void tst_qdeclarativeecmascript::invokableObjectArg()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectArg.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+ MyQmlObject *qmlobject = qobject_cast<MyQmlObject *>(o);
+ QVERIFY(qmlobject);
+ QCOMPARE(qmlobject->myinvokableObject, qmlobject);
+
+ delete o;
+}
+
+// QTBUG-13047 (check that you can return registered object types from methods)
+void tst_qdeclarativeecmascript::invokableObjectRet()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectRet.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
// QTBUG-5675
void tst_qdeclarativeecmascript::listToVariant()
{
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index dc00e16..1825991 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -118,6 +118,7 @@ private slots:
void valueTypes();
void cppnamespace();
void aliasProperties();
+ void aliasPropertiesAndSignals();
void componentCompositeType();
void i18n();
void i18n_data();
@@ -1051,6 +1052,17 @@ void tst_qdeclarativelanguage::aliasProperties()
}
}
+// QTBUG-13374 Test that alias properties and signals can coexist
+void tst_qdeclarativelanguage::aliasPropertiesAndSignals()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertiesAndSignals.qml"));
+ VERIFY_ERRORS(0);
+ QObject *o = component.create();
+ QVERIFY(o);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+}
+
// Test that the root element in a composite type can be a Component
void tst_qdeclarativelanguage::componentCompositeType()
{