コード例 #1
0
void MemEventModelTest::modifyEvent()
{
    EventModel *model = new EventModel();

    Event im;
    im.setType(Event::IMEvent);
    im.setDirection(Event::Outbound);
    im.setGroupId(group.id());
    im.setStartTime(QDateTime::fromString("2009-08-26T09:37:47Z", Qt::ISODate));
    im.setEndTime(QDateTime::fromString("2009-08-26T09:37:47Z", Qt::ISODate));
    im.setLocalUid("/org/freedesktop/Telepathy/Account/gabble/jabber/dut_40localhost0");
    im.setRemoteUid("td@localhost");
    im.setFreeText("imtest");

    QSignalSpy eventsCommitted(model, SIGNAL(eventsCommitted(const QList<CommHistory::Event>&, bool)));
    QVERIFY(model->addEvent(im));

    QVERIFY(waitSignal(eventsCommitted, WAIT_TIMEOUT));

    im.resetModifiedProperties();
    im.setFreeText("imtest \"q\" modified\t tabs");
    im.setStartTime(QDateTime::currentDateTime());
    im.setEndTime(QDateTime::currentDateTime());
    im.setIsRead(false);
    // should we actually test more properties?
    QVERIFY(model->modifyEvent(im));
    QVERIFY(waitSignal(eventsCommitted, WAIT_TIMEOUT));

    QTest::qWait(CALM_TIMEOUT);

    delete model;
}
コード例 #2
0
bool  SyncModelTest::modifyEvent( int itemId, int parentId, int groupId, const QDateTime &lastModTime,
                                  const QString& localId, const QString& remoteId, const QString& text, bool read)
{
    Q_UNUSED(lastModTime);
    EventModel model;
    watcher.setModel(&model);
    Event e;
    e.setType(Event::SMSEvent);
    e.setId(itemId);
    e.setParentId(parentId);

    if (parentId == ::INBOX ||  parentId >= ::MYFOLDER) {
        e.setDirection(Event::Inbound);
    }  else {
        e.setDirection(Event::Outbound);
    }
    e.setGroupId(groupId);
    e.setLocalUid(localId);
    e.setRemoteUid(remoteId);
    e.setFreeText(text);
    e.setIsRead(read);

    bool    ret = model.modifyEvent(e);
    watcher.waitForSignals(1, 1);
    return ret;
}