Changeset View
Changeset View
Standalone View
Standalone View
kmime/tests/auto/headertest.cpp
Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | void HeaderTest::testAddressListHeader() | ||||
h->from7BitString( "Mary Smith <mary@x.test>, jdoe@example.org., Who? <one@y.test>" ); | h->from7BitString( "Mary Smith <mary@x.test>, jdoe@example.org., Who? <one@y.test>" ); | ||||
QCOMPARE( h->addresses().count(), 3 ); | QCOMPARE( h->addresses().count(), 3 ); | ||||
names = h->displayNames(); | names = h->displayNames(); | ||||
QCOMPARE( names.takeFirst(), QString( "Mary Smith" ) ); | QCOMPARE( names.takeFirst(), QString( "Mary Smith" ) ); | ||||
QCOMPARE( names.takeFirst(), QString() ); | QCOMPARE( names.takeFirst(), QString() ); | ||||
QCOMPARE( names.takeFirst(), QString( "Who?" ) ); | QCOMPARE( names.takeFirst(), QString( "Who?" ) ); | ||||
QCOMPARE( h->as7BitString( false ), QByteArray( "Mary Smith <mary@x.test>, jdoe@example.org., Who? <one@y.test>" ) ); | QCOMPARE( h->as7BitString( false ), QByteArray( "Mary Smith <mary@x.test>, jdoe@example.org., Who? <one@y.test>" ) ); | ||||
delete h; | delete h; | ||||
{ | |||||
// wrong formatted emailaddress | |||||
h = new Headers::Generics::AddressList(); | |||||
h->from7BitString("\"test@\" <test@example.org>"); | |||||
QCOMPARE(h->addresses().count(), 1); | |||||
QCOMPARE(h->addresses().first(), QByteArray("test@example.org")); | |||||
QCOMPARE(h->displayNames().first(), QString("test@")); | |||||
delete h; | |||||
} | |||||
{ | |||||
// wrong formatted emailaddress | |||||
h = new Headers::Generics::AddressList(); | |||||
h->from7BitString("test@ <test@example.org>"); | |||||
QCOMPARE(h->addresses().count(), 1); | |||||
QCOMPARE(h->addresses().first(), QByteArray("test@example.org")); | |||||
QCOMPARE(h->displayNames().first(), QString("test@")); | |||||
delete h; | |||||
} | |||||
} | } | ||||
void HeaderTest::testMailboxListHeader() | void HeaderTest::testMailboxListHeader() | ||||
{ | { | ||||
// empty header | // empty header | ||||
Headers::Generics::MailboxList *h = new Headers::Generics::MailboxList(); | Headers::Generics::MailboxList *h = new Headers::Generics::MailboxList(); | ||||
QVERIFY( h->isEmpty() ); | QVERIFY( h->isEmpty() ); | ||||
▲ Show 20 Lines • Show All 721 Lines • Show Last 20 Lines |