From 1679607db68e8dc0de40711cb2123e68a8a52186 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Thu, 10 Dec 2015 21:19:55 +0000 Subject: [PATCH] Added remaining source code and units tests for the MEMBER vCard property in ContactDataObject. --- source/contacteditor/ContactDataObject.cpp | 11 +++++++++++ source/contacteditor/ContactDataObject.h | 1 + source/tests/LoadCheck-Load4.vcf | 3 ++- source/tests/xestiaab_contactload.h | 13 +++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/source/contacteditor/ContactDataObject.cpp b/source/contacteditor/ContactDataObject.cpp index 8fb6a39..9ced5ea 100644 --- a/source/contacteditor/ContactDataObject.cpp +++ b/source/contacteditor/ContactDataObject.cpp @@ -290,6 +290,11 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe } + } else if (PropertyName == wxT("MEDIATYPE")){ + + GroupsListMediaType.erase(*GroupCount); + GroupsListMediaType.insert(std::make_pair(*GroupCount, PropertyValue)); + } else if (!PropertyName.IsEmpty() && !PropertyValue.IsEmpty()){ if (FirstToken == TRUE){ @@ -311,6 +316,12 @@ void ContactDataObject::ProcessMember(wxString PropertySeg1, wxString PropertySe GroupsList.insert(std::make_pair(*GroupCount, PropertySeg2)); + if (!PropertyTokens.IsEmpty()){ + + GroupsListTokens.insert(std::make_pair(*GroupCount, PropertyTokens)); + + } + } diff --git a/source/contacteditor/ContactDataObject.h b/source/contacteditor/ContactDataObject.h index 0792954..cd53dc9 100644 --- a/source/contacteditor/ContactDataObject.h +++ b/source/contacteditor/ContactDataObject.h @@ -468,6 +468,7 @@ class ContactDataObject{ std::map GroupsListAltID; std::map GroupsListPID; std::map GroupsListType; + std::map GroupsListMediaType; std::map GroupsListTokens; std::map GroupsListPref; diff --git a/source/tests/LoadCheck-Load4.vcf b/source/tests/LoadCheck-Load4.vcf index 8785a45..df2a91a 100644 --- a/source/tests/LoadCheck-Load4.vcf +++ b/source/tests/LoadCheck-Load4.vcf @@ -1,6 +1,7 @@ BEGIN:VCARD VERSION:4.0 KIND:individual -MEMBER;ALTID=35;PID=40;PREF=45:7a2af44d-6431-4797-a55f-d86d56304fda +MEMBER;ALTID=35;PID=40;PREF=45;MEDIATYPE=text/plain;EXAMPLE=Meep:7a2af44d-64 + 31-4797-a55f-d86d56304fda FN:Test END:VCARD diff --git a/source/tests/xestiaab_contactload.h b/source/tests/xestiaab_contactload.h index f40eeb9..d7c1210 100644 --- a/source/tests/xestiaab_contactload.h +++ b/source/tests/xestiaab_contactload.h @@ -76,6 +76,19 @@ TEST(ContactLoad, ContactLoadTests){ TestFileIntIter = TestFile.GroupsListPref.find(0); ASSERT_NE(TestFile.GroupsListPref.end(), TestFileIntIter); ASSERT_EQ(45, TestFileIntIter->second); + + // Check that MEDIATYPE parameter. + + TestFileIter = TestFile.GroupsListMediaType.find(0); + ASSERT_NE(TestFile.GroupsListMediaType.end(), TestFileIter); + ASSERT_EQ("text/plain", TestFileIter->second); + + // Check the extra tokens parameter. + + TestFileIter = TestFile.GroupsListTokens.find(0); + ASSERT_NE(TestFile.GroupsListTokens.end(), TestFileIter); + ASSERT_EQ("EXAMPLE=Meep", TestFileIter->second); + } -- 2.39.5