| 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 | |
| 119 | QTEST_MAIN(PropertyBinderTest) |
nothing calls this directly
no test coverage detected