diff options
author | Liang Qi <liang.qi@qt.io> | 2017-08-15 12:24:43 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-08-15 13:56:38 +0200 |
commit | 749951c19cbb7d301bed20f24d16dd4e713485c2 (patch) | |
tree | 40f4584e882cdd5e89d835f916e40563785029a0 /tests/auto/webchannel/tst_webchannel.cpp | |
parent | 2dd6a5e7ff769e54065ae8b9b532b2e56f2e3116 (diff) | |
parent | b5229df6a08a902b11a2fc9529af6385f4d985d5 (diff) | |
download | qtwebchannel-749951c19cbb7d301bed20f24d16dd4e713485c2.tar.gz |
Merge remote-tracking branch 'origin/5.9' into devv5.10.0-alpha1
Conflicts:
.qmake.conf
Change-Id: Ibf86cdf744d1081f40f734e4a30ca24581e1cc2d
Diffstat (limited to 'tests/auto/webchannel/tst_webchannel.cpp')
-rw-r--r-- | tests/auto/webchannel/tst_webchannel.cpp | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/tests/auto/webchannel/tst_webchannel.cpp b/tests/auto/webchannel/tst_webchannel.cpp index 2e80477..f214b7e 100644 --- a/tests/auto/webchannel/tst_webchannel.cpp +++ b/tests/auto/webchannel/tst_webchannel.cpp @@ -536,6 +536,10 @@ void TestWebChannel::testInvokeMethodConversion() QVERIFY(method != -1); channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastInt, args.at(0).toInt()); + int getterMethod = metaObject()->indexOfMethod("readInt()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, args.at(0).toVariant()); } { int method = metaObject()->indexOfMethod("setBool(bool)"); @@ -544,24 +548,40 @@ void TestWebChannel::testInvokeMethodConversion() args.append(QJsonValue(!m_lastBool)); channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastBool, args.at(0).toBool()); + int getterMethod = metaObject()->indexOfMethod("readBool()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, args.at(0).toVariant()); } { int method = metaObject()->indexOfMethod("setDouble(double)"); QVERIFY(method != -1); channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastDouble, args.at(0).toDouble()); + int getterMethod = metaObject()->indexOfMethod("readDouble()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, args.at(0).toVariant()); } { int method = metaObject()->indexOfMethod("setVariant(QVariant)"); QVERIFY(method != -1); channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastVariant, args.at(0).toVariant()); + int getterMethod = metaObject()->indexOfMethod("readVariant()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, args.at(0).toVariant()); } { int method = metaObject()->indexOfMethod("setJsonValue(QJsonValue)"); QVERIFY(method != -1); channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastJsonValue, args.at(0)); + int getterMethod = metaObject()->indexOfMethod("readJsonValue()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, args.at(0).toVariant()); } { int method = metaObject()->indexOfMethod("setJsonObject(QJsonObject)"); @@ -572,16 +592,24 @@ void TestWebChannel::testInvokeMethodConversion() args[0] = object; channel.d_func()->publisher->invokeMethod(this, method, args); QCOMPARE(m_lastJsonObject, object); + int getterMethod = metaObject()->indexOfMethod("readJsonObject()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, QVariant::fromValue(object)); } { - int method = metaObject()->indexOfMethod("setJsonArray(QJsonArray)"); - QVERIFY(method != -1); + int setterMethod = metaObject()->indexOfMethod("setJsonArray(QJsonArray)"); + QVERIFY(setterMethod != -1); QJsonArray array; array << QJsonValue(123); array << QJsonValue(4.2); args[0] = array; - channel.d_func()->publisher->invokeMethod(this, method, args); + channel.d_func()->publisher->invokeMethod(this, setterMethod, args); QCOMPARE(m_lastJsonArray, array); + int getterMethod = metaObject()->indexOfMethod("readJsonArray()"); + QVERIFY(getterMethod != -1); + auto retVal = channel.d_func()->publisher->invokeMethod(this, getterMethod, {}); + QCOMPARE(retVal, QVariant::fromValue(array)); } } |