void tst_QXmppRpcIq::testBool() { checkVariant(false, QByteArray("<value><boolean>0</boolean></value>")); checkVariant(true, QByteArray("<value><boolean>1</boolean></value>")); }
void TestXmlRpc::testBool() { checkVariant(false, QByteArray("<value><boolean>0</boolean></value>")); checkVariant(true, QByteArray("<value><boolean>1</boolean></value>")); }
/** * Send back a response [type(1), msgid(uint), error(...), result(...)] */ bool MsgpackIODevice::sendResponse(uint64_t msgid, const QVariant& err, const QVariant& res) { if (!checkVariant(err) || !checkVariant(res)) { sendError(msgid, tr("Internal server error, could not serialize response")); return false; } msgpack_pack_array(&m_pk, 4); msgpack_pack_int(&m_pk, 1); msgpack_pack_int(&m_pk, msgid); send(err); send(res); return true; }
void TestXmlRpc::testArray() { checkVariant(QVariantList() << QString("hello world") << double(-12.214), QByteArray("<value><array><data>" "<value><string>hello world</string></value>" "<value><double>-12.214</double></value>" "</data></array></value>")); }
/** * Send [type(2), method, params] * Returns false if the params could not be serialized */ bool MsgpackIODevice::sendNotification(const QByteArray& method, const QVariantList& params) { if (!checkVariant(params)) { return false; } msgpack_pack_array(&m_pk, 3); msgpack_pack_int(&m_pk, 2); send(method); send(params); return true; }
bool OpenTxEepromInterface::loadGeneral(GeneralSettings &settings, unsigned int version) { QByteArray eepromData(sizeof(settings), 0); // GeneralSettings should be always bigger than the EEPROM struct T open9xSettings(settings, board, version); efile->openRd(FILE_GENERAL); int sz = efile->readRlc2((uint8_t *)eepromData.data(), eepromData.size()); if (sz) { open9xSettings.Import(eepromData); return checkVariant(settings.version, settings.variant); } std::cout << " error when loading general settings"; return false; }
void TestXmlRpc::testStruct() { QMap<QString, QVariant> map; map["bar"] = QString("hello world"); map["foo"] = double(-12.214); checkVariant(map, QByteArray("<value><struct>" "<member>" "<name>bar</name>" "<value><string>hello world</string></value>" "</member>" "<member>" "<name>foo</name>" "<value><double>-12.214</double></value>" "</member>" "</struct></value>")); }
void tst_QXmppRpcIq::testNil() { checkVariant(QVariant(), QByteArray("<value><nil/></value>")); }
void tst_QXmppRpcIq::testBase64() { checkVariant(QByteArray("\0\1\2\3", 4), QByteArray("<value><base64>AAECAw==</base64></value>")); }
void TestXmlRpc::testNil() { checkVariant(QVariant(), QByteArray("<value><nil/></value>")); }
void TestXmlRpc::testString() { checkVariant(QString("hello world"), QByteArray("<value><string>hello world</string></value>")); }
void TestXmlRpc::testDouble() { checkVariant(double(-12.214), QByteArray("<value><double>-12.214</double></value>")); }
void TestXmlRpc::testInt() { checkVariant(int(-12), QByteArray("<value><i4>-12</i4></value>")); }
void TestXmlRpc::testDateTime() { checkVariant(QDateTime(QDate(1998, 7, 17), QTime(14, 8, 55)), QByteArray("<value><dateTime.iso8601>1998-07-17T14:08:55</dateTime.iso8601></value>")); }
void tst_QXmppRpcIq::testString() { checkVariant(QString("hello world"), QByteArray("<value><string>hello world</string></value>")); }
void TestXmlRpc::testBase64() { checkVariant(QByteArray("\0\1\2\3", 4), QByteArray("<value><base64>AAECAw==</base64></value>")); }
void tst_QXmppRpcIq::testDouble() { checkVariant(double(-12.214), QByteArray("<value><double>-12.214</double></value>")); }
void tst_QXmppRpcIq::testInt() { checkVariant(int(-12), QByteArray("<value><i4>-12</i4></value>")); }