本文整理汇总了C++中TestObject::asdf方法的典型用法代码示例。如果您正苦于以下问题:C++ TestObject::asdf方法的具体用法?C++ TestObject::asdf怎么用?C++ TestObject::asdf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestObject
的用法示例。
在下文中一共展示了TestObject::asdf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testInfoForObject
void TestWebChannel::testInfoForObject()
{
TestObject obj;
obj.setObjectName("myTestObject");
QWebChannel channel;
const QJsonObject info = channel.d_func()->publisher->classInfoForObject(&obj, m_dummyTransport);
QCOMPARE(info.keys(), QStringList() << "enums" << "methods" << "properties" << "signals");
{ // enums
QJsonObject fooEnum;
fooEnum["Asdf"] = TestObject::Asdf;
fooEnum["Bar"] = TestObject::Bar;
QJsonObject expected;
expected["Foo"] = fooEnum;
QCOMPARE(info["enums"].toObject(), expected);
}
{ // methods & slots
QJsonArray expected;
{
QJsonArray method;
method.append(QStringLiteral("deleteLater"));
method.append(obj.metaObject()->indexOfMethod("deleteLater()"));
expected.append(method);
}
{
QJsonArray method;
method.append(QStringLiteral("slot1"));
method.append(obj.metaObject()->indexOfMethod("slot1()"));
expected.append(method);
}
{
QJsonArray method;
method.append(QStringLiteral("slot2"));
method.append(obj.metaObject()->indexOfMethod("slot2(QString)"));
expected.append(method);
}
{
QJsonArray method;
method.append(QStringLiteral("method1"));
method.append(obj.metaObject()->indexOfMethod("method1()"));
expected.append(method);
}
QCOMPARE(info["methods"].toArray(), expected);
}
{ // signals
QJsonArray expected;
{
QJsonArray signal;
signal.append(QStringLiteral("destroyed"));
signal.append(obj.metaObject()->indexOfMethod("destroyed(QObject*)"));
expected.append(signal);
}
{
QJsonArray signal;
signal.append(QStringLiteral("sig1"));
signal.append(obj.metaObject()->indexOfMethod("sig1()"));
expected.append(signal);
}
{
QJsonArray signal;
signal.append(QStringLiteral("sig2"));
signal.append(obj.metaObject()->indexOfMethod("sig2(QString)"));
expected.append(signal);
}
QCOMPARE(info["signals"].toArray(), expected);
}
{ // properties
QJsonArray expected;
{
QJsonArray property;
property.append(obj.metaObject()->indexOfProperty("objectName"));
property.append(QStringLiteral("objectName"));
{
QJsonArray signal;
signal.append(1);
signal.append(obj.metaObject()->indexOfMethod("objectNameChanged(QString)"));
property.append(signal);
}
property.append(obj.objectName());
expected.append(property);
}
{
QJsonArray property;
property.append(obj.metaObject()->indexOfProperty("foo"));
property.append(QStringLiteral("foo"));
{
QJsonArray signal;
property.append(signal);
}
property.append(obj.foo());
expected.append(property);
}
{
QJsonArray property;
property.append(obj.metaObject()->indexOfProperty("asdf"));
//.........这里部分代码省略.........