summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChris Adams <chris.adams@jollamobile.com>2016-06-10 12:39:49 +1000
committerChristopher Adams <chris.adams@jollamobile.com>2016-06-15 07:37:22 +0000
commit857ec105c16c6adbbebb87c340745a83e909c0e4 (patch)
treeb96aaa2b83258e7513c0739f7f28e41cbe1421d5 /tests
parent15f85780ba1bbce6c4f8bb4e3198298185d0b294 (diff)
Fix QtVersit encoding of Gender details
The Gender detail API was tweaked slightly for consistency with the rest of the API, but the Versit encoder was not updated at the same time. This commit ensures that the Versit encoder treats default-constructed QContactGender details as "Unspecified" gender values, and updates the unit test to enforce that semantic. Change-Id: I9f6a75888fbe8497b66ff7ec2104cacd7575fa50 Reviewed-by: Matthew Vogt <matthew.vogt@qinetic.com.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp b/tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp
index a42e6f62c..3d78a8b35 100644
--- a/tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp
+++ b/tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp
@@ -988,14 +988,16 @@ void tst_QVersitContactExporter::testEncodeGender()
{
QContact contact(createContactWithName(QStringLiteral("asdf")));
- // Check that empty gender detail is not encoded.
+ // Check that empty gender detail is encoded as Unspecified
QContactGender gender;
contact.saveDetail(&gender);
QVERIFY(mExporter->exportContacts(QList<QContact>() << contact, QVersitDocument::VCard30Type));
QVersitDocument document = mExporter->documents().first();
- QCOMPARE(countProperties(document), 0);
+ QCOMPARE(countProperties(document), 1);
QVersitProperty property = findPropertyByName(document, QStringLiteral("X-GENDER"));
- QVERIFY(property.isEmpty());
+ QVERIFY(!property.isEmpty());
+ QCOMPARE(property.parameters().count(), 0);
+ QCOMPARE(property.value(), QStringLiteral("Unspecified"));
// Check that all valid values are encoded properly.
gender.setGender(QContactGender::GenderMale);