summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/versit/qversitcontactexporter_p.cpp3
-rw-r--r--tests/auto/versit/qversitcontactexporter/tst_qversitcontactexporter.cpp8
2 files changed, 5 insertions, 6 deletions
diff --git a/src/versit/qversitcontactexporter_p.cpp b/src/versit/qversitcontactexporter_p.cpp
index 673086751..39be29794 100644
--- a/src/versit/qversitcontactexporter_p.cpp
+++ b/src/versit/qversitcontactexporter_p.cpp
@@ -671,9 +671,6 @@ void QVersitContactExporterPrivate::encodeGender(
QSet<int>* processedFields)
{
const QContactGender &gender = static_cast<const QContactGender &>(detail);
- if (!gender.gender())
- return;
-
QVersitProperty property;
property.setName(mPropertyMappings.value(detail.type()).second);
switch (gender.gender()) {
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);