MCPcopy Create free account
hub / github.com/KDAB/GammaRay / testMemberProperty

Method testMemberProperty

tests/metaobjecttest.cpp:53–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51 }
52
53 static void testMemberProperty()
54 {
55 auto *mo = MetaObjectRepository::instance()->metaObject(QStringLiteral("QThread"));
56 QVERIFY(mo->propertyCount() >= 7); // depends on Qt version
57
58 MetaProperty *prop = nullptr;
59 for (int i = 0; i < mo->propertyCount(); ++i) {
60 prop = mo->propertyAt(i);
61 QVERIFY(prop);
62 if (strcmp(prop->name(), "priority") == 0)
63 break;
64 }
65
66 QVERIFY(prop);
67 if (!prop)
68 return; // to silence clang-tidy
69
70 QCOMPARE(prop->name(), "priority");
71 QCOMPARE(prop->typeName(), "QThread::Priority");
72
73 QThread t;
74 QCOMPARE(prop->value(&t).value<QThread::Priority>(), t.priority());
75 QCOMPARE(prop->isReadOnly(), false);
76 }
77
78 static void testStaticProperty()
79 {

Callers

nothing calls this directly

Calls 8

propertyCountMethod · 0.80
propertyAtMethod · 0.80
priorityMethod · 0.80
metaObjectMethod · 0.45
nameMethod · 0.45
typeNameMethod · 0.45
valueMethod · 0.45
isReadOnlyMethod · 0.45

Tested by

no test coverage detected