void tst_QPlaceContactDetail::constructorTest()
{
    QPlaceContactDetail detail;
    QVERIFY(detail.label().isEmpty());
    QVERIFY(detail.value().isEmpty());

    detail.setLabel(QLatin1String("Emergency Services"));
    detail.setValue(QLatin1String("0118 999"));

    QPlaceContactDetail detail2(detail);
    QCOMPARE(detail2.label(), QLatin1String("Emergency Services"));
    QCOMPARE(detail2.value(), QLatin1String("0118 999"));
}
Exemplo n.º 2
0
void tst_QContactDetail::hash()
{
    QContactDetail detail1("definition");
    detail1.setValue("key", "value");
    QContactDetail detail2("definition");
    detail2.setValue("key", "value");
    QContactDetail detail3("definition");
    detail3.setValue("key", "different value");
    QVERIFY(qHash(detail1) == qHash(detail2));
    QVERIFY(qHash(detail1) != qHash(detail3));
    QSet<QContactDetail> set;
    set.insert(detail1);
    set.insert(detail2);
    set.insert(detail3);
    QCOMPARE(set.size(), 2);
}