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

Method testMultiBinding

tests/propertybindertest.cpp:95–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93 }
94
95 void testMultiBinding()
96 {
97 std::unique_ptr<MyObject> obj1(new MyObject(this));
98 obj1->setIntProp(18);
99 obj1->setIntProp2(133);
100 std::unique_ptr<MyObject> obj2(new MyObject(this));
101
102 auto binder = new PropertyBinder(obj1.get(), obj2.get());
103 binder->add("intProp", "intProp");
104 binder->add("intProp2", "intProp2");
105
106 QVERIFY(obj1->intProp() != obj2->intProp());
107 QVERIFY(obj1->intProp2() != obj2->intProp2());
108
109 binder->syncSourceToDestination();
110
111 QCOMPARE(obj2->intProp(), 18);
112 QCOMPARE(obj2->intProp2(), 133);
113
114 obj2->setIntProp(23);
115 QCOMPARE(obj1->intProp(), 23);
116 }
117};
118
119QTEST_MAIN(PropertyBinderTest)

Callers

nothing calls this directly

Calls 7

setIntProp2Method · 0.80
intProp2Method · 0.80
setIntPropMethod · 0.45
getMethod · 0.45
addMethod · 0.45
intPropMethod · 0.45

Tested by

no test coverage detected