本文整理汇总了C++中ModelWatcher::committedCount方法的典型用法代码示例。如果您正苦于以下问题:C++ ModelWatcher::committedCount方法的具体用法?C++ ModelWatcher::committedCount怎么用?C++ ModelWatcher::committedCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModelWatcher
的用法示例。
在下文中一共展示了ModelWatcher::committedCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateStatus
void SingleEventModelTest::updateStatus()
{
SingleEventModel model;
watcher.setModel(&model);
SingleEventModel observer;
ModelWatcher watcherObserver;
watcherObserver.setModel(&observer);
Event event;
event.setType(Event::SMSEvent);
event.setDirection(Event::Outbound);
event.setLocalUid("/org/freedesktop/Telepathy/Account/gabble/jabber/dut_40localhost0");
event.setGroupId(group1.id());
event.setFreeText("freeText");
event.setStartTime(QDateTime::currentDateTime());
event.setEndTime(QDateTime::currentDateTime());
event.setRemoteUid("123456");
event.setMessageToken("messageTokenB");
QVERIFY(model.addEvent(event));
watcher.waitForSignals();
QVERIFY(event.id() != -1);
CommHistory::Event::PropertySet props = CommHistory::Event::PropertySet()
<< CommHistory::Event::Id
<< CommHistory::Event::Direction
<< CommHistory::Event::Status
<< CommHistory::Event::GroupId
<< CommHistory::Event::MessageToken
<< CommHistory::Event::ReportDelivery
<< CommHistory::Event::MmsId;
model.setPropertyMask(props);
QVERIFY(model.getEventByUri(event.url()));
QVERIFY(watcher.waitForModelReady());
QCOMPARE(model.rowCount(), 1);
Event modelEvent = model.event(model.index(0, 0));
QVERIFY(modelEvent.validProperties().contains(CommHistory::Event::Status));
QVERIFY(modelEvent.validProperties().contains(CommHistory::Event::MessageToken));
QVERIFY(!modelEvent.validProperties().contains(CommHistory::Event::FreeText));
QVERIFY(!modelEvent.validProperties().contains(CommHistory::Event::ContactId));
QCOMPARE(event.status(), modelEvent.status());
QCOMPARE(event.messageToken(), modelEvent.messageToken());
// init observer model with the same event and all properties
QVERIFY(observer.getEventByUri(event.url()));
QVERIFY(watcherObserver.waitForModelReady());
QCOMPARE(observer.rowCount(), 1);
Event observedEvent = observer.event(observer.index(0, 0));
QVERIFY(compareEvents(event, observedEvent));
// modify event with new status only
modelEvent.setStatus(Event::SentStatus);
QVERIFY(model.modifyEvent(modelEvent));
watcher.waitForSignals();
QCOMPARE(watcher.updatedCount(), 1);
QCOMPARE(watcher.committedCount(), 1);
//check observer model
QTest::qWait(100);
observedEvent = observer.event(observer.index(0, 0));
QCOMPARE(observedEvent.freeText(), event.freeText());
QCOMPARE(observedEvent.status(), Event::SentStatus);
}