File indexing completed on 2024-04-21 14:54:37

0001 /*
0002     This file is part of the KContacts framework.
0003     SPDX-FileCopyrightText: 2007 KDE-PIM team <kde-pim@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-or-later
0006 */
0007 
0008 #include "testutils.h"
0009 #include <QDebug>
0010 #include <converter/kcontacts/vcardconverter.h>
0011 #include <kcontacts/addressee.h>
0012 
0013 using namespace KContacts;
0014 
0015 int main()
0016 {
0017     Addressee::List l = vCardsAsAddresseeList();
0018     QByteArray vcards = vCardsAsText();
0019 
0020     VCardConverter vct;
0021 
0022     Addressee::List parsed = vct.parseVCards(vcards);
0023 
0024     if (l.size() != parsed.size()) {
0025         qDebug() << "\tSize - FAILED :" << l.size() << "vs. parsed" << parsed.size();
0026     } else {
0027         qDebug() << "\tSize - PASSED";
0028     }
0029 
0030     Addressee::List::iterator itr1;
0031     Addressee::List::iterator itr2;
0032     // clang-format off
0033     for (itr1 = l.begin(), itr2 = parsed.begin();
0034          itr1 != l.end() && itr2 != parsed.end(); ++itr1, ++itr2) {
0035         if ((*itr1).fullEmail() == (*itr2).fullEmail()
0036             && (*itr1).organization() == (*itr2).organization()
0037             && (*itr1).phoneNumbers() == (*itr2).phoneNumbers()
0038             && (*itr1).emails() == (*itr2).emails()
0039             && (*itr1).role() == (*itr2).role()) {
0040             qDebug() << "\tAddressee  - PASSED";
0041             qDebug() << "\t\t" << (*itr1).fullEmail() << "VS." << (*itr2).fullEmail();
0042             // clang-format on
0043         } else {
0044             qDebug() << "\tAddressee  - FAILED";
0045             qDebug() << (*itr1).toString();
0046             qDebug() << (*itr2).toString();
0047             // qDebug()<<"\t\t"<< (*itr1).fullEmail() << "VS." << (*itr2).fullEmail();
0048         }
0049     }
0050 }