void tst_QContactRelationship::emptiness()
{
    QContactRelationship r1, r2, r3;

    QContactId id1, id2, id3;
    id1.setLocalId(1);
    id1.setManagerUri("test");
    id2.setLocalId(2);
    id2.setManagerUri("test");
    id3.setLocalId(3);
    id3.setManagerUri("test");

    QVERIFY(r1.first() == QContactId());
    QVERIFY(r1.second() == QContactId());
    QVERIFY(r1.relationshipType() == QString());

    r1.setFirst(id1);
    QVERIFY(r1.first() == id1);
    r1.setSecond(id2);
    QVERIFY(r1.second() == id2);
    QVERIFY(r1.first() == id1);
    QVERIFY(r1.relationshipType() == QString());

    r1.setRelationshipType(QContactRelationship::HasSpouse);
    QVERIFY(r1.relationshipType() == QString(QLatin1String(QContactRelationship::HasSpouse)));

    r2 = r1;
    QVERIFY(r1 == r2);
    QVERIFY(r1 != r3);
    QVERIFY(r2 != r3);

    r3.setFirst(id3);
    r3.setSecond(id2);
    r3.setRelationshipType(QContactRelationship::HasAssistant);

    r2.setFirst(id3);

    QVERIFY(r1 != r2);
    QVERIFY(r2 != r3);
    QVERIFY(r3 != r1);
}
void tst_QContactRelationship::operations()
{
    QContactRelationship r1;

    QContactId id1, id2;
    id1.setLocalId(1);
    id1.setManagerUri("test");
    id2.setLocalId(2);
    id2.setManagerUri("test");

    QVERIFY(r1.first() == QContactId());
    QVERIFY(r1.second() == QContactId());
    QVERIFY(r1.relationshipType() == QString());

    r1.setFirst(id1);
    QVERIFY(r1.first() == id1);
    r1.setSecond(id2);
    QVERIFY(r1.second() == id2);
    QVERIFY(r1.first() == id1);
    QVERIFY(r1.relationshipType() == QString());

    r1.setRelationshipType(QContactRelationship::HasSpouse);
    QVERIFY(r1.relationshipType() == QString(QLatin1String(QContactRelationship::HasSpouse)));
}
QContactId SeasideCache::selfContactId()
{
    return QContactId();
}
Beispiel #4
0
QContactId ContactId::apiId(quint32 dbId)
{
    ContactId *eid = new ContactId(dbId);
    return QContactId(eid);
}