diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2013-03-02 15:57:34 -0600 |
commit | 7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f (patch) | |
tree | c76702a7f6310fbe9d437e347535422e836e94e9 /tdeabc/vcardparser/testutils.cpp | |
parent | a2a38be7600e2a2c2b49c66902d912ca036a2c0f (diff) | |
parent | 27bbee9a5f9dcda53d8eb23863ee670ad1360e41 (diff) | |
download | tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.tar.gz tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.zip |
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdeabc/vcardparser/testutils.cpp')
-rw-r--r-- | tdeabc/vcardparser/testutils.cpp | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/tdeabc/vcardparser/testutils.cpp b/tdeabc/vcardparser/testutils.cpp new file mode 100644 index 000000000..6547445e5 --- /dev/null +++ b/tdeabc/vcardparser/testutils.cpp @@ -0,0 +1,99 @@ +#include <vcardparser.h> +#include <tdeabc/addressee.h> +#include <tqfile.h> + +using namespace TDEABC; + +Addressee +vcard1() +{ + Addressee addr; + + addr.setName( "Frank Dawson" ); + addr.setOrganization( "Lotus Development Corporation" ); + addr.setUrl( KURL( "http://home.earthlink.net/~fdawson") ); + addr.insertEmail( "fdawson@earthlink.net" ); + addr.insertEmail( "Frank_Dawson@Lotus.com", true ); + addr.insertPhoneNumber( PhoneNumber("+1-919-676-9515",PhoneNumber::Voice|PhoneNumber::Msg + |PhoneNumber::Work ) ); + addr.insertPhoneNumber( PhoneNumber("+1-919-676-9564",PhoneNumber::Fax |PhoneNumber::Work )); + Address a( Address::Work | Address::Postal | Address::Parcel ); + a.setStreet( "6544 Battleford Drive" ); + a.setLocality( "Raleigh" ); + a.setRegion( "NC" ); + a.setPostalCode( "27613-3502" ); + a.setCountry( "U.S.A." ); + addr.insertAddress( a ); + return addr; +} + +Addressee +vcard2() +{ + Addressee addr; + + addr.setName( "Tim Howes" ); + addr.setOrganization( "Netscape Communications Corp." ); + addr.insertEmail( "howes@netscape.com" ); + addr.insertPhoneNumber( PhoneNumber("+1-415-937-3419",PhoneNumber::Voice|PhoneNumber::Msg + |PhoneNumber::Work) ); + addr.insertPhoneNumber( PhoneNumber("+1-415-528-4164",PhoneNumber::Fax |PhoneNumber::Work) ); + Address a( Address::Work ); + a.setStreet( "501 E. Middlefield Rd." ); + a.setLocality( "Mountain View" ); + a.setRegion( "CA" ); + a.setPostalCode( "94043" ); + a.setCountry( "U.S.A." ); + addr.insertAddress( a ); + return addr; +} + +Addressee +vcard3() +{ + Addressee addr; + + addr.setName( "ian geiser" ); + addr.setOrganization( "Source eXtreme" ); + addr.insertEmail( "geiseri@yahoo.com" ); + addr.setTitle( "VP of Engineering" ); + return addr; +} + + +QString +vcardAsText( const TQString& location ) +{ + TQString line; + TQFile file( location ); + if ( file.open( IO_ReadOnly ) ) { + TQTextStream stream( &file ); + if ( !stream.eof() ) { + line = stream.read(); + } + file.close(); + } + return line; +} + +Addressee::List +vCardsAsAddresseeList() +{ + Addressee::List l; + + l.append( vcard1() ); + l.append( vcard2() ); + l.append( vcard3() ); + + return l; +} + +QString +vCardsAsText() +{ + TQString vcards = vcardAsText( "tests/vcard1.vcf" ); + vcards += vcardAsText( "tests/vcard2.vcf" ); + vcards += vcardAsText( "tests/vcard3.vcf" ); + + return vcards; +} |