aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp1
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/testtypes.h5
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp1
4 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml b/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml
index 62abcb7d83..23c1eb0bb8 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/moduleApi.qml
@@ -11,8 +11,13 @@ QtObject {
property int existingUriTest: QtTest.qobjectTestProperty
property int scriptTest: QtTestScriptApi.scriptTestProperty
property int qobjectTest: QtTestQObjectApi.qobjectTestProperty
+ property int qobjectMethodTest: 2
property int qobjectMinorVersionTest: QtTestMinorVersionQObjectApi.qobjectTestProperty
property int qobjectMajorVersionTest: QtTestMajorVersionQObjectApi.qobjectTestProperty
property int qobjectParentedTest: QtTestParentedQObjectApi.qobjectTestProperty
+
+ Component.onCompleted: {
+ qobjectMethodTest = QtTestQObjectApi.qobjectTestMethod();
+ }
}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
index 7256d442e3..44d0046b74 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp
@@ -104,7 +104,6 @@ public:
static QScriptValue script_api(QDeclarativeEngine *engine, QScriptEngine *scriptEngine)
{
Q_UNUSED(engine)
- Q_UNUSED(scriptEngine)
static int testProperty = 13;
QScriptValue v = scriptEngine->newObject();
diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
index 320e60c82a..8c7b838976 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
+++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h
@@ -939,12 +939,14 @@ class testQObjectApi : public QObject
public:
testQObjectApi(QObject* parent = 0)
- : QObject(parent), m_testProperty(0)
+ : QObject(parent), m_testProperty(0), m_testWritableProperty(0), m_methodCallCount(0)
{
}
~testQObjectApi() {}
+ Q_INVOKABLE int qobjectTestMethod() { m_methodCallCount += 1; return m_methodCallCount; }
+
int qobjectTestProperty() const { return m_testProperty; }
void setQObjectTestProperty(int tp) { m_testProperty = tp; emit qobjectTestPropertyChanged(tp); }
@@ -958,6 +960,7 @@ signals:
private:
int m_testProperty;
int m_testWritableProperty;
+ int m_methodCallCount;
};
void registerTypes();
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index efa95d36b6..d9cd8250f7 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -2509,6 +2509,7 @@ void tst_qdeclarativeecmascript::moduleApi()
QCOMPARE(object->property("existingUriTest").toInt(), 20);
QCOMPARE(object->property("scriptTest").toInt(), 13);
QCOMPARE(object->property("qobjectTest").toInt(), 20);
+ QCOMPARE(object->property("qobjectMethodTest").toInt(), 1); // first call of method, so count = 1.
QCOMPARE(object->property("qobjectMinorVersionTest").toInt(), 20);
QCOMPARE(object->property("qobjectMajorVersionTest").toInt(), 20);
QCOMPARE(object->property("qobjectParentedTest").toInt(), 26);